Adjust coding rules 37/73237/1 accepted/tizen/common/20160608.160003 accepted/tizen/ivi/20160607.235934 accepted/tizen/mobile/20160608.000019 accepted/tizen/tv/20160607.235836 accepted/tizen/wearable/20160607.235945 submit/tizen/20160607.231554
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 7 Jun 2016 08:29:49 +0000 (17:29 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 7 Jun 2016 08:29:49 +0000 (17:29 +0900)
- 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 <h.jhun@samsung.com>
include/perf.h
src/common.c
src/debug-launchpad.c
src/debug_util.c
src/file_util.c
src/signal_util.c

index ec66620..aabcf5f 100755 (executable)
@@ -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); \
                } \
index 25e7aec..1f76ea4 100644 (file)
@@ -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;
index ed5d636..e38c4e7 100644 (file)
@@ -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;
index cc27f12..c71c22e 100644 (file)
@@ -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)
 {
index d7f2bea..c391409 100644 (file)
@@ -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;
 
index d761a79..f1cbc8e 100644 (file)
@@ -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)