system_info_extenal: Make non-exported function as internal 62/301962/4 accepted/tizen_unified_riscv accepted/tizen/unified/20231211.095401 accepted/tizen/unified/riscv/20231215.050329
authorChanwoo Choi <cw00.choi@samsung.com>
Tue, 28 Nov 2023 10:10:22 +0000 (19:10 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Thu, 30 Nov 2023 08:24:12 +0000 (17:24 +0900)
Make non-exported function as internal function and then
remove 'external_' prefix to show the difference between
exported and non-exported function for improving the readability.

Change-Id: Id16cd63cff2e97c7e17bbacf3f66c80a1e36f311
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/system_info_external.c

index 5ee3f23..c92e908 100644 (file)
@@ -44,14 +44,14 @@ static int plugin_filter(const struct dirent *de)
        return 1;
 }
 
-void external_free_plugin_names(char **tab, int count)
+static void free_plugin_names(char **tab, int count)
 {
        for (int i = 0; i < count; ++i)
                free(tab[i]);
        free(tab);
 }
 
-char **external_get_plugin_names(size_t *plugin_count)
+static char **get_plugin_names(size_t *plugin_count)
 {
        char **tab = NULL;
        struct dirent **entries = NULL;
@@ -74,7 +74,7 @@ char **external_get_plugin_names(size_t *plugin_count)
        tab[0] = strdup(EXTERNAL_SYSTEM_INFO);
        if (!tab[0]) {
                _E("strdup failed for alloc plugin path " EXTERNAL_SYSTEM_INFO ", stop listing");
-               external_free_plugin_names(tab, 0);
+               free_plugin_names(tab, 0);
                tab = NULL;
                goto out_free_entries;
        }
@@ -82,7 +82,7 @@ char **external_get_plugin_names(size_t *plugin_count)
        for (int ei = 0, ti = 1; ei < count; ++ei, ++ti)
                if (asprintf(&tab[ti], EXTERNAL_PLUGINS_DIR "/%s", entries[ei]->d_name) < 0) {
                        _E("asprintf failed for alloc plugin path (" EXTERNAL_PLUGINS_DIR "/%s), stop listing", entries[ei]->d_name);
-                       external_free_plugin_names(tab, ti);
+                       free_plugin_names(tab, ti);
                        tab = NULL;
                        goto out_free_entries;
                }
@@ -98,7 +98,7 @@ out_free_entries:
        return tab;
 }
 
-void *external_open_plugin(const char *so_path, const system_info_external_plugin_interface **plugin)
+static void *open_plugin(const char *so_path, const system_info_external_plugin_interface **plugin)
 {
        if (!plugin)
                return NULL;
@@ -138,13 +138,13 @@ out_err:
        return NULL;
 }
 
-int external_get_plugin_value(const char *so_path, const char *tag, const char *key,
+static int get_plugin_value(const char *so_path, const char *tag, const char *key,
                const char *type, char **val)
 {
        int ret;
        char buf[BUF_MAX];
        const system_info_external_plugin_interface *plugin = NULL;
-       void *handle = external_open_plugin(so_path, &plugin);
+       void *handle = open_plugin(so_path, &plugin);
 
        if (!handle)
                return SYSTEM_INFO_ERROR_IO_ERROR;
@@ -183,11 +183,11 @@ int external_get_value(const char *tag, const char *key, const char *type, char
        size_t plugin_count = 0;
        int ret = SYSTEM_INFO_ERROR_IO_ERROR;
 
-       char **tab = external_get_plugin_names(&plugin_count);
+       char **tab = get_plugin_names(&plugin_count);
        for (size_t i = 0; i < plugin_count && ret != SYSTEM_INFO_ERROR_NONE; ++i)
-               ret = external_get_plugin_value(tab[i], tag, key, type, val);
+               ret = get_plugin_value(tab[i], tag, key, type, val);
 
-       external_free_plugin_names(tab, plugin_count);
+       free_plugin_names(tab, plugin_count);
 
        if (ret != SYSTEM_INFO_ERROR_NONE)
                _E("Key value (%s) not obtained by any plugin.", key);
@@ -195,13 +195,13 @@ int external_get_value(const char *tag, const char *key, const char *type, char
        return ret;
 }
 
-int external_get_plugin_type(const char *so_path, const char *tag, const char *key,
+static int get_plugin_type(const char *so_path, const char *tag, const char *key,
                const char *type, char **val)
 {
        int ret;
        char buf[BUF_MAX];
        const system_info_external_plugin_interface *plugin = NULL;
-       void *handle = external_open_plugin(so_path, &plugin);
+       void *handle = open_plugin(so_path, &plugin);
 
        if (!handle)
                return SYSTEM_INFO_ERROR_IO_ERROR;
@@ -240,11 +240,11 @@ int external_get_type(const char *tag, const char *key, char **type)
        size_t plugin_count = 0;
        int ret = SYSTEM_INFO_ERROR_IO_ERROR;
 
-       char **tab = external_get_plugin_names(&plugin_count);
+       char **tab = get_plugin_names(&plugin_count);
        for (size_t i = 0; i < plugin_count && ret != SYSTEM_INFO_ERROR_NONE; ++i)
-               ret = external_get_plugin_type(tab[i], tag, key, NULL, type);
+               ret = get_plugin_type(tab[i], tag, key, NULL, type);
 
-       external_free_plugin_names(tab, plugin_count);
+       free_plugin_names(tab, plugin_count);
 
        if (ret != SYSTEM_INFO_ERROR_NONE)
                _E("Key type (%s) not obtained by any plugin.", key);