From: Hwankyu Jhun Date: Tue, 7 Jun 2016 08:29:49 +0000 (+0900) Subject: Adjust coding rules X-Git-Tag: accepted/tizen/common/20160608.160003^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bdf76d0705550617e09996cf84ec832a99a9bb7c;p=platform%2Fcore%2Fappfw%2Fdebug-launchpad.git Adjust coding rules - Remove unnecessary initializations - Remove using assignment in if condition - Remove void function return statements - Remove else condition after a return Change-Id: I910f9f4b7113b2e20cf58de89f0085d39984a2ba Signed-off-by: Hwankyu Jhun --- diff --git a/include/perf.h b/include/perf.h index ec66620..aabcf5f 100755 --- a/include/perf.h +++ b/include/perf.h @@ -30,11 +30,15 @@ static struct timeval __g_base_time = { do { \ const char *tmp; \ struct timeval tv; \ + int ret; \ tmp = bundle_get_val(kb, AUL_K_STARTTIME); \ - if (tmp != NULL) \ - sscanf(tmp, "%ld/%ld", &tv.tv_sec, &tv.tv_usec); \ - else \ + if (tmp != NULL) { \ + ret = sscanf(tmp, "%ld/%ld", &tv.tv_sec, &tv.tv_usec); \ + if (ret != 2) \ + printf("Failed to convert format\n"); \ + } else { \ gettimeofday(&tv, NULL); \ + } \ __g_base_time.tv_sec = tv.tv_sec; \ __g_base_time.tv_usec = tv.tv_usec; \ } while (0) @@ -48,7 +52,7 @@ static struct timeval __g_base_time = { timersub(&cur, &__g_base_time, &res); \ printf("%c[1;31m[%s,%d] %ld sec %ld msec " \ fmt" %c[0m\n", \ - 27, __FUNCTION__, __LINE__, \ + 27, __func__, __LINE__, \ res.tv_sec, res.tv_usec/1000, \ ##arg, 27); \ } \ diff --git a/src/common.c b/src/common.c index 25e7aec..1f76ea4 100644 --- a/src/common.c +++ b/src/common.c @@ -156,8 +156,9 @@ app_pkt_t *_recv_pkt_raw(int fd, int *clifd, struct ucred *cr) sun_size = sizeof(struct sockaddr_un); - if ((*clifd = accept(fd, (struct sockaddr *)&aul_addr, - (socklen_t *)&sun_size)) == -1) { + *clifd = accept(fd, (struct sockaddr *)&aul_addr, + (socklen_t *)&sun_size); + if (*clifd == -1) { if (errno != EINTR) _E("accept error"); return NULL; @@ -747,10 +748,9 @@ static int __read_proc(const char *path, char *buf, int size) if (ret <= 0) { close(fd); return -1; - } else { - buf[ret] = 0; } + buf[ret] = 0; close(fd); return ret; diff --git a/src/debug-launchpad.c b/src/debug-launchpad.c index ed5d636..e38c4e7 100644 --- a/src/debug-launchpad.c +++ b/src/debug-launchpad.c @@ -88,8 +88,6 @@ static void __send_result_to_caller(int clifd, int ret) if (kill(ret, SIGKILL) == -1) _E("Failed to send SIGKILL: %d", errno); } - - return; } static int __prepare_exec(const char *appid, const char *app_path, @@ -106,7 +104,8 @@ static int __prepare_exec(const char *appid, const char *app_path, /* SET PRIVILEGES */ _D("appid: %s / pkg_type: %s / app_path: %s", appid, appinfo->pkg_type, app_path); - if ((ret = _set_access(appid)) != 0) { + ret = _set_access(appid); + if (ret != 0) { _E("Failed to set privileges " "- check your package's credential: %d", ret); return -1; diff --git a/src/debug_util.c b/src/debug_util.c index cc27f12..c71c22e 100644 --- a/src/debug_util.c +++ b/src/debug_util.c @@ -36,8 +36,8 @@ static int gdbserver_pid = -1; static int gdbserver_app_pid = -1; -static bool gdbserver = false; -static int valgrind_option = 0; +static bool gdbserver; +static int valgrind_option; bool _gdbserver_is_running(void) { diff --git a/src/file_util.c b/src/file_util.c index d7f2bea..c391409 100644 --- a/src/file_util.c +++ b/src/file_util.c @@ -29,6 +29,7 @@ static int recurse(const char *path, mode_t mode, { struct stat st; char dir[PATH_MAX]; + int n; if (path == NULL) return -1; @@ -37,7 +38,7 @@ static int recurse(const char *path, mode_t mode, return -1; if (strrchr(path, '/') != NULL) { - int n = strlen(path)-strlen(strrchr(path, '/')); + n = strlen(path) - strlen(strrchr(path, '/')); if (n >= PATH_MAX) return -1; diff --git a/src/signal_util.c b/src/signal_util.c index d761a79..f1cbc8e 100644 --- a/src/signal_util.c +++ b/src/signal_util.c @@ -35,7 +35,7 @@ #define AUL_DBUS_APPDEAD_SIGNAL "app_dead" #define AUL_DBUS_APPLAUNCH_SIGNAL "app_launch" -static GDBusConnection *bus = NULL; +static GDBusConnection *bus; static sigset_t oldmask; static void __socket_garbage_collector(void)