Adjust scope of global variables 72/243872/1
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 11 Sep 2020 00:27:10 +0000 (09:27 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 11 Sep 2020 00:29:24 +0000 (09:29 +0900)
This patch adds "static" keyword to global variables.
And, the name that is "white" is changed to "allowed".

Change-Id: Ibd803143327d9cf9892475d5f9781109f53cd8b3
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/service.c

index ace56f2..6fb38f3 100755 (executable)
@@ -79,8 +79,8 @@ typedef struct _aul_svc_transient_cb_info_t {
        void *data;
 } aul_svc_transient_cb_info_t;
 
-pthread_mutex_t iniparser_lock = PTHREAD_MUTEX_INITIALIZER;
-GSList *tmp_list;
+static pthread_mutex_t iniparser_lock = PTHREAD_MUTEX_INITIALIZER;
+static GSList *tmp_list;
 
 static aul_svc_cb_info_t *__create_rescb(int request_code,
                aul_svc_res_fn cbfunc, aul_svc_err_cb err_cb, void *data);
@@ -93,43 +93,40 @@ static int __run_svc_with_pkgname(char *pkgname, bundle *b, int request_code,
 static int __get_resolve_info(bundle *b, aul_svc_resolve_info_t *info);
 static int __free_resolve_info_data(aul_svc_resolve_info_t *info);
 
-static char *white_list[] = {
-       APP_SELECTOR,
-       SHARE_PANEL,
-       NULL
-};
-
 static bool __is_special_app(const char *appid)
 {
-       const char *id;
-       int i = 0;
+       static char *allowed_apps[] = {
+               APP_SELECTOR,
+               SHARE_PANEL,
+               NULL
+       };
+       int i;
 
        if (appid == NULL)
                return false;
 
-       while ((id = white_list[i]) != NULL) {
-               if (strcmp(id, appid) == 0)
+       for (i = 0; allowed_apps[i]; ++i) {
+               if (!strcmp(allowed_apps[i], appid))
                        return true;
-               i++;
        }
        return false;
 }
 
 static bool __is_special_operation(bundle *b)
 {
-       const char *operation;
-       const char *white_operations[] = {
+       static const char *allowed_operations[] = {
                "http://tizen.org/appcontrol/operation/guide_privacy_setting",
                NULL
        };
+       const char *operation;
        int i;
 
        operation = aul_svc_get_operation(b);
        if (!operation)
                return false;
 
-       for (i = 0; white_operations[i]; ++i) {
-               if (!strcmp(operation, white_operations[i]))
+       for (i = 0; allowed_operations[i]; ++i) {
+               if (!strcmp(allowed_operations[i], operation))
                        return true;
        }