From 4942baaada557118c1f33021321d58796c15a581 Mon Sep 17 00:00:00 2001 From: YoungHun Kim Date: Wed, 10 Jan 2018 08:32:15 +0900 Subject: [PATCH] Comply with muse coding rule Change-Id: I501f4fe87fdd86dfd9fa51ed9c1499e9b5cda9e1 (cherry picked from commit 976e7500cd5da4a7ac85897f564f1827855e76d6) --- core/include/muse_core.h | 16 +++----- core/include/muse_core_internal.h | 66 ++++++++++++++++----------------- core/src/muse_core.c | 60 ++++++++++++++---------------- packaging/mused.spec | 2 +- server/include/muse_server_config.h | 39 ++++++++++--------- server/include/muse_server_connection.h | 2 +- server/include/muse_server_log.h | 6 +-- server/include/muse_server_private.h | 6 +-- server/include/muse_server_security.h | 2 +- server/include/muse_server_system.h | 6 +-- server/include/muse_server_watchdog.h | 6 +-- server/include/muse_server_workqueue.h | 8 ++-- server/src/muse_server_config.c | 2 +- server/src/muse_server_ipc.c | 13 ++++--- server/src/muse_server_log.c | 15 ++++---- server/src/muse_server_private.c | 2 +- server/src/muse_server_security.c | 2 +- server/src/muse_server_signal.c | 12 +++--- 18 files changed, 127 insertions(+), 138 deletions(-) diff --git a/core/include/muse_core.h b/core/include/muse_core.h index 5b6a284..7757204 100644 --- a/core/include/muse_core.h +++ b/core/include/muse_core.h @@ -29,14 +29,12 @@ extern "C" { #include #include -#define MUSE_URI_MAX_LENGTH 4096 -#define MUSE_MSG_MAX_LENGTH 4096 -#define MUSE_NUM_FD 4 - -#define MUSE_SERVER_READY "/tmp/.muse_server_ready" - -#define MUSE_DATA_HEAD 0xda1a6ead +#define MUSE_URI_MAX_LENGTH 4096 +#define MUSE_MSG_MAX_LENGTH 4096 +#define MUSE_NUM_FD 4 +#define MUSE_SERVER_READY "/tmp/.muse_server_ready" +#define MUSE_DATA_HEAD 0xda1a6ead #define MUSE_PARAM_HANDLE "handle" #define MUSE_PARAM_RETURN "ret" #define MUSE_PARAM_EVENT "event" @@ -105,9 +103,7 @@ int muse_core_msg_recv(int sock_fd, char *msg); int muse_core_msg_send_fd(int sock_fd, int *fds, const char *buf); int muse_core_msg_recv_fd(int sock_fd, char *buf, int *out_fd); char *muse_core_msg_new(int api, ...); -bool muse_core_msg_deserialize( - const char *key, char *buf, int *parse_len, - muse_core_msg_parse_err_e *err, muse_core_msg_type_e m_type, void *data); +bool muse_core_msg_deserialize(const char *key, char *buf, int *parse_len, muse_core_msg_parse_err_e *err, muse_core_msg_type_e m_type, void *data); void muse_core_msg_free(char *msg); void *muse_core_msg_object_new(char *str, int *parse_len, muse_core_msg_parse_err_e *err); bool muse_core_msg_object_get_value(const char *key, void *jobj, muse_core_msg_type_e m_type, void *data); diff --git a/core/include/muse_core_internal.h b/core/include/muse_core_internal.h index 35a70e3..b9b06db 100644 --- a/core/include/muse_core_internal.h +++ b/core/include/muse_core_internal.h @@ -49,47 +49,45 @@ extern "C" { #include #undef LOG_TAG -#define LOG_TAG "MUSED" - -#define CONFFILE SYSCONFDIR"/multimedia/mused.conf" -#define MUSE_HOST "muse:hosts" -#define INI_PARSER_COMMA "," - -#define MUSE_DATA_ROOT_PATH TZ_SYS_DATA_PATH"/mused/" -#define MUSE_DEFAULT_PIDFILE "/tmp/.muse-server.pid" -#define MUSE_SOCK_FILE0 "/tmp/.muse_server_socket" -#define MUSE_SOCK_FILE1 "/tmp/.muse_server_data_socket" -#define MUSE_LOG_PATH "/var/log/mused" -#define MUSE_LOG_FILE MUSE_LOG_PATH"/muselog" -#define MUSE_USE_LOG "yes" - -#define READ 0x02 -#define PERSIST 0x10 - -#define MUSE_ERR -1 -#define MUSE_PARAM_MAX 10 - -#define PARSE_ERROR -1 +#define LOG_TAG "MUSED" +#define CONFFILE SYSCONFDIR"/multimedia/mused.conf" +#define MUSE_HOST "muse:hosts" +#define INI_PARSER_COMMA "," +#define MUSE_DATA_ROOT_PATH TZ_SYS_DATA_PATH"/mused/" +#define MUSE_DEFAULT_PIDFILE "/tmp/.muse-server.pid" +#define MUSE_SOCK_FILE0 "/tmp/.muse_server_socket" +#define MUSE_SOCK_FILE1 "/tmp/.muse_server_data_socket" +#define MUSE_LOG_PATH "/var/log/mused" +#define MUSE_LOG_FILE MUSE_LOG_PATH"/muselog" +#define MUSE_USE_LOG "yes" + +#define READ 0x02 +#define PERSIST 0x10 + +#define MUSE_ERR -1 +#define MUSE_PARAM_MAX 10 + +#define PARSE_ERROR -1 /* message */ -#define MUSE_MSG_LEN 32 -#define MUSE_MSG_LEN_MAX 256 +#define MUSE_MSG_LEN 32 +#define MUSE_MSG_LEN_MAX 256 /* module */ -#define MUSE_MODULE_TYPE_MAX 10 +#define MUSE_MODULE_TYPE_MAX 10 /* dispatcher */ -#define MUSE_DISPATCHER_MAX 256 +#define MUSE_DISPATCHER_MAX 256 -#define MSG_KEY_API "api" -#define MSG_KEY_MODULE_INDEX "module" -#define MSG_KEY_MODULE_ADDR "module_addr" +#define MSG_KEY_API "api" +#define MSG_KEY_MODULE_INDEX "module" +#define MSG_KEY_MODULE_ADDR "module_addr" -#define DISPATCHER "dispatcher" -#define DISPATCHER_PTR "dispatcher_pointer" -#define CMD_DISPATCHER "cmd_dispatcher" -#define END_DELIM '}' -#define END_DELIM_STR " }" +#define DISPATCHER "dispatcher" +#define DISPATCHER_PTR "dispatcher_pointer" +#define CMD_DISPATCHER "cmd_dispatcher" +#define END_DELIM '}' +#define END_DELIM_STR " }" #define MUSE_FREE(src) \ do { \ @@ -137,7 +135,7 @@ typedef struct muse_module { int last_cmd; gpointer user_data; intptr_t handle; - gboolean is_create_api_called; /* If false, corresponding to the static function */ + gboolean is_create_api_called; } muse_module_t; typedef struct muse_recv_data_head { diff --git a/core/src/muse_core.c b/core/src/muse_core.c index 0dc0219..9d14fa1 100644 --- a/core/src/muse_core.c +++ b/core/src/muse_core.c @@ -23,9 +23,9 @@ #include #include -#define MUSE_WATCHDOG_CHECK_PERIOD 10 -#define MUSE_WATCHDOG_CHECK_COUNT 3 -#define MUSE_WATCHDOG_TIMER_PERIOD 5 +#define MUSE_WATCHDOG_CHECK_PERIOD 10 +#define MUSE_WATCHDOG_CHECK_COUNT 3 +#define MUSE_WATCHDOG_TIMER_PERIOD 5 static GMutex msg_lock; @@ -115,8 +115,10 @@ static gboolean _muse_msg_is_mem_ptr_valid(gpointer ptr) static void _muse_msg_json_factory_args(json_object *jobj, va_list ap) { - int type; + int type, len, idx; char *name; + int *value; + json_object *jarr; while ((type = va_arg(ap, int)) != 0) { name = va_arg(ap, char *); @@ -140,16 +142,13 @@ static void _muse_msg_json_factory_args(json_object *jobj, va_list ap) json_object_object_add(jobj, name, json_object_new_string(va_arg(ap, char *))); break; case MUSE_TYPE_ARRAY: - { - int len = va_arg(ap, int); - int *value = va_arg(ap, int *); - int i; - json_object *jarr = json_object_new_array(); - - for (i = 0; i < len; i++) - json_object_array_add(jarr, json_object_new_int(value[i])); - json_object_object_add(jobj, name, jarr); - } + len = va_arg(ap, int); + value = va_arg(ap, int *); + jarr = json_object_new_array(); + + for (idx = 0; idx < len; idx++) + json_object_array_add(jarr, json_object_new_int(value[idx])); + json_object_object_add(jobj, name, jarr); break; default: LOGE("Unexpected type"); @@ -401,10 +400,10 @@ char *muse_core_msg_new(int api, ...) return sndMsg; } -bool muse_core_msg_deserialize( - const char *key, char *buf, int *parse_len, muse_core_msg_parse_err_e *err, muse_core_msg_type_e m_type, void *data) +bool muse_core_msg_deserialize(const char *key, char *buf, int *parse_len, muse_core_msg_parse_err_e *err, muse_core_msg_type_e m_type, void *data) { - int j_type; + int j_type, idx, len; + int *int_data; json_object *val, *jobj; g_return_val_if_fail(key, false); @@ -457,16 +456,14 @@ bool muse_core_msg_deserialize( case json_type_string: strncpy((char *)data, json_object_get_string(val), strlen(json_object_get_string(val))); break; - case json_type_array: { - int i, len; - int *int_data = (int *)data; + case json_type_array: + int_data = (int *)data; len = json_object_array_length(val); - for (i = 0; i < len; i++) - int_data[i] = json_object_get_int(json_object_array_get_idx(val, i)); + for (idx = 0; idx < len; idx++) + int_data[idx] = json_object_get_int(json_object_array_get_idx(val, idx)); break; - } default: - LOGW("type is not yet implemented"); + LOGE("The value (%d) of json type is invalid", j_type); break; } @@ -487,7 +484,8 @@ void *muse_core_msg_object_new(char *str, int *parse_len, muse_core_msg_parse_er bool muse_core_msg_object_get_value(const char *key, void *jobj, muse_core_msg_type_e m_type, void *data) { - int j_type; + int j_type, idx, len; + int *int_data; json_object *val; g_return_val_if_fail(key, false); @@ -538,16 +536,14 @@ bool muse_core_msg_object_get_value(const char *key, void *jobj, muse_core_msg_t case json_type_string: strncpy((char *)data, json_object_get_string(val), strlen(json_object_get_string(val))); break; - case json_type_array: { - int i, len; - int *int_data = (int *)data; + case json_type_array: + int_data = (int *)data; len = json_object_array_length(val); - for (i = 0; i < len; i++) - int_data[i] = json_object_get_int(json_object_array_get_idx(val, i)); + for (idx = 0; idx < len; idx++) + int_data[idx] = json_object_get_int(json_object_array_get_idx(val, idx)); break; - } default: - LOGW("type is not yet implemented"); + LOGE("The value (%d) of json type is invalid", j_type); break; } diff --git a/packaging/mused.spec b/packaging/mused.spec index bf502c3..9aace8e 100644 --- a/packaging/mused.spec +++ b/packaging/mused.spec @@ -1,6 +1,6 @@ Name: mused Summary: A multimedia daemon -Version: 0.3.25 +Version: 0.3.26 Release: 0 Group: System/Libraries License: Apache-2.0 diff --git a/server/include/muse_server_config.h b/server/include/muse_server_config.h index dfcdb71..cdf801c 100644 --- a/server/include/muse_server_config.h +++ b/server/include/muse_server_config.h @@ -29,27 +29,26 @@ extern "C" { #include "muse_core_internal.h" #include -#define CONFFILE SYSCONFDIR"/multimedia/mused.conf" -#define MUSE_LOG "muse:logfile" -#define MUSE_LOCK "muse:lockfile" -#define MUSE_WATCHDOG_MIN_TIMEOUT "muse:min_timeout" -#define MUSE_WATCHDOG_MAX_TIMEOUT "muse:max_timeout" -#define MUSE_MEMORY_THRESHOLD "muse:memory_threshold" -#define MUSE_GST "muse:gstparam" +#define CONFFILE SYSCONFDIR"/multimedia/mused.conf" +#define MUSE_LOG "muse:logfile" +#define MUSE_LOCK "muse:lockfile" +#define MUSE_WATCHDOG_MIN_TIMEOUT "muse:min_timeout" +#define MUSE_WATCHDOG_MAX_TIMEOUT "muse:max_timeout" +#define MUSE_MEMORY_THRESHOLD "muse:memory_threshold" +#define MUSE_GST "muse:gstparam" +#define INI_PARSER_COLON ":" +#define PATH "path" +#define PRELOADED "preloaded" +#define TIMEOUT "timeout" +#define DIABLE_WATCHDOG_API_INDEX "disable_watchdog_api" +#define MAX_INSTANCE "max_instance" -#define INI_PARSER_COLON ":" -#define PATH "path" -#define PRELOADED "preloaded" -#define TIMEOUT "timeout" -#define DIABLE_WATCHDOG_API_INDEX "disable_watchdog_api" -#define MAX_INSTANCE "max_instance" - -#define DEFAULT_WATCHDOG_MIN_TIMEOUT 5 -#define DEFAULT_WATCHDOG_MAX_TIMEOUT 60 -#define DEFAULT_DISPATCH_WATCHDOG_TIMEOUT 10 -#define DEFAULT_MEMORY_LEAK_THRESHOLD 50000 /* 50MB */ -#define DEFAULT_WATCHDOG_DISABLED_API_INDEX -1 /* Watchdog is applied to all dispatcher functions */ -#define DEFAULT_MAX_INSTANCE -1 /* Unlimited */ +#define DEFAULT_WATCHDOG_MIN_TIMEOUT 5 +#define DEFAULT_WATCHDOG_MAX_TIMEOUT 60 +#define DEFAULT_DISPATCH_WATCHDOG_TIMEOUT 10 +#define DEFAULT_MEMORY_LEAK_THRESHOLD 50000 /* 50MB */ +#define DEFAULT_WATCHDOG_DISABLED_API_INDEX -1 /* Watchdog is applied to all dispatcher functions */ +#define DEFAULT_MAX_INSTANCE -1 /* Unlimited */ typedef struct host_info { char *path; diff --git a/server/include/muse_server_connection.h b/server/include/muse_server_connection.h index ff06ae7..4364af3 100644 --- a/server/include/muse_server_connection.h +++ b/server/include/muse_server_connection.h @@ -29,7 +29,7 @@ extern "C" { #include "muse_core_internal.h" #include -#define MS_EVENT_MAX 10 +#define MS_EVENT_MAX 10 typedef enum { MUSE_CONNECTION_STATE_INVALID, diff --git a/server/include/muse_server_log.h b/server/include/muse_server_log.h index d18f139..2418ae7 100644 --- a/server/include/muse_server_log.h +++ b/server/include/muse_server_log.h @@ -28,9 +28,9 @@ extern "C" { #include "muse_core_internal.h" -#define MUSE_LOG_LEN 32 -#define MUSE_LOG_MSG_LEN 128 -#define MUSE_LOG_MSG_NUM 10 +#define MUSE_LOG_LEN 32 +#define MUSE_LOG_MSG_LEN 128 +#define MUSE_LOG_MSG_NUM 10 typedef struct ms_log { size_t size; diff --git a/server/include/muse_server_private.h b/server/include/muse_server_private.h index 08e9289..0fa5b2f 100644 --- a/server/include/muse_server_private.h +++ b/server/include/muse_server_private.h @@ -38,9 +38,9 @@ extern "C" { #endif -#define MSG_KEY_PID "pid" -#define MS_TIMEOUT_MSEC 1000 -#define MS_RECV_TRY_COUNT_MAX 3 +#define MSG_KEY_PID "pid" +#define MS_TIMEOUT_MSEC 1000 +#define MS_RECV_TRY_COUNT_MAX 3 gboolean ms_ipc_job_function(ms_workqueue_job_t *job); gboolean ms_ipc_data_job_function(ms_workqueue_job_t *job); diff --git a/server/include/muse_server_security.h b/server/include/muse_server_security.h index 25df1fa..e66d5af 100644 --- a/server/include/muse_server_security.h +++ b/server/include/muse_server_security.h @@ -28,7 +28,7 @@ extern "C" { #include "muse_core_internal.h" -#define CYNARA_CACHE_SIZE 100U +#define CYNARA_CACHE_SIZE 100U typedef struct ms_security { void *p_cynara; diff --git a/server/include/muse_server_system.h b/server/include/muse_server_system.h index b246243..d3460e9 100644 --- a/server/include/muse_server_system.h +++ b/server/include/muse_server_system.h @@ -28,9 +28,9 @@ extern "C" { #include "muse_server_private.h" -#define MS_POWER_DBUS_MSG "ChangeState" -#define MS_POWER_DBUS_PATH "/Org/Tizen/System/DeviceD/PowerOff" -#define MS_POWER_DBUS_INTERFACE "org.tizen.system.deviced.PowerOff" +#define MS_POWER_DBUS_MSG "ChangeState" +#define MS_POWER_DBUS_PATH "/Org/Tizen/System/DeviceD/PowerOff" +#define MS_POWER_DBUS_INTERFACE "org.tizen.system.deviced.PowerOff" typedef struct ms_system { GDBusConnection *connection; diff --git a/server/include/muse_server_watchdog.h b/server/include/muse_server_watchdog.h index 08ee029..52c9b3a 100644 --- a/server/include/muse_server_watchdog.h +++ b/server/include/muse_server_watchdog.h @@ -28,9 +28,9 @@ extern "C" { #include "muse_core_internal.h" -#define MS_WATCHDOG_CHECK_PERIOD 10 -#define MS_WATCHDOG_CHECK_COUNT 3 -#define MS_WATCHDOG_TIMER_PERIOD 5 +#define MS_WATCHDOG_CHECK_PERIOD 10 +#define MS_WATCHDOG_CHECK_COUNT 3 +#define MS_WATCHDOG_TIMER_PERIOD 5 typedef struct ms_watchdog { GMutex lock; diff --git a/server/include/muse_server_workqueue.h b/server/include/muse_server_workqueue.h index 1978986..59dd2b9 100644 --- a/server/include/muse_server_workqueue.h +++ b/server/include/muse_server_workqueue.h @@ -5,8 +5,8 @@ * See the accompanying LICENSE.txt for details. */ -#ifndef __MUSE_CORE_WORKQUEUE_H__ -#define __MUSE_CORE_WORKQUEUE_H__ +#ifndef __MUSE_SERVER_WORKQUEUE_H__ +#define __MUSE_SERVER_WORKQUEUE_H__ #ifdef __cplusplus extern "C" { @@ -14,7 +14,7 @@ extern "C" { #include "muse_core_internal.h" -#define MUSE_WORK_THREAD_NUM 1 +#define MUSE_WORK_THREAD_NUM 1 typedef struct ms_workqueue_job { gboolean(*job_function) (struct ms_workqueue_job * job); @@ -45,4 +45,4 @@ void ms_workqueue_add_job(ms_workqueue_t *workqueue, ms_workqueue_job_t *job); #ifdef __cplusplus } #endif -#endif /* __MUSE_CORE_WORKQUEUE_H__ */ +#endif /* __MUSE_SERVER_WORKQUEUE_H__ */ diff --git a/server/src/muse_server_config.c b/server/src/muse_server_config.c index e0c4857..8ddd983 100644 --- a/server/src/muse_server_config.c +++ b/server/src/muse_server_config.c @@ -108,7 +108,7 @@ static int _ms_config_parser(ms_config_t *conf) g_strstrip(host); conf->host[host_idx] = strdup(host); LOGD("host: %s", conf->host[host_idx]); - key = (char *) malloc(MUSE_MSG_LEN_MAX); + key = (char *)malloc(MUSE_MSG_LEN_MAX); if (!key) { LOGE("Error - null key"); goto out; diff --git a/server/src/muse_server_ipc.c b/server/src/muse_server_ipc.c index 8a31188..6618479 100644 --- a/server/src/muse_server_ipc.c +++ b/server/src/muse_server_ipc.c @@ -21,11 +21,11 @@ #include "muse_server_private.h" -#define MSG_THREAD_NAME "msg" -#define DATA_THREAD_NAME "data" +#define MSG_THREAD_NAME "msg" +#define DATA_THREAD_NAME "data" -#define DATA_WORKER_QDATA_MAX_SIZE (3840 * 2160 * 4) /* UHD BGRA8888 */ -#define UNLIMITED_INSTANCE -1 +#define DATA_WORKER_QDATA_MAX_SIZE (3840 * 2160 * 4) /* UHD BGRA8888 */ +#define UNLIMITED_INSTANCE -1 static GMutex dispatch_lock; @@ -50,6 +50,7 @@ static void _ms_ipc_module_cleanup(muse_module_h m, void *jobj) g_thread_join(m->ch[MUSE_CHANNEL_DATA].data_thread); m->ch[MUSE_CHANNEL_DATA].data_thread = NULL; } + g_mutex_clear(&m->ch[MUSE_CHANNEL_DATA].data_mutex); g_cond_clear(&m->ch[MUSE_CHANNEL_DATA].data_cond); LOGD("worker exit"); @@ -337,7 +338,7 @@ int ms_ipc_get_module_idx_from_job(ms_workqueue_job_t *job) g_return_val_if_fail(job, MM_ERROR_INVALID_ARGUMENT); - m = (muse_module_h) job->user_data; + m = (muse_module_h)job->user_data; g_return_val_if_fail(m, MM_ERROR_INVALID_ARGUMENT); LOGD("Leave"); @@ -352,7 +353,7 @@ gboolean ms_ipc_job_function(ms_workqueue_job_t *job) LOGD("Enter"); g_return_val_if_fail(job, FALSE); - m = (muse_module_h) job->user_data; + m = (muse_module_h)job->user_data; g_return_val_if_fail(m, FALSE); SECURE_LOGD("[%p] module's msg channel fd : %d", m, m->ch[MUSE_CHANNEL_MSG].sock_fd); diff --git a/server/src/muse_server_log.c b/server/src/muse_server_log.c index 64bb5e1..59e5157 100644 --- a/server/src/muse_server_log.c +++ b/server/src/muse_server_log.c @@ -22,12 +22,12 @@ #include "muse_server_private.h" #include -#define U32BITS 0xffffffff -#define MAX_FILE_NUM 3 -#define MAX_SIZE 33554432 -#define WRITE_FAIL -1 -#define BUILD_ID "BUILD_ID" -#define delimiter "=" +#define U32BITS 0xffffffff +#define MAX_FILE_NUM 3 +#define MAX_SIZE 33554432 +#define WRITE_FAIL -1 +#define BUILD_ID "BUILD_ID" +#define delimiter "=" static gboolean _ms_log_pid_is_valid(pid_t pid); static void _ms_log_latest_msgs(ms_log_t *log); @@ -281,8 +281,7 @@ static void _ms_log_cache_latest_msg(ms_log_t *log, int pid, char *msg) g_mutex_lock(&log->lock); ms_get_cur_time(time_buf); - snprintf(log->latest_msgs[log->cur_idx], MUSE_LOG_MSG_LEN, - "[P%5d] %s %s", pid, time_buf, msg); + snprintf(log->latest_msgs[log->cur_idx], MUSE_LOG_MSG_LEN, "[P%5d] %s %s", pid, time_buf, msg); log->cur_idx = (log->cur_idx + 1) % MUSE_LOG_MSG_NUM; diff --git a/server/src/muse_server_private.c b/server/src/muse_server_private.c index 1f5cef7..63959fe 100644 --- a/server/src/muse_server_private.c +++ b/server/src/muse_server_private.c @@ -30,7 +30,7 @@ #ifdef MUSE_USE_LWIPC #include -#define MUSE_LWIPC_WAIT_TIME 1000 +#define MUSE_LWIPC_WAIT_TIME 1000 #endif static gboolean (*job_functions[MUSE_CHANNEL_MAX]) diff --git a/server/src/muse_server_security.c b/server/src/muse_server_security.c index 2134e3c..e05e6ad 100644 --- a/server/src/muse_server_security.c +++ b/server/src/muse_server_security.c @@ -30,7 +30,7 @@ static void _ms_security_cynara_free(ms_security_t *security); static void _ms_security_cynara_log_error(const char *function, int error_code) { - char buf[BUFSIZ] = {0}; + char buf[BUFSIZ] = {'\0',}; cynara_strerror(error_code, buf, sizeof(buf)); LOGE("[CYNARA] %s function failed with error %d : %s", function, error_code, buf); } diff --git a/server/src/muse_server_signal.c b/server/src/muse_server_signal.c index aa928ba..a834544 100644 --- a/server/src/muse_server_signal.c +++ b/server/src/muse_server_signal.c @@ -84,7 +84,7 @@ static void _ms_signal_backtrace(void *arg) { void *trace[MUSE_MSG_LEN]; int tracesize; - int i; + int idx; char **strings = NULL; ucontext_t *uctxt = NULL; Dl_info info; @@ -119,16 +119,16 @@ static void _ms_signal_backtrace(void *arg) LOGE("backtrace_symbols error: %s", err_msg); } else { /* skip the first stack frame because it just points here. */ - for (i = 1; i < tracesize; i++) { - sym_addr = g_strstr_len(strings[i], strlen(strings[i]), "[0x"); + for (idx = 1; idx < tracesize; idx++) { + sym_addr = g_strstr_len(strings[idx], strlen(strings[idx]), "[0x"); memset(&info, 0, sizeof(info)); if (sym_addr && dladdr((const void *)strtoul(sym_addr + 1, NULL, 16), &info) && info.dli_sname) - LOGE("[%u] %s %s", i - 1, strings[i], info.dli_sname); + LOGE("[%u] %s %s", idx - 1, strings[idx], info.dli_sname); else - LOGE("[%u] %s", i - 1, strings[i]); + LOGE("[%u] %s", idx - 1, strings[idx]); if (ms_is_log_enabled()) { - snprintf(client_buf, sizeof(client_buf), "[%u] %s", i - 1, strings[i]); + snprintf(client_buf, sizeof(client_buf), "[%u] %s", idx - 1, strings[idx]); ms_log_write(client_buf); } } -- 2.7.4