* Taeheon Kim <th908.kim@samsung.com>,
* YoungJun Cho <yj44.cho@samsung.com>,
* SooChan Lim <sc1.lim@samsung.com>,
- * Boram Park <sc1.lim@samsung.com>
+ * Boram Park <boram1288.park@samsung.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
static pthread_mutex_t g_dic_lock = PTHREAD_MUTEX_INITIALIZER;
static dictionary *g_dic = NULL;
+static int init_dic = 0;
static int
_tdm_config_check_file_owner(const char *filepath)
pthread_mutex_lock(&g_dic_lock);
}
-static unsigned int
+static void
_tdm_config_check_init(void)
{
- if (g_dic)
- return 1;
+ if (init_dic)
+ return;
+
+ init_dic = 1;
g_dic = _tdm_config_load_file(TDM_DATA_PATH, TDM_CONFIG_FILENAME);
_tdm_config_check_logs();
TDM_INFO("tdm config init %s (%p)", (g_dic) ? "successed" : "failed", g_dic);
-
- return (g_dic) ? 1 : 0;
}
INTERN void
iniparser_freedict(g_dic);
g_dic = NULL;
+ init_dic = 0;
TDM_INFO("tdm config deinit done");
pthread_mutex_lock(&g_dic_lock);
- if (!_tdm_config_check_init()) {
+ _tdm_config_check_init();
+ if (!g_dic) {
TDM_INFO("%s = %d: default", key, default_value);
pthread_mutex_unlock(&g_dic_lock);
return default_value;
pthread_mutex_lock(&g_dic_lock);
- if (!_tdm_config_check_init()) {
+ _tdm_config_check_init();
+ if (!g_dic) {
TDM_INFO("%s = %s: default", key, default_value);
pthread_mutex_unlock(&g_dic_lock);
return default_value;
pthread_mutex_lock(&g_dic_lock);
- if (!_tdm_config_check_init()) {
+ _tdm_config_check_init();
+ if (!g_dic) {
TDM_INFO("%s = %d set failed", key, value);
pthread_mutex_unlock(&g_dic_lock);
return TDM_ERROR_BAD_REQUEST;
ret = iniparser_set(g_dic, key, (const char*)temp);
- _tdm_config_check_logs();
-
pthread_mutex_unlock(&g_dic_lock);
TDM_RETURN_VAL_IF_FAIL(ret == 0, TDM_ERROR_OPERATION_FAILED);
pthread_mutex_lock(&g_dic_lock);
- if (!_tdm_config_check_init()) {
+ _tdm_config_check_init();
+ if (!g_dic) {
TDM_INFO("%s = %s set failed", key, value);
pthread_mutex_unlock(&g_dic_lock);
return TDM_ERROR_BAD_REQUEST;
ret = iniparser_set(g_dic, key, value);
- _tdm_config_check_logs();
-
pthread_mutex_unlock(&g_dic_lock);
TDM_RETURN_VAL_IF_FAIL(ret == 0, TDM_ERROR_OPERATION_FAILED);