Use libsyscommon for list and ini-parser 99/250899/2
authorYunmi Ha <yunmi.ha@samsung.com>
Tue, 5 Jan 2021 07:59:12 +0000 (16:59 +0900)
committerYunmi Ha <yunmi.ha@samsung.com>
Wed, 6 Jan 2021 04:20:30 +0000 (13:20 +0900)
Change-Id: I6bf9fe57fbd38c0c59b71d30dec4c3b1918fa31f
Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
12 files changed:
CMakeLists.txt
src/auto-test/test.c
src/auto-test/test.h
src/driver/emulator.c
src/driver/gpio_haptic.c
src/driver/haptic-dev.h
src/driver/haptic.c
src/driver/haptic.h
src/driver/standard.c
src/shared/config-parser.c [deleted file]
src/shared/config-parser.h [deleted file]
src/shared/list.h [deleted file]

index ce52bc48937944dd5bfb07cc97189d4e121e7335..61437e4ae4a0cc6141a8da212a9bea2436fa6043 100644 (file)
@@ -10,7 +10,6 @@ SET(VERSION 0.1.0)
 SET(SRCS
        src/core/main.c
        src/shared/common.c
-       src/shared/config-parser.c
        src/shared/device-idler.c
        src/shared/log.c
        src/driver/haptic.c
@@ -56,6 +55,7 @@ SET(DRIVER_PKG_MODULES
        dlog
        capi-system-info
        glib-2.0
+       libsyscommon
 )
 
 INCLUDE(FindPkgConfig)
index 581d4d0b3041df0ee250a48c2672ba96bef81073..da61f0eb91590fdbde193efcf68cb711955e91d7 100644 (file)
  */
 
 #include <strings.h>
+#include <libsyscommon/list.h>
 #include "test.h"
 
-static dd_list *dd_head;
+static list *dd_head;
 
 void add_test(const struct test_ops *d)
 {
        if (d->priority == TEST_PRIORITY_HIGH)
-               DD_LIST_PREPEND(dd_head, d);
+               LIST_PREPEND(dd_head, d);
        else
-               DD_LIST_APPEND(dd_head, d);
+               LIST_APPEND(dd_head, d);
 }
 
 void remove_test(const struct test_ops *d)
 {
-       DD_LIST_REMOVE(dd_head, d);
+       LIST_REMOVE(dd_head, d);
 }
 
 const struct test_ops *find_test(const char *name)
 {
-       dd_list *elem;
+       list *elem;
        const struct test_ops *d;
 
-       DD_LIST_FOREACH(dd_head, elem, d) {
+       LIST_FOREACH(dd_head, elem, d) {
                if (!strcasecmp(d->name, name))
                        return d;
        }
@@ -48,11 +49,11 @@ const struct test_ops *find_test(const char *name)
 
 void test_init(void *data)
 {
-       dd_list *elem;
+       list *elem;
        const struct test_ops *d;
 
-       _D("Test module count(%d)", DD_LIST_LENGTH(dd_head));
-       DD_LIST_FOREACH(dd_head, elem, d) {
+       _D("Test module count(%d)", LIST_LENGTH(dd_head));
+       LIST_FOREACH(dd_head, elem, d) {
                _D("'%s' initialize", d->name);
                if (d->init)
                        d->init(data);
@@ -61,10 +62,10 @@ void test_init(void *data)
 
 void test_exit(void *data)
 {
-       dd_list *elem;
+       list *elem;
        const struct test_ops *d;
 
-       DD_LIST_FOREACH(dd_head, elem, d) {
+       LIST_FOREACH(dd_head, elem, d) {
                _D("'%s' deinitialize", d->name);
                if (d->exit)
                        d->exit(data);
index 2bdbdf6fb5c55451eeeae0a1e739616cfa272578..e0b93eccca0e5c11b3d42484b642df73ea1cf713 100644 (file)
@@ -23,7 +23,6 @@
 #include <errno.h>
 #include <libsyscommon/dbus-system.h>
 
-#include "shared/list.h"
 #include "shared/log.h"
 #include "shared/common.h"
 
index b04dad7f4c5da98daba56eab15c6bb8d7425e2b1..b2eb229ba7d1ce03d0f21e52509979197adf4489 100644 (file)
 
 #include <stdio.h>
 #include <errno.h>
+#include <libsyscommon/list.h>
 
 #include "shared/common.h"
 #include "shared/log.h"
-#include "shared/list.h"
 #include "haptic-dev.h"
 
-static dd_list *handle_list;
+static list *handle_list;
 static int unique_number = 0;
 
 /* START: Haptic Module APIs */
@@ -39,7 +39,7 @@ static int get_device_count(int *count)
 
 static int open_device(int device_index, int *device_handle)
 {
-       dd_list *elem;
+       list *elem;
        int handle;
        bool found = false;
 
@@ -48,12 +48,12 @@ static int open_device(int device_index, int *device_handle)
 
        while (found != true) {
                ++unique_number;
-               elem = DD_LIST_FIND(handle_list, (gpointer)(long)unique_number);
+               elem = LIST_FIND(handle_list, (gpointer)(long)unique_number);
                if (!elem)
                        found = true;
        }
        handle = unique_number;
-       DD_LIST_APPEND(handle_list, (gpointer)(long)handle);
+       LIST_APPEND(handle_list, (gpointer)(long)handle);
 
        if (device_handle)
                *device_handle = handle;
@@ -63,16 +63,16 @@ static int open_device(int device_index, int *device_handle)
 
 static int close_device(int device_handle)
 {
-       DD_LIST_REMOVE(handle_list, (gpointer)(long)device_handle);
+       LIST_REMOVE(handle_list, (gpointer)(long)device_handle);
 
        return 0;
 }
 
 static int vibrate_monotone(int device_handle, int duration, int frequency, int overdrive, int level, int intensity, int priority)
 {
-       dd_list *elem;
+       list *elem;
 
-       elem = DD_LIST_FIND(handle_list, (gpointer)(long)device_handle);
+       elem = LIST_FIND(handle_list, (gpointer)(long)device_handle);
        if (!elem)
                return -EINVAL;
 
@@ -81,9 +81,9 @@ static int vibrate_monotone(int device_handle, int duration, int frequency, int
 
 static int stop_device(int device_handle)
 {
-       dd_list *elem;
+       list *elem;
 
-       elem = DD_LIST_FIND(handle_list, (gpointer)(long)device_handle);
+       elem = LIST_FIND(handle_list, (gpointer)(long)device_handle);
        if (!elem)
                return -EINVAL;
 
index 6c3b4c180f0a3a9aac7b6fef16bad5dfbb5e92e3..38dba02049ebb80d36d707614e9087e38ab0e00c 100644 (file)
 
 #include <stdlib.h>
 #include <glib.h>
+#include <libsyscommon/list.h>
 
 #include "shared/common.h"
 #include "shared/log.h"
-#include "shared/list.h"
 #include "haptic-interface.h"
 #include "peripheral_io.h"
 
@@ -74,7 +74,7 @@
 
 static peripheral_i2c_h device_handle = NULL;
 
-static dd_list *handle_list;
+static list *handle_list;
 static int unique_number;
 
 static bool state = false;
@@ -85,9 +85,9 @@ static int gpio_haptic_stop_device(int handle);
 
 static bool find_from_list(int handle)
 {
-       dd_list *elem;
+       list *elem;
 
-       elem = DD_LIST_FIND(handle_list, (gpointer)(long)handle);
+       elem = LIST_FIND(handle_list, (gpointer)(long)handle);
        if (elem)
                return true;
 
@@ -137,13 +137,13 @@ static int gpio_haptic_open_device(int device_index, int *handle)
 {
        int n;
        bool found = false;
-       dd_list *elem;
+       list *elem;
 
        if (!handle)
                return -EINVAL;
 
        /* if it is the first element */
-       n = DD_LIST_LENGTH(handle_list);
+       n = LIST_LENGTH(handle_list);
        if (n == 0) {
                _I("Peripheral Device Open.");
                if (device_handle == NULL) {
@@ -159,13 +159,13 @@ static int gpio_haptic_open_device(int device_index, int *handle)
 
        while (found != true) {
                ++unique_number;
-               elem = DD_LIST_FIND(handle_list, (gpointer)(long)unique_number);
+               elem = LIST_FIND(handle_list, (gpointer)(long)unique_number);
                if (!elem)
                        found = true;
        }
 
        /* add info to local list */
-       DD_LIST_APPEND(handle_list, (gpointer)(long)unique_number);
+       LIST_APPEND(handle_list, (gpointer)(long)unique_number);
 
        *handle = unique_number;
        return 0;
@@ -193,10 +193,10 @@ static int gpio_haptic_close_device(int handle)
                _I("Already stopped or failed to stop effect: %d", r);
 
        _D("Handle(%d) is closed and timer deleted.", handle);
-       DD_LIST_REMOVE(handle_list, (gpointer)(long)handle);
+       LIST_REMOVE(handle_list, (gpointer)(long)handle);
 
        /* if it is the last element */
-       n = DD_LIST_LENGTH(handle_list);
+       n = LIST_LENGTH(handle_list);
        if (n == 0) {
                _I("Peripheral Device Close.");
                if (device_handle != NULL) {
index 979abedb4395a3fd4b7d9fc118502704ee93554e..208a5a11a00dffcecf4a833a7335e06b340bd78f 100644 (file)
@@ -21,7 +21,6 @@ i * Copyright (c) 2012 - 2020 Samsung Electronics Co., Ltd.
 #define __FEEDBACKD_HAPTIC_DEV_H__
 
 #include <stdbool.h>
-#include "shared/list.h"
 #include "haptic-interface.h"
 
 int haptic_load_device(void);
index a9ebe5bab344cb03972bc9fc4f1c2ca0141b8608..3de4aae45f7891a46afa9d6c5c02e52167fce052 100644 (file)
 #include <time.h>
 #include <string.h>
 #include <libsyscommon/dbus-system.h>
+#include <libsyscommon/list.h>
+#include <libsyscommon/ini-parser.h>
 
 #include "shared/log.h"
-#include "shared/list.h"
 #include "shared/common.h"
 #include "shared/device-idler.h"
-#include "shared/config-parser.h"
 #include "haptic.h"
 #include "haptic-dev.h"
 
@@ -80,7 +80,7 @@
 struct vibration_config {
        char *pattern; /* pattern name */
        char *standard; /* assigned standard pattern name */
-       dd_list *data; /* duration_data list */
+       list *data; /* duration_data list */
        unsigned int pattern_duration;
        int unlimit;
 };
@@ -102,7 +102,7 @@ enum poweroff_type {
 
 struct haptic_info {
        char *sender;
-       dd_list *handle_list;
+       list *handle_list;
        guint id_watch;
 };
 
@@ -125,12 +125,12 @@ struct vibrate_monotone_info {
 static int g_handle;
 
 /* pattern configuration list */
-static dd_list *vib_conf_list;
+static list *vib_conf_list;
 
 static guint duration_timer;
 
 /* haptic operation variable */
-static dd_list *haptic_handle_list;
+static list *haptic_handle_list;
 
 static bool haptic_disabled;
 
@@ -148,7 +148,7 @@ static int remove_haptic_info(struct haptic_info *info);
 
 struct haptic_data cur_h_data;
 
-static int insert_conf_data(dd_list **conf_data, struct duration_data *update)
+static int insert_conf_data(list **conf_data, struct duration_data *update)
 {
        struct duration_data *data;
 
@@ -161,7 +161,7 @@ static int insert_conf_data(dd_list **conf_data, struct duration_data *update)
        /* insert vibration pattern data */
        // to debug :
        // _D("%dD%dI%dF%dO%dW", data->duration, data->intensity, data->frequency, data->overdrive, data->wait);
-       DD_LIST_APPEND(*conf_data, data);
+       LIST_APPEND(*conf_data, data);
        return 0;
 }
 
@@ -189,7 +189,7 @@ static void get_pattern_property(char **iter, char property, int *value)
 }
 
 /* [A]xxxDxxxIxxxFxxxOxxxW format */
-static int insert_raw_data_format(dd_list **conf_data, char *value)
+static int insert_raw_data_format(list **conf_data, char *value)
 {
        struct duration_data update = {0, };
        char *iter;
@@ -372,7 +372,7 @@ static int load_standard_format(const char *pattern)
                }
        }
        close(fd);
-       DD_LIST_APPEND(vib_conf_list, conf);
+       LIST_APPEND(vib_conf_list, conf);
        return ret;
 
 error_out:
@@ -423,7 +423,7 @@ static int vibration_load_config(struct parse_result *result, void *user_data)
        if (len == 0) {
                if (insert_raw_data_format(&conf->data, NULL) < 0)
                        goto error_out;
-               DD_LIST_APPEND(vib_conf_list, conf);
+               LIST_APPEND(vib_conf_list, conf);
                return 0;
        }
 
@@ -439,7 +439,7 @@ static int vibration_load_config(struct parse_result *result, void *user_data)
                        _E("Failed to copy standard name.");
                        goto error_out;
                }
-               DD_LIST_APPEND(vib_conf_list, conf);
+               LIST_APPEND(vib_conf_list, conf);
                return 0;
        }
 
@@ -461,7 +461,7 @@ static int vibration_load_config(struct parse_result *result, void *user_data)
                goto error_out;
        } else
                conf->pattern_duration = duration;
-       DD_LIST_APPEND(vib_conf_list, conf);
+       LIST_APPEND(vib_conf_list, conf);
 
        return 0;
 
@@ -577,7 +577,7 @@ void haptic_name_owner_changed(GDBusConnection *connection,
        const gchar     *name,
        gpointer         user_data)
 {
-       dd_list *n;
+       list *n;
        struct haptic_info *info = user_data;
        int handle;
 
@@ -611,7 +611,7 @@ static struct haptic_info *add_haptic_info(const char *sender)
                return NULL;
        }
 
-       DD_LIST_APPEND(haptic_handle_list, info);
+       LIST_APPEND(haptic_handle_list, info);
 
        info->id_watch = dbus_handle_watch_name(sender, NULL, haptic_name_owner_changed, info, NULL);
 
@@ -624,8 +624,8 @@ static int remove_haptic_info(struct haptic_info *info)
 
        dbus_handle_unwatch_name(info->id_watch);
 
-       DD_LIST_REMOVE(haptic_handle_list, info);
-       DD_LIST_FREE_LIST(info->handle_list);
+       LIST_REMOVE(haptic_handle_list, info);
+       LIST_FREE_LIST(info->handle_list);
        if (info->sender) {
                free(info->sender);
        }
@@ -636,14 +636,14 @@ static int remove_haptic_info(struct haptic_info *info)
 
 static struct haptic_info *get_matched_haptic_info(const char *sender)
 {
-       dd_list *n;
+       list *n;
        struct haptic_info *info;
        int len;
 
        assert(sender);
 
        len = strlen(sender) + 1;
-       DD_LIST_FOREACH(haptic_handle_list, n, info) {
+       LIST_FOREACH(haptic_handle_list, n, info) {
                if (!strncmp(info->sender, sender, len))
                        return info;
        }
@@ -688,7 +688,7 @@ GVariant *hdbus_open_device(GDBusConnection *conn,
                }
        }
 
-       DD_LIST_APPEND(info->handle_list, (gpointer)(long)handle);
+       LIST_APPEND(info->handle_list, (gpointer)(long)handle);
 
        ret = handle;
 
@@ -745,8 +745,8 @@ GVariant *hdbus_close_device(GDBusConnection *conn,
                goto exit;
        }
 
-       DD_LIST_REMOVE(info->handle_list, (gpointer)(long)handle);
-       cnt = DD_LIST_LENGTH(info->handle_list);
+       LIST_REMOVE(info->handle_list, (gpointer)(long)handle);
+       cnt = LIST_LENGTH(info->handle_list);
        if (cnt == 0)
                remove_haptic_info(info);
 
@@ -868,7 +868,7 @@ exit:
 
 static gboolean haptic_duration_play(void *data)
 {
-       dd_list *head, *n, *next;
+       list *head, *n, *next;
        struct duration_data *node;
        int ret = 0;
 
@@ -886,7 +886,7 @@ static gboolean haptic_duration_play(void *data)
                        goto out;
                }
        } else
-               head = (dd_list *)data;
+               head = (list *)data;
 
        if (cur_h_data.stop) {
                _I("Stop currunt vibration.");
@@ -896,7 +896,7 @@ static gboolean haptic_duration_play(void *data)
                goto out;
        }
 
-       DD_LIST_FOREACH_SAFE(head, n, next, node) {
+       LIST_FOREACH_SAFE(head, n, next, node) {
                _I("Handle(%d) play=%dms and Wait=%dms %s type. (level=%d, intensity=%d, frequency=%d)",
                        cur_h_data.handle, node->duration, node->wait,
                        cur_h_data.unlimit ? "Unlimit" : "Once", cur_h_data.level, node->intensity, node->frequency);
@@ -928,7 +928,7 @@ out:
 static void vibrate_pattern_idler_cb(void *data)
 {
        struct vibrate_pattern_info *vibrate_info;
-       dd_list *elem;
+       list *elem;
        struct vibration_config *conf;
        char pattern[PATH_MAX];
        int ret;
@@ -951,7 +951,7 @@ static void vibrate_pattern_idler_cb(void *data)
        }
 
        snprintf(pattern, sizeof(pattern), "%s", vibrate_info->pattern);
-       DD_LIST_FOREACH(vib_conf_list, elem, conf) {
+       LIST_FOREACH(vib_conf_list, elem, conf) {
                if (!conf->pattern)
                        continue;
                if (strcmp(conf->pattern, pattern))
@@ -1080,12 +1080,12 @@ GVariant *hdbus_show_handle_list(GDBusConnection *conn,
        const gchar *sender, const gchar *path, const gchar *iface, const gchar *name,
        GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data)
 {
-       dd_list *n;
-       dd_list *elem;
+       list *n;
+       list *elem;
        struct haptic_info *info;
 
        _D("Sender Handle");
-       DD_LIST_FOREACH(haptic_handle_list, n, info) {
+       LIST_FOREACH(haptic_handle_list, n, info) {
                for (elem = info->handle_list; elem; elem = elem->next)
                        _D("%s %d", info->sender, (int)(long)elem->data);
        }
@@ -1095,7 +1095,7 @@ GVariant *hdbus_show_handle_list(GDBusConnection *conn,
 
 int pattern_is_supported(const char *pattern)
 {
-       dd_list *elem;
+       list *elem;
        struct vibration_config *conf;
        int ret;
 
@@ -1103,7 +1103,7 @@ int pattern_is_supported(const char *pattern)
                return -EINVAL;
 
        ret = 0;
-       DD_LIST_FOREACH(vib_conf_list, elem, conf) {
+       LIST_FOREACH(vib_conf_list, elem, conf) {
                if (!conf->pattern)
                        continue;
                if (!strcmp(conf->pattern, pattern)) {
index 094749459f54117d8f6a3c32b283bd58a71f6757..7251c8de7e49a7a9c14606b697f22639ce70e9b3 100644 (file)
 #ifndef __FEEDBACKD_HAPTIC_H__
 #define __FEEDBACKD_HAPTIC_H__
 
-#include <device/power.h>
 #include <stdbool.h>
+#include <device/power.h>
+#include <libsyscommon/list.h>
 #include "shared/common.h"
-#include "shared/list.h"
 
 enum priority_level {
        PRIORITY_MIN = 0,
@@ -33,7 +33,7 @@ enum priority_level {
 };
 
 struct haptic_data {
-       dd_list *vibration_data;
+       list *vibration_data;
        unsigned int handle;
        int level;
        int priority;
index 17a9b23b208d6320fd6e0b2c21b8e1d1dc27999f..2ac12717567ae28b41178fd65ee0e0ddfceb59f9 100644 (file)
 #include <fcntl.h>
 #include <dirent.h>
 #include <linux/input.h>
+#include <libsyscommon/list.h>
 
 #include "shared/common.h"
 #include "shared/log.h"
-#include "shared/list.h"
 #include "haptic-interface.h"
 
 #define MAX_MAGNITUDE                  0xFFFF
@@ -73,8 +73,8 @@ struct ff_info {
 };
 
 static int ff_fd;
-static dd_list *ff_list;
-static dd_list *handle_list;
+static list *ff_list;
+static list *handle_list;
 static char ff_path[PATH_MAX];
 static int unique_number;
 static int current_effect_id = -1;
@@ -84,9 +84,9 @@ static int stop_device(int device_handle);
 struct ff_info *read_from_list(int handle)
 {
        struct ff_info *temp;
-       dd_list *elem;
+       list *elem;
 
-       DD_LIST_FOREACH(ff_list, elem, temp) {
+       LIST_FOREACH(ff_list, elem, temp) {
                if (temp->handle == handle)
                        return temp;
        }
@@ -96,9 +96,9 @@ struct ff_info *read_from_list(int handle)
 static bool check_valid_handle(struct ff_info *info)
 {
        struct ff_info *temp;
-       dd_list *elem;
+       list *elem;
 
-       DD_LIST_FOREACH(ff_list, elem, temp) {
+       LIST_FOREACH(ff_list, elem, temp) {
                if (temp == info)
                        break;
        }
@@ -336,13 +336,13 @@ static int open_device(int device_index, int *device_handle)
        struct ff_info *info;
        int n;
        bool found = false;
-       dd_list *elem;
+       list *elem;
 
        if (!device_handle)
                return -EINVAL;
 
        /* if it is the first element */
-       n = DD_LIST_LENGTH(ff_list);
+       n = LIST_LENGTH(ff_list);
        if (n == 0 && !ff_fd) {
                _I("First element: open ff driver");
                /* open ff driver */
@@ -368,7 +368,7 @@ static int open_device(int device_index, int *device_handle)
 
        while (found != true) {
                ++unique_number;
-               elem = DD_LIST_FIND(handle_list, (gpointer)(long)unique_number);
+               elem = LIST_FIND(handle_list, (gpointer)(long)unique_number);
                if (!elem)
                        found = true;
        }
@@ -376,8 +376,8 @@ static int open_device(int device_index, int *device_handle)
        info->handle = unique_number;
 
        /* add info to local list */
-       DD_LIST_APPEND(ff_list, info);
-       DD_LIST_APPEND(handle_list, (gpointer)(long)info->handle);
+       LIST_APPEND(ff_list, info);
+       LIST_APPEND(handle_list, (gpointer)(long)info->handle);
 
        *device_handle = info->handle;
        return 0;
@@ -407,15 +407,15 @@ static int close_device(int device_handle)
        /* stop vibration */
        stop_device(device_handle);
 
-       DD_LIST_REMOVE(handle_list, (gpointer)(long)info->handle);
+       LIST_REMOVE(handle_list, (gpointer)(long)info->handle);
 
        safe_free(info->ffinfobuffer);
        /* remove info from local list */
-       DD_LIST_REMOVE(ff_list, info);
+       LIST_REMOVE(ff_list, info);
        safe_free(info);
 
        /* if it is the last element */
-       n = DD_LIST_LENGTH(ff_list);
+       n = LIST_LENGTH(ff_list);
        if (n == 0 && ff_fd) {
                _I("Last element: close ff driver");
                /* close ff driver */
diff --git a/src/shared/config-parser.c b/src/shared/config-parser.c
deleted file mode 100644 (file)
index 013ddbf..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * feedbackd
- *
- * Copyright (c) 2013 - 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include "log.h"
-#include "config-parser.h"
-
-#define MAX_LINE       512
-#define MAX_SECTION    64
-#define WHITESPACE     " \t"
-#define NEWLINE                "\n\r"
-#define COMMENT                '#'
-
-static inline char *trim_str(char *s)
-{
-       char *t;
-       /* left trim */
-       s += strspn(s, WHITESPACE);
-
-       /* right trim */
-       for (t = strchr(s, 0); t > s; t--)
-               if (!strchr(WHITESPACE, t[-1]))
-                       break;
-       *t = 0;
-       return s;
-}
-
-int config_parse(const char *file_name, int cb(struct parse_result *result,
-                       void *user_data), void *user_data)
-{
-       FILE *f = NULL;
-       struct parse_result result;
-       /* use stack for parsing */
-       char line[MAX_LINE];
-       char section[MAX_SECTION];
-       char *start, *end, *name, *value;
-       int lineno = 0, ret = 0;
-
-       if (!file_name || !cb) {
-               ret = -EINVAL;
-               goto error;
-       }
-
-       /* open conf file */
-       f = fopen(file_name, "r");
-       if (!f) {
-               _E("Failed to open file '%s'.", file_name);
-               ret = -EIO;
-               goto error;
-       }
-
-       /* parsing line by line */
-       while (fgets(line, MAX_LINE, f) != NULL) {
-               lineno++;
-
-               start = line;
-               start[strcspn(start, NEWLINE)] = '\0';
-               start = trim_str(start);
-
-               if (*start == COMMENT) {
-                       continue;
-               } else if (*start == '[') {
-                       /* parse section */
-                       end = strchr(start, ']');
-                       if (!end || *end != ']') {
-                               ret = -EBADMSG;
-                               goto error;
-                       }
-
-                       *end = '\0';
-                       strncpy(section, start + 1, sizeof(section)-1);
-                       section[MAX_SECTION-1] = '\0';
-               } else if (*start) {
-                       /* parse name & value */
-                       end = strchr(start, '=');
-                       if (!end || *end != '=') {
-                               ret = -EBADMSG;
-                               goto error;
-                       }
-                       *end = '\0';
-                       name = trim_str(start);
-                       value = trim_str(end + 1);
-                       end = strchr(value, COMMENT);
-                       if (end && *end == COMMENT) {
-                               *end = '\0';
-                               value = trim_str(value);
-                       }
-
-                       result.section = section;
-                       result.name = name;
-                       result.value = value;
-                       /* callback with parse result */
-                       ret = cb(&result, user_data);
-                       if (ret < 0) {
-                               ret = -EBADMSG;
-                               goto error;
-                       }
-               }
-       }
-       _D("Success to load '%s'.", file_name);
-       fclose(f);
-       return 0;
-
-error:
-       if (f)
-               fclose(f);
-       _E("Failed to read '%s': %d", file_name, lineno);
-       return ret;
-}
-
diff --git a/src/shared/config-parser.h b/src/shared/config-parser.h
deleted file mode 100644 (file)
index 71fa379..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * feedbackd
- *
- * Copyright (c) 2013 - 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef __FEEDBACKD_CONFIG_PARSER_H__
-#define __FEEDBACKD_CONFIG_PARSER_H__
-
-#define MATCH(a, b)            (!strncmp(a, b, strlen(a)))
-#define SET_CONF(a, b)         (a = (b > 0.0 ? b : a))
-
-struct parse_result {
-       char *section;
-       char *name;
-       char *value;
-};
-
-/**
- * @brief Parse config file and call callback\n
- * @param[in] file_name conf file.
- * @param[in] cb cb is called when conf file is parsed line by line.
- * @param[in] user_data user data is passed to cb.
- * @return 0 on success, negative if failed
- */
-int config_parse(const char *file_name, int cb(struct parse_result *result,
-       void *user_data), void *user_data);
-
-#endif
-
diff --git a/src/shared/list.h b/src/shared/list.h
deleted file mode 100644 (file)
index 1ef40b4..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * feedbackd
- *
- * Copyright (c) 2012 - 2017 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __FEEDBACKD_LIST_H__
-#define __FEEDBACKD_LIST_H__
-
-#include <glib.h>
-typedef GList dd_list;
-
-#define DD_LIST_PREPEND(a, b)          \
-       a = g_list_prepend(a, (gpointer)b)
-#define DD_LIST_APPEND(a, b)           \
-       a = g_list_append(a, (gpointer)b)
-#define DD_LIST_REMOVE(a, b)           \
-       a = g_list_remove(a, (gpointer)b)
-#define DD_LIST_REMOVE_LIST(a, b) \
-       a = g_list_delete_link(a, b)
-#define DD_LIST_LENGTH(a)                      \
-       g_list_length(a)
-#define DD_LIST_NTH(a, b)                      \
-       g_list_nth_data(a, b)
-#define DD_LIST_FIND(a, b)             \
-       g_list_find(a, (gpointer)b)
-#define DD_LIST_FREE_LIST(a)        \
-       g_list_free(a)
-#define DD_LIST_FOREACH(head, elem, node)      \
-       for (elem = head, node = NULL; \
-                       elem && ((node = elem->data) != NULL); \
-                       elem = elem->next, node = NULL)
-#define DD_LIST_FOREACH_SAFE(head, elem, elem_next, node) \
-       for (elem = head, elem_next = g_list_next(elem), node = NULL; \
-                       elem && ((node = elem->data) != NULL); \
-                       elem = elem_next, elem_next = g_list_next(elem), node = NULL)
-#define DD_LIST_REVERSE_FOREACH(head, elem, node) \
-       for (elem = g_list_last(head), node = NULL; \
-                       elem && ((node = elem->data) != NULL); \
-                       elem = g_list_previous(elem), node = NULL)
-#define DD_LIST_REVERSE_FOREACH_SAFE(head, elem, elem_next, node) \
-       for (elem = g_list_last(head), elem_next = g_list_previous(elem), node = NULL; \
-                       elem && ((node = elem->data) != NULL); \
-                       elem = elem_next, elem_next = g_list_previous(elem), node = NULL)
-#define DD_LIST_NEXT(a)                \
-       g_list_next(a)
-
-#endif