summaryrefslogtreecommitdiff
path: root/vconf-compat
diff options
context:
space:
mode:
authorjusung son <jusung07.son@samsung.com>2018-07-10 09:39:13 +0900
committerjusung son <jusung07.son@samsung.com>2018-07-10 09:39:13 +0900
commit5fb55a0f583fdf0775e5ff77bd56a145fe5c3b71 (patch)
treea469df50457e5ff92ff6482e39527f0637957a81 /vconf-compat
parent14f223efdc32eef73064bfa2508232adcac96010 (diff)
downloadbuxton2-5fb55a0f583fdf0775e5ff77bd56a145fe5c3b71.tar.gz
buxton2-5fb55a0f583fdf0775e5ff77bd56a145fe5c3b71.tar.bz2
buxton2-5fb55a0f583fdf0775e5ff77bd56a145fe5c3b71.zip
Add "_vconf" prefix to the internal APIs in vconf-compat
Change-Id: I42d82fc468c849b4f8b357a57a6e25132b64a764 Signed-off-by: jusung son <jusung07.son@samsung.com>
Diffstat (limited to 'vconf-compat')
-rw-r--r--vconf-compat/vconf.c184
1 files changed, 92 insertions, 92 deletions
diff --git a/vconf-compat/vconf.c b/vconf-compat/vconf.c
index c56760c..0fd64db 100644
--- a/vconf-compat/vconf.c
+++ b/vconf-compat/vconf.c
@@ -41,8 +41,8 @@
#define LOG_TAG "VCONF"
-static void _restore_noti_cb(gpointer key, gpointer value, gpointer user_data);
-static void _close(void);
+static void _vconf_restore_noti_cb(gpointer key, gpointer value, gpointer user_data);
+static void _vconf_con_close(void);
static pthread_mutex_t vconf_lock = PTHREAD_MUTEX_INITIALIZER;
static int _refcnt;
@@ -71,7 +71,7 @@ struct callback_info {
static bool last_result;
-static void free_keynode(struct _keynode_t *keynode)
+static void _vconf_free_keynode(struct _keynode_t *keynode)
{
if (!keynode)
return;
@@ -83,12 +83,12 @@ static void free_keynode(struct _keynode_t *keynode)
free(keynode);
}
-static void free_callback_info(struct callback_info *cb_info)
+static void _vconf_free_callback_info(struct callback_info *cb_info)
{
if (!cb_info)
return;
- free_keynode(cb_info->key_node);
+ _vconf_free_keynode(cb_info->key_node);
g_source_remove(cb_info->source_id);
free(cb_info);
}
@@ -99,7 +99,7 @@ static void _vconf_finish(void)
/* force close */
if (_refcnt > 0) {
_refcnt = 1;
- _close();
+ _vconf_con_close();
}
if (gsource_tbl)
@@ -186,7 +186,7 @@ EXPORT char *vconf_keynode_get_str(keynode_t *keynode)
return keynode->value.s;
}
-static struct buxton_layer *get_layer(const char *key)
+static struct buxton_layer *_vconf_get_layer(const char *key)
{
if (key && !strncmp(key, "memory/", strlen("memory/")))
return memory_layer;
@@ -194,7 +194,7 @@ static struct buxton_layer *get_layer(const char *key)
return system_layer;
}
-static void free_noti(struct noti *noti)
+static void _vconf_free_noti(struct noti *noti)
{
GList *l;
GList *n;
@@ -216,7 +216,7 @@ static void free_noti(struct noti *noti)
free(noti);
}
-static void _close(void)
+static void _vconf_con_close(void)
{
_refcnt--;
if (_refcnt) {
@@ -236,7 +236,7 @@ static void _close(void)
client = NULL;
}
-static void _restore_connection(enum buxton_status status,
+static void _vconf_restore_connection(enum buxton_status status,
void *user_data)
{
int r;
@@ -252,7 +252,7 @@ static void _restore_connection(enum buxton_status status,
}
buxton_close(client);
- r = buxton_open(&client, _restore_connection, NULL);
+ r = buxton_open(&client, _vconf_restore_connection, NULL);
if (r == -1) {
_refcnt = 0;
LOGE("Can't connect to buxton: %d", errno);
@@ -260,12 +260,12 @@ static void _restore_connection(enum buxton_status status,
return;
}
- g_hash_table_foreach(noti_tbl, (GHFunc)_restore_noti_cb, NULL);
+ g_hash_table_foreach(noti_tbl, (GHFunc)_vconf_restore_noti_cb, NULL);
pthread_mutex_unlock(&vconf_lock);
/* LCOV_EXCL_STOP */
}
-static int _open(void)
+static int _vconf_con_open(void)
{
int r;
@@ -274,7 +274,7 @@ static int _open(void)
return 0;
}
- r = buxton_open(&client, _restore_connection, NULL);
+ r = buxton_open(&client, _vconf_restore_connection, NULL);
if (r == -1) {
LOGE("Can't connect to buxton: %d", errno);
_refcnt--;
@@ -282,10 +282,10 @@ static int _open(void)
}
if (noti_tbl) {
- g_hash_table_foreach(noti_tbl, (GHFunc)_restore_noti_cb, NULL);
+ g_hash_table_foreach(noti_tbl, (GHFunc)_vconf_restore_noti_cb, NULL);
} else {
noti_tbl = g_hash_table_new_full(g_str_hash, g_str_equal,
- NULL, (GDestroyNotify)free_noti);
+ NULL, (GDestroyNotify)_vconf_free_noti);
}
if (!system_layer)
@@ -296,7 +296,7 @@ static int _open(void)
return 0;
}
-static void to_vconf_t(const struct buxton_value *val, keynode_t *node)
+static void _vconf_to_vconf_t(const struct buxton_value *val, keynode_t *node)
{
int r;
enum buxton_key_type type;
@@ -354,7 +354,7 @@ static void to_vconf_t(const struct buxton_value *val, keynode_t *node)
}
}
-static GList *copy_noti_list(GList *noti_list)
+static GList *_vconf_copy_noti_list(GList *noti_list)
{
GList *l;
GList *copy;
@@ -373,7 +373,7 @@ static GList *copy_noti_list(GList *noti_list)
return copy;
}
-static GList *free_copy_list(GList *noti_list, GList *copy_list)
+static GList *_vconf_free_copy_list(GList *noti_list, GList *copy_list)
{
GList *l;
GList *ll;
@@ -396,7 +396,7 @@ static GList *free_copy_list(GList *noti_list, GList *copy_list)
return noti_list;
}
-static gboolean call_noti_cb(gpointer data)
+static gboolean _vconf_call_noti_cb(gpointer data)
{
struct callback_info *cb_info = (struct callback_info *)data;
keynode_t *node = cb_info->key_node;
@@ -412,7 +412,7 @@ static gboolean call_noti_cb(gpointer data)
}
pthread_mutex_unlock(&vconf_lock);
- copy = copy_noti_list(noti->noti_list);
+ copy = _vconf_copy_noti_list(noti->noti_list);
for (l = copy; l; l = g_list_next(l)) {
struct noti_cb *noticb = l->data;
@@ -421,14 +421,14 @@ static gboolean call_noti_cb(gpointer data)
noticb->cb(node, noticb->user_data);
}
- noti->noti_list = free_copy_list(noti->noti_list, copy);
+ noti->noti_list = _vconf_free_copy_list(noti->noti_list, copy);
g_hash_table_remove(gsource_tbl, GINT_TO_POINTER(cb_info->source_id));
return G_SOURCE_REMOVE;
}
-static void notify_cb(const struct buxton_layer *layer, const char *key,
+static void _vconf_notify_cb(const struct buxton_layer *layer, const char *key,
const struct buxton_value *val, void *user_data)
{
keynode_t *node;
@@ -441,26 +441,26 @@ static void notify_cb(const struct buxton_layer *layer, const char *key,
}
node->keyname = strdup(key);
- to_vconf_t(val, node);
+ _vconf_to_vconf_t(val, node);
cb_info = calloc(1, sizeof(*cb_info));
if (!cb_info) {
- free_keynode(node);
+ _vconf_free_keynode(node);
LOGE("Failed to create callback_info_s");
return;
}
cb_info->key_node = node;
- cb_info->source_id = g_idle_add_full(G_PRIORITY_HIGH, call_noti_cb, cb_info, NULL);
+ cb_info->source_id = g_idle_add_full(G_PRIORITY_HIGH, _vconf_call_noti_cb, cb_info, NULL);
if (gsource_tbl == NULL)
gsource_tbl = g_hash_table_new_full(g_direct_hash, g_direct_equal,
- NULL, (GDestroyNotify)free_callback_info);
+ NULL, (GDestroyNotify)_vconf_free_callback_info);
g_hash_table_insert(gsource_tbl, GINT_TO_POINTER(cb_info->source_id), cb_info);
}
-static struct noti_cb *find_noti_cb(struct noti *noti, vconf_callback_fn cb)
+static struct noti_cb *_vconf_find_noti_cb(struct noti *noti, vconf_callback_fn cb)
{
GList *l;
@@ -478,14 +478,14 @@ static struct noti_cb *find_noti_cb(struct noti *noti, vconf_callback_fn cb)
}
-static int add_noti(struct noti *noti, vconf_callback_fn cb, void *user_data)
+static int _vconf_add_noti(struct noti *noti, vconf_callback_fn cb, void *user_data)
{
struct noti_cb *noticb;
assert(noti);
assert(cb);
- noticb = find_noti_cb(noti, cb);
+ noticb = _vconf_find_noti_cb(noti, cb);
if (noticb) {
if (noticb->active) {
errno = EEXIST;
@@ -510,7 +510,7 @@ static int add_noti(struct noti *noti, vconf_callback_fn cb, void *user_data)
return 0;
}
-static struct noti *create_noti(const char *key, vconf_callback_fn cb,
+static struct noti *_vconf_create_noti(const char *key, vconf_callback_fn cb,
void *user_data)
{
int r;
@@ -529,7 +529,7 @@ static struct noti *create_noti(const char *key, vconf_callback_fn cb,
return NULL;
}
- r = add_noti(noti, cb, user_data);
+ r = _vconf_add_noti(noti, cb, user_data);
if (r == -1) {
free(noti->key);
free(noti);
@@ -542,13 +542,13 @@ static struct noti *create_noti(const char *key, vconf_callback_fn cb,
}
/* LCOV_EXCL_START */
-static void _restore_noti_cb(gpointer key, gpointer value, gpointer user_data)
+static void _vconf_restore_noti_cb(gpointer key, gpointer value, gpointer user_data)
{
int r;
char *_key = (char *)key;
r = buxton_register_notification_sync(client,
- get_layer(_key), _key, notify_cb, NULL);
+ _vconf_get_layer(_key), _key, _vconf_notify_cb, NULL);
if (r == -1) {
LOGE("vconf_notify_key_changed: key '%s' add notify error %d",
@@ -573,7 +573,7 @@ EXPORT int vconf_notify_key_changed(const char *key, vconf_callback_fn cb,
}
pthread_mutex_lock(&vconf_lock);
- r = _open();
+ r = _vconf_con_open();
if (r == -1) {
pthread_mutex_unlock(&vconf_lock);
return -1;
@@ -581,14 +581,14 @@ EXPORT int vconf_notify_key_changed(const char *key, vconf_callback_fn cb,
noti = g_hash_table_lookup(noti_tbl, key);
if (!noti) {
- noti = create_noti(key, cb, user_data);
+ noti = _vconf_create_noti(key, cb, user_data);
if (!noti) {
- _close();
+ _vconf_con_close();
pthread_mutex_unlock(&vconf_lock);
return -1;
}
- r = buxton_register_notification_sync(client, get_layer(key), key,
- notify_cb, NULL);
+ r = buxton_register_notification_sync(client, _vconf_get_layer(key), key,
+ _vconf_notify_cb, NULL);
if (r == -1) {
LOGE("vconf_notify_key_changed: key '%s' add notify error %d",
key, errno);
@@ -596,12 +596,12 @@ EXPORT int vconf_notify_key_changed(const char *key, vconf_callback_fn cb,
}
/* increase reference count */
if (r == 0)
- r = _open();
+ r = _vconf_con_open();
} else {
- r = add_noti(noti, cb, user_data);
+ r = _vconf_add_noti(noti, cb, user_data);
}
- _close();
+ _vconf_con_close();
pthread_mutex_unlock(&vconf_lock);
if (r == 0)
@@ -610,7 +610,7 @@ EXPORT int vconf_notify_key_changed(const char *key, vconf_callback_fn cb,
return r;
}
-static int unregister_noti(struct noti *noti)
+static int _vconf_unregister_noti(struct noti *noti)
{
int cnt;
GList *l;
@@ -641,7 +641,7 @@ EXPORT int vconf_ignore_key_changed(const char *key, vconf_callback_fn cb)
}
pthread_mutex_lock(&vconf_lock);
- r = _open();
+ r = _vconf_con_open();
if (r == -1) {
pthread_mutex_unlock(&vconf_lock);
return -1;
@@ -649,15 +649,15 @@ EXPORT int vconf_ignore_key_changed(const char *key, vconf_callback_fn cb)
noti = g_hash_table_lookup(noti_tbl, key);
if (!noti) {
- _close();
+ _vconf_con_close();
pthread_mutex_unlock(&vconf_lock);
errno = ENOENT;
return -1;
}
- noticb = find_noti_cb(noti, cb);
+ noticb = _vconf_find_noti_cb(noti, cb);
if (!noticb || !noticb->active) {
- _close();
+ _vconf_con_close();
pthread_mutex_unlock(&vconf_lock);
errno = ENOENT;
return -1;
@@ -669,27 +669,27 @@ EXPORT int vconf_ignore_key_changed(const char *key, vconf_callback_fn cb)
free(noticb);
}
- cnt = unregister_noti(noti);
+ cnt = _vconf_unregister_noti(noti);
if (cnt > 0) {
- _close();
+ _vconf_con_close();
pthread_mutex_unlock(&vconf_lock);
return 0;
}
- r = buxton_unregister_notification_sync(client, get_layer(key),
- key, notify_cb);
+ r = buxton_unregister_notification_sync(client, _vconf_get_layer(key),
+ key, _vconf_notify_cb);
if (r == -1)
LOGE("unregister error '%s' %d", noti->key, errno);
else
- _close();
+ _vconf_con_close();
noti = g_hash_table_lookup(noti_tbl, key);
if (noti)
g_hash_table_remove(noti_tbl, key);
/* decrease reference count */
- _close();
+ _vconf_con_close();
pthread_mutex_unlock(&vconf_lock);
return 0;
@@ -703,17 +703,17 @@ static int _vconf_set(const char *key, const struct buxton_value *val)
assert(val);
pthread_mutex_lock(&vconf_lock);
- r = _open();
+ r = _vconf_con_open();
if (r == -1) {
pthread_mutex_unlock(&vconf_lock);
return -1;
}
- r = buxton_set_value_sync(client, get_layer(key), key, val);
+ r = buxton_set_value_sync(client, _vconf_get_layer(key), key, val);
if (r == -1)
LOGE("set value: key '%s' errno %d", key, errno);
- _close();
+ _vconf_con_close();
pthread_mutex_unlock(&vconf_lock);
return r;
@@ -825,13 +825,13 @@ static int _vconf_get(const char *key, enum buxton_key_type type,
assert(val);
pthread_mutex_lock(&vconf_lock);
- r = _open();
+ r = _vconf_con_open();
if (r == -1) {
pthread_mutex_unlock(&vconf_lock);
return -1;
}
- r = buxton_get_value_sync(client, get_layer(key), key, &v);
+ r = buxton_get_value_sync(client, _vconf_get_layer(key), key, &v);
if (r == -1) {
LOGE("get value: key '%s' errno %d", key, errno);
} else {
@@ -850,7 +850,7 @@ static int _vconf_get(const char *key, enum buxton_key_type type,
}
}
- _close();
+ _vconf_con_close();
pthread_mutex_unlock(&vconf_lock);
return r;
@@ -1025,13 +1025,13 @@ EXPORT int vconf_keylist_free(keylist_t *keylist)
return -1;
}
- g_list_free_full(keylist->list, (GDestroyNotify)free_keynode);
+ g_list_free_full(keylist->list, (GDestroyNotify)_vconf_free_keynode);
free(keylist);
return 0;
}
-static struct _keynode_t *find_keynode(struct _keylist_t *keylist,
+static struct _keynode_t *_vconf_find_keynode(struct _keylist_t *keylist,
const char *keyname)
{
struct _keynode_t *keynode;
@@ -1050,7 +1050,7 @@ static struct _keynode_t *find_keynode(struct _keylist_t *keylist,
return NULL;
}
-static struct _keynode_t *get_keynode(struct _keylist_t *keylist,
+static struct _keynode_t *_vconf_get_keynode(struct _keylist_t *keylist,
const char *keyname)
{
struct _keynode_t *keynode;
@@ -1058,7 +1058,7 @@ static struct _keynode_t *get_keynode(struct _keylist_t *keylist,
assert(keylist);
assert(keyname);
- keynode = find_keynode(keylist, keyname);
+ keynode = _vconf_find_keynode(keylist, keyname);
if (keynode)
return keynode;
@@ -1088,7 +1088,7 @@ EXPORT int vconf_keylist_add_int(keylist_t *keylist,
return -1;
}
- keynode = get_keynode(keylist, keyname);
+ keynode = _vconf_get_keynode(keylist, keyname);
if (!keynode)
return -1;
@@ -1111,7 +1111,7 @@ EXPORT int vconf_keylist_add_bool(keylist_t *keylist,
return -1;
}
- keynode = get_keynode(keylist, keyname);
+ keynode = _vconf_get_keynode(keylist, keyname);
if (!keynode)
return -1;
@@ -1134,7 +1134,7 @@ EXPORT int vconf_keylist_add_dbl(keylist_t *keylist,
return -1;
}
- keynode = get_keynode(keylist, keyname);
+ keynode = _vconf_get_keynode(keylist, keyname);
if (!keynode)
return -1;
@@ -1162,7 +1162,7 @@ EXPORT int vconf_keylist_add_str(keylist_t *keylist,
if (!s)
return -1;
- keynode = get_keynode(keylist, keyname);
+ keynode = _vconf_get_keynode(keylist, keyname);
if (!keynode) {
free(s);
return -1;
@@ -1186,7 +1186,7 @@ EXPORT int vconf_keylist_add_null(keylist_t *keylist, const char *keyname)
return -1;
}
- keynode = get_keynode(keylist, keyname);
+ keynode = _vconf_get_keynode(keylist, keyname);
if (!keynode) {
return -1;
}
@@ -1203,14 +1203,14 @@ EXPORT int vconf_keylist_del(keylist_t *keylist, const char *keyname)
return -1;
}
- keynode = find_keynode(keylist, keyname);
+ keynode = _vconf_find_keynode(keylist, keyname);
if (!keynode) {
errno = ENOENT;
return -1;
}
keylist->list = g_list_remove(keylist->list, keynode);
- free_keynode(keynode);
+ _vconf_free_keynode(keynode);
return 0;
}
@@ -1259,7 +1259,7 @@ EXPORT int vconf_keylist_rewind(keylist_t *keylist)
return 0;
}
-static int set_keynode_value(struct buxton_value *v, struct _keynode_t *keynode)
+static int _vconf_set_keynode_value(struct buxton_value *v, struct _keynode_t *keynode)
{
int r;
enum buxton_key_type t;
@@ -1305,7 +1305,7 @@ static int set_keynode_value(struct buxton_value *v, struct _keynode_t *keynode)
return r;
}
-static struct _keynode_t *alloc_keynode(const char *keyname)
+static struct _keynode_t *_vconf_alloc_keynode(const char *keyname)
{
int r;
struct buxton_value *v;
@@ -1314,7 +1314,7 @@ static struct _keynode_t *alloc_keynode(const char *keyname)
assert(client);
assert(keyname);
- r = buxton_get_value_sync(client, get_layer(keyname), keyname, &v);
+ r = buxton_get_value_sync(client, _vconf_get_layer(keyname), keyname, &v);
if (r == -1) {
LOGE("get value: key '%s' errno %d", keyname, errno);
return NULL;
@@ -1333,7 +1333,7 @@ static struct _keynode_t *alloc_keynode(const char *keyname)
return NULL;
}
- r = set_keynode_value(v, keynode);
+ r = _vconf_set_keynode_value(v, keynode);
if (r == -1) {
free(keynode);
buxton_value_free(v);
@@ -1366,21 +1366,21 @@ EXPORT int vconf_get(keylist_t *keylist,
}
pthread_mutex_lock(&vconf_lock);
- r = _open();
+ r = _vconf_con_open();
if (r == -1) {
pthread_mutex_unlock(&vconf_lock);
return -1;
}
- r = buxton_list_keys_sync(client, get_layer(in_parentDIR), &names, &len);
+ r = buxton_list_keys_sync(client, _vconf_get_layer(in_parentDIR), &names, &len);
if (r == -1) {
LOGE("get key list: errno %d", errno);
- _close();
+ _vconf_con_close();
pthread_mutex_unlock(&vconf_lock);
return -1;
}
- g_list_free_full(keylist->list, (GDestroyNotify)free_keynode);
+ g_list_free_full(keylist->list, (GDestroyNotify)_vconf_free_keynode);
keylist->list = NULL;
for (i = 0; i < len; i++) {
@@ -1389,14 +1389,14 @@ EXPORT int vconf_get(keylist_t *keylist,
if (strncmp(in_parentDIR, names[i], dirlen))
continue;
- keynode = alloc_keynode(names[i]);
+ keynode = _vconf_alloc_keynode(names[i]);
if (keynode)
keylist->list = g_list_append(keylist->list, keynode);
}
buxton_free_keys(names);
- _close();
+ _vconf_con_close();
pthread_mutex_unlock(&vconf_lock);
return 0;
@@ -1454,17 +1454,17 @@ EXPORT int vconf_unset(const char *in_key)
}
pthread_mutex_lock(&vconf_lock);
- r = _open();
+ r = _vconf_con_open();
if (r == -1) {
pthread_mutex_unlock(&vconf_lock);
return -1;
}
- r = buxton_unset_value_sync(client, get_layer(in_key), in_key);
+ r = buxton_unset_value_sync(client, _vconf_get_layer(in_key), in_key);
if (r == -1)
LOGE("unset value: key '%s' errno %d", in_key, errno);
- _close();
+ _vconf_con_close();
pthread_mutex_unlock(&vconf_lock);
/* LCOV_EXCL_STOP */
@@ -1495,16 +1495,16 @@ EXPORT int vconf_unset_recursive(const char *in_dir)
}
pthread_mutex_lock(&vconf_lock);
- r = _open();
+ r = _vconf_con_open();
if (r == -1) {
pthread_mutex_unlock(&vconf_lock);
return -1;
}
- r = buxton_list_keys_sync(client, get_layer(in_dir), &names, &len);
+ r = buxton_list_keys_sync(client, _vconf_get_layer(in_dir), &names, &len);
if (r == -1) {
LOGE("get key list: errno %d", errno);
- _close();
+ _vconf_con_close();
pthread_mutex_unlock(&vconf_lock);
return -1;
}
@@ -1518,14 +1518,14 @@ EXPORT int vconf_unset_recursive(const char *in_dir)
pthread_mutex_lock(&vconf_lock);
if (r == -1) {
buxton_free_keys(names);
- _close();
+ _vconf_con_close();
pthread_mutex_unlock(&vconf_lock);
return -1;
}
}
buxton_free_keys(names);
- _close();
+ _vconf_con_close();
pthread_mutex_unlock(&vconf_lock);
/* LCOV_EXCL_STOP */
@@ -1540,20 +1540,20 @@ EXPORT int vconf_sync_key(const char *in_key)
assert(in_key);
pthread_mutex_lock(&vconf_lock);
- r = _open();
+ r = _vconf_con_open();
if (r == -1) {
pthread_mutex_unlock(&vconf_lock);
return -1;
}
- r = buxton_get_value_sync(client, get_layer(in_key), in_key, &v);
+ r = buxton_get_value_sync(client, _vconf_get_layer(in_key), in_key, &v);
if (r == -1) {
LOGE("get value: key '%s'", in_key);
} else {
r = 0;
}
- _close();
+ _vconf_con_close();
pthread_mutex_unlock(&vconf_lock);
return r;
@@ -1569,7 +1569,7 @@ EXPORT int vconf_keylist_lookup(keylist_t *keylist, const char *keyname,
return -1;
}
- keynode = find_keynode(keylist, keyname);
+ keynode = _vconf_find_keynode(keylist, keyname);
if (!keynode)
return 0;