From ee796ea757fe314bf5dcd1516b72c92e000d461a Mon Sep 17 00:00:00 2001 From: hj kim Date: Mon, 13 Jan 2020 15:59:32 +0900 Subject: [PATCH] Change global variables to static Change-Id: I6a995e9e9476de4896d96fe3d2d9a5d809b74261 --- lib/media-util-db.c | 14 +++++++------- lib/media-util-noti-internal.c | 2 +- lib/media-util-register.c | 2 +- src/common/media-common-system.c | 4 ++-- src/mediadb-update.c | 11 ++++++----- src/scanner-v2/media-scanner-common-v2.c | 4 ++-- src/scanner-v2/media-scanner-extract-v2.c | 22 +++++++++++----------- src/scanner-v2/media-scanner-scan-v2.c | 29 ++++++++++++++--------------- src/scanner/media-scanner-scan.c | 4 ++-- src/server/media-server-scanner.c | 2 +- 10 files changed, 47 insertions(+), 47 deletions(-) diff --git a/lib/media-util-db.c b/lib/media-util-db.c index 568ab2d..3a1707e 100755 --- a/lib/media-util-db.c +++ b/lib/media-util-db.c @@ -41,13 +41,13 @@ #define BATCH_END "COMMIT" #define PATH_PLUGIN_LIBICU PATH_LIBDIR"/libicui18n.so" -UCollator *(*icu_ucol_open)(const char *, UErrorCode *); -void (*icu_ucol_close)(UCollator *); -void (*icu_ucol_setStrength)(UCollator *, UCollationStrength); -UCollationResult (*icu_ucol_strcollIter)(const UCollator *, UCharIterator *, UCharIterator *, UErrorCode *); -void (*icu_uiter_setUTF8)(UCharIterator *, const char *, int32_t); -void (*icu_uloc_setDefault)(const char* localeID, UErrorCode* status); -const char* (*icu_uloc_getDefault)(void); +static UCollator *(*icu_ucol_open)(const char *, UErrorCode *); +static void (*icu_ucol_close)(UCollator *); +static void (*icu_ucol_setStrength)(UCollator *, UCollationStrength); +static UCollationResult (*icu_ucol_strcollIter)(const UCollator *, UCharIterator *, UCharIterator *, UErrorCode *); +static void (*icu_uiter_setUTF8)(UCharIterator *, const char *, int32_t); +static void (*icu_uloc_setDefault)(const char* localeID, UErrorCode* status); +static const char* (*icu_uloc_getDefault)(void); static void *funcHandle = NULL; diff --git a/lib/media-util-noti-internal.c b/lib/media-util-noti-internal.c index 4683f3a..a651bff 100755 --- a/lib/media-util-noti-internal.c +++ b/lib/media-util-noti-internal.c @@ -36,7 +36,7 @@ #include "media-util.h" #include "private.h" -GArray *handle_list_internal; +static GArray *handle_list_internal; static GMutex mutex_internal; #define MS_MEDIA_DBUS_NAME_INTERNAL "ms_db_updated_internal" diff --git a/lib/media-util-register.c b/lib/media-util-register.c index cb53993..e76798f 100755 --- a/lib/media-util-register.c +++ b/lib/media-util-register.c @@ -44,7 +44,7 @@ typedef struct media_scan_data { char *req_path; } media_scan_data; -GArray *req_list; +static GArray *req_list; static int _check_dir_path(const char *dir_path, uid_t uid) { diff --git a/src/common/media-common-system.c b/src/common/media-common-system.c index 446e2b3..994f9eb 100644 --- a/src/common/media-common-system.c +++ b/src/common/media-common-system.c @@ -58,7 +58,7 @@ typedef struct block_cb_data { void *usr_data; } block_cb_data; -block_cb_data *g_stg_cb_data = NULL; +static block_cb_data *g_stg_cb_data = NULL; static void __ms_block_changed(GDBusConnection* connection, const gchar* sender_name, @@ -456,7 +456,7 @@ typedef struct pwoff_cb_data { static GDBusConnection *g_pwr_bus; static int g_pwr_handler; -pwoff_cb_data *g_pwr_cb_data = NULL; +static pwoff_cb_data *g_pwr_cb_data = NULL; static void __poweroff_signal_cb(GDBusConnection *connection, const gchar *sender_name, diff --git a/src/mediadb-update.c b/src/mediadb-update.c index c1e5111..87519a1 100755 --- a/src/mediadb-update.c +++ b/src/mediadb-update.c @@ -31,15 +31,16 @@ #define PATH_PLUGIN_LIB PATH_LIBDIR"/libmedia-content-plugin.so" -GMainLoop * mainloop = NULL; -struct timeval start_time, end_time; +static GMainLoop * mainloop = NULL; +static struct timeval start_time; -int (*svc_check_db) (sqlite3 * handle, uid_t uid); -int (*svc_get_storage_id) (sqlite3 * handle, const char *path, char *storage_id, uid_t uid); +static int (*svc_check_db) (sqlite3 * handle, uid_t uid); +static int (*svc_get_storage_id) (sqlite3 * handle, const char *path, char *storage_id, uid_t uid); -void callback(media_request_result_s * result, void *user_data) +static void callback(media_request_result_s * result, void *user_data) { long long ms_time = 0; + struct timeval end_time; if (result->result != MEDIA_REQUEST_SCAN_PARTIAL) { gettimeofday(&end_time, NULL); diff --git a/src/scanner-v2/media-scanner-common-v2.c b/src/scanner-v2/media-scanner-common-v2.c index 1961c0a..92802d1 100755 --- a/src/scanner-v2/media-scanner-common-v2.c +++ b/src/scanner-v2/media-scanner-common-v2.c @@ -24,8 +24,8 @@ #include "media-scanner-common-v2.h" bool power_off2; -bool disc_stg_scan_status; -bool disc_dir_scan_status; +static bool disc_stg_scan_status; +static bool disc_dir_scan_status; void msc_set_power_status(bool status) { diff --git a/src/scanner-v2/media-scanner-extract-v2.c b/src/scanner-v2/media-scanner-extract-v2.c index 074c44a..6a411a9 100644 --- a/src/scanner-v2/media-scanner-extract-v2.c +++ b/src/scanner-v2/media-scanner-extract-v2.c @@ -44,21 +44,21 @@ extern bool power_off2; GAsyncQueue *storage_extract_queue; GAsyncQueue *folder_extract_queue; -GMutex extract_req_mutex; -GMutex extract_blocked_mutex; -char *g_extract_cancel_path; -char *g_extract_blocked_path; +static GMutex extract_req_mutex; +static GMutex extract_blocked_mutex; +static char *g_extract_cancel_path; +static char *g_extract_blocked_path; bool g_directory_extract_processing; -int stg_extract_status; +static int stg_extract_status; -GMutex extract_item_mutex; -GMutex decode_mutex; +static GMutex extract_item_mutex; +static GMutex decode_mutex; -s_extract_item* cancel_extract_item = NULL; -s_extract_item* cur_extract_item = NULL; +static s_extract_item* cancel_extract_item = NULL; +static s_extract_item* cur_extract_item = NULL; -GCond extract_data_cond; -GMutex extract_data_mutex; +static GCond extract_data_cond; +static GMutex extract_data_mutex; #define VCONFKEY_PRIVATE_EXTRACTSTATUS "db/private/extractstatus" #define LAST_EVENT 1 #define NORMAL_EVENT 0 diff --git a/src/scanner-v2/media-scanner-scan-v2.c b/src/scanner-v2/media-scanner-scan-v2.c index fdc885c..2dd1d60 100644 --- a/src/scanner-v2/media-scanner-scan-v2.c +++ b/src/scanner-v2/media-scanner-scan-v2.c @@ -57,27 +57,26 @@ GAsyncQueue *storage_queue2; GAsyncQueue *scan_queue2; GAsyncQueue *reg_queue2; GMutex scan_req_mutex2; -GMutex blocked_mutex2; -GMutex storage_scan_mutex2; -GMutex dir_scan_mutex2; -GCond data_cond2; /* Must be initialized somewhere */ -GMutex data_mutex2; /* Must be initialized somewhere */ -gpointer current_data2 = NULL; -GMutex scan_item_mutex; +static GMutex blocked_mutex2; +static GMutex storage_scan_mutex2; +static GMutex dir_scan_mutex2; +static GCond data_cond2; /* Must be initialized somewhere */ +static GMutex data_mutex2; /* Must be initialized somewhere */ +static GMutex scan_item_mutex; -char *g_blocked_path2; +static char *g_blocked_path2; -s_scan_item* cancel_scan_item = NULL; -s_scan_item* cur_scan_item = NULL; +static s_scan_item* cancel_scan_item = NULL; +static s_scan_item* cur_scan_item = NULL; int g_directory_scan_processing2 = DIR_SCAN_NON_SCAN; -char *g_storage_scan_path; -char* g_dir_scan_path; -unsigned int io_err_folder; -unsigned int io_err_storage; +static char *g_storage_scan_path; +static char* g_dir_scan_path; +static unsigned int io_err_folder; +static unsigned int io_err_storage; typedef int (*DIR_SCAN_CB)(); -DIR_SCAN_CB g_dir_scan_cb; +static DIR_SCAN_CB g_dir_scan_cb; struct linux_dirent { ino64_t d_ino; /* 64-bit inode number */ diff --git a/src/scanner/media-scanner-scan.c b/src/scanner/media-scanner-scan.c index 2b79bf5..923e281 100644 --- a/src/scanner/media-scanner-scan.c +++ b/src/scanner/media-scanner-scan.c @@ -31,9 +31,9 @@ #include "media-scanner-scan.h" bool power_off; -GAsyncQueue * storage_queue; +static GAsyncQueue * storage_queue; GAsyncQueue *scan_queue; -GAsyncQueue *reg_queue; +static GAsyncQueue *reg_queue; GMutex scan_req_mutex; static bool __msc_is_stop_needed(void) diff --git a/src/server/media-server-scanner.c b/src/server/media-server-scanner.c index a67ea4b..a0fc314 100755 --- a/src/server/media-server-scanner.c +++ b/src/server/media-server-scanner.c @@ -52,7 +52,7 @@ static int receive_id; static bool scanner_cleaned; -int fifo_fd; +static int fifo_fd; static int __ms_get_remained_task(void) { -- 2.7.4