Add initial source codes for gtest
[platform/core/connectivity/stc-manager.git] / src / stc-manager-util.c
index 17f9d83..b929427 100755 (executable)
@@ -40,10 +40,10 @@ static GKeyFile *__load_key_file(const char *path)
        keyfile = g_key_file_new();
 
        if (!g_key_file_load_from_file(keyfile, path, 0, &error)) {
-               STC_LOGD("Unable to load [%s] : %s", path, error->message);
-               g_clear_error(&error);
-               g_key_file_free(keyfile);
-               keyfile = NULL;
+               STC_LOGD("Unable to load [%s] : %s", path, error->message); //LCOV_EXCL_LINE
+               g_clear_error(&error); //LCOV_EXCL_LINE
+               g_key_file_free(keyfile); //LCOV_EXCL_LINE
+               keyfile = NULL; //LCOV_EXCL_LINE
        }
 
        return keyfile;
@@ -59,9 +59,9 @@ static int __save_key_file(GKeyFile *keyfile, char *path)
        data = g_key_file_to_data(keyfile, &length, NULL);
 
        if (!g_file_set_contents(path, data, length, &error)) {
-               STC_LOGD("Failed to save information : %s", error->message);
-               g_error_free(error);
-               ret = -EIO;
+               STC_LOGD("Failed to save information : %s", error->message); //LCOV_EXCL_LINE
+               g_error_free(error); //LCOV_EXCL_LINE
+               ret = -EIO; //LCOV_EXCL_LINE
        }
 
        __sync_file_to_disk(path);
@@ -70,6 +70,7 @@ static int __save_key_file(GKeyFile *keyfile, char *path)
        return ret;
 }
 
+//LCOV_EXCL_START
 gboolean stc_util_get_config_bool(char *key)
 {
        char path[MAX_PATH_LENGTH];
@@ -105,6 +106,7 @@ gchar * stc_util_get_config_str(char *key)
 
        return value;
 }
+//LCOV_EXCL_STOP
 
 int stc_util_get_config_int(char *key)
 {
@@ -116,7 +118,7 @@ int stc_util_get_config_int(char *key)
 
        keyfile = __load_key_file(path);
        if (!keyfile)
-               keyfile = g_key_file_new();
+               keyfile = g_key_file_new(); //LCOV_EXCL_LINE
 
 
        value = g_key_file_get_integer(keyfile, path, key, NULL);
@@ -125,10 +127,12 @@ int stc_util_get_config_int(char *key)
        return value;
 }
 
+//LCOV_EXCL_START
 API void stc_util_set_debuglog(int debuglog)
 {
        g_debuglog = debuglog;
 }
+//LCOV_EXCL_STOP
 
 API int stc_util_get_debuglog(void)
 {
@@ -147,7 +151,7 @@ void stc_util_initialize_config(void)
 
        keyfile = __load_key_file(path);
        if (!keyfile)
-               keyfile = g_key_file_new();
+               keyfile = g_key_file_new(); //LCOV_EXCL_LINE
 
        g_key_file_set_integer(keyfile, path, INFO_DEBUGLOG, 0);