Update Coding conention.
authorSung-jae Park <nicesj.park@samsung.com>
Tue, 13 Aug 2013 01:11:45 +0000 (10:11 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Tue, 13 Aug 2013 01:15:04 +0000 (10:15 +0900)
Care the exceptional cases more.

Change-Id: I945fd74a6581b030f2046c4c401ff9bd334f45d2

12 files changed:
icon_src/main.c
icon_src/script_handler.c
packaging/org.tizen.data-provider-slave.spec
src/client.c
src/conf.c
src/critical_log.c
src/fault.c
src/lb.c
src/main.c
src/so_handler.c
src/update_monitor.c
src/util.c

index 648e14b..6597d94 100644 (file)
@@ -205,8 +205,9 @@ static inline int convert_shortcut_type_to_lb_type(int shortcut_type, char **str
 {
        char *_str;
 
-       if (!str)
+       if (!str) {
                str = &_str;
+       }
 
        switch (shortcut_type) {
        case LIVEBOX_TYPE_1x1:
@@ -267,8 +268,9 @@ static struct packet *icon_create(pid_t pid, int handle, const struct packet *pa
        char _group[16];
        char *size_str;
 
-       if (s_info.ttl_timer)
+       if (s_info.ttl_timer) {
                ecore_timer_reset(s_info.ttl_timer);
+       }
 
        ret = packet_get(packet, "sssis", &edje_path, &group, &desc_file, &size_type, &output);
        if (ret != 5) {
@@ -334,8 +336,9 @@ static struct packet *icon_create(pid_t pid, int handle, const struct packet *pa
        evas_object_resize(edje, w, h);
        evas_object_show(edje);
 
-       if (script_handler_parse_desc(edje, desc_file) != LB_STATUS_SUCCESS)
+       if (script_handler_parse_desc(edje, desc_file) != LB_STATUS_SUCCESS) {
                ErrPrint("Unable to parse the %s\n", desc_file);
+       }
 
        flush_to_file(e, output, w, h);
        evas_object_del(edje);
@@ -345,8 +348,9 @@ static struct packet *icon_create(pid_t pid, int handle, const struct packet *pa
 out:
        if (ret < 0) {
                /* Desc file should be deleted if it fails to create an icon image */
-               if (unlink(desc_file) < 0)
+               if (unlink(desc_file) < 0) {
                        ErrPrint("unlink(%s): %s\n", desc_file, strerror(errno));
+               }
        }
 
        return packet_create_reply(packet, "i", ret);
@@ -490,8 +494,9 @@ static bool app_create(void *data)
         * Send a request to reigister as a service.
         */
        s_info.ttl_timer = ecore_timer_add(TTL, life_timer_cb, NULL);
-       if (!s_info.ttl_timer)
+       if (!s_info.ttl_timer) {
                ErrPrint("Unable to register a life timer\n");
+       }
 
        ret = vconf_notify_key_changed("db/setting/accessibility/font_name", font_changed_cb, NULL);
        DbgPrint("System font is changed: %d\n", ret);
index 8aad8f5..6c97ae9 100644 (file)
@@ -1000,7 +1000,9 @@ HAPI int script_handler_parse_desc(Evas_Object *edje, const char *descfile)
        info = malloc(sizeof(*info));
        if (!info) {
                ErrPrint("Heap: %s\n", strerror(errno));
-               fclose(fp);
+               if (fclose(fp) != 0) {
+                       ErrPrint("fclose: %s\n", strerror(errno));
+               }
                return LB_STATUS_ERROR_MEMORY;
        }
        info->id = NULL;
@@ -1028,7 +1030,9 @@ HAPI int script_handler_parse_desc(Evas_Object *edje, const char *descfile)
 
                        if (!isspace(ch) && ch != EOF) {
                                ErrPrint("%d: Syntax error: Desc is not started with '{' or space - (%c = 0x%x)\n", lineno, ch, ch);
-                               fclose(fp);
+                               if (fclose(fp) != 0) {
+                                       ErrPrint("fclose: %s\n", strerror(errno));
+                               }
                                return LB_STATUS_ERROR_INVALID;
                        }
                        break;
@@ -1045,7 +1049,9 @@ HAPI int script_handler_parse_desc(Evas_Object *edje, const char *descfile)
                        block = calloc(1, sizeof(*block));
                        if (!block) {
                                ErrPrint("Heap: %s\n", strerror(errno));
-                               fclose(fp);
+                               if (fclose(fp) != 0) {
+                                       ErrPrint("fclose: %s\n", strerror(errno));
+                               }
                                return LB_STATUS_ERROR_MEMORY;
                        }
 
@@ -1354,14 +1360,19 @@ HAPI int script_handler_parse_desc(Evas_Object *edje, const char *descfile)
                goto errout;
        }
 
-       fclose(fp);
+       if (fclose(fp) != 0) {
+               ErrPrint("fclose: %s\n", strerror(errno));
+       }
        return LB_STATUS_SUCCESS;
 
 errout:
        ErrPrint("Parse error at %d file %s\n", lineno, util_basename(descfile));
-       if (block)
+       if (block) {
                delete_block(block);
-       fclose(fp);
+       }
+       if (fclose(fp) != 0) {
+               ErrPrint("fclose: %s\n", strerror(errno));
+       }
        return LB_STATUS_ERROR_INVALID;
 }
 
index 4f069fc..e09fd99 100644 (file)
@@ -2,7 +2,7 @@
 
 Name: org.tizen.data-provider-slave
 Summary: Plugin type livebox service provider.
-Version: 0.12.7
+Version: 0.12.9
 Release: 1
 Group: HomeTF/Livebox
 License: Flora License
index d77236b..0348f64 100644 (file)
@@ -271,8 +271,9 @@ static int method_update_content(struct event_arg *arg, void *data)
 static int method_pause(struct event_arg *arg, void *data)
 {
        lb_pause_all();
-       if (s_info.ping_timer)
+       if (s_info.ping_timer) {
                ecore_timer_freeze(s_info.ping_timer);
+       }
 
        sqlite3_release_memory(SQLITE_FLUSH_MAX);
        malloc_trim(0);
@@ -282,8 +283,9 @@ static int method_pause(struct event_arg *arg, void *data)
 static int method_resume(struct event_arg *arg, void *data)
 {
        lb_resume_all();
-       if (s_info.ping_timer)
+       if (s_info.ping_timer) {
                ecore_timer_thaw(s_info.ping_timer);
+       }
        return LB_STATUS_SUCCESS;
 }
 
@@ -310,8 +312,9 @@ static int method_connected(struct event_arg *arg, void *data)
        ret = provider_send_hello();
        if (ret == 0) {
                s_info.ping_timer = ecore_timer_add(DEFAULT_PING_TIME, send_ping_cb, NULL);
-               if (!s_info.ping_timer)
+               if (!s_info.ping_timer) {
                        ErrPrint("Failed to add a ping timer\n");
+               }
        }
 
        return LB_STATUS_SUCCESS;
index 3463e4d..5948ab7 100644 (file)
@@ -112,8 +112,9 @@ static void use_sw_backend_handler(char *buffer)
 static void provider_method_handler(char *buffer)
 {
        g_conf.provider_method = strdup(buffer);
-       if (!g_conf.provider_method)
+       if (!g_conf.provider_method) {
                ErrPrint("Heap: %s\n", strerror(errno));
+       }
 }
 
 static void debug_mode_handler(char *buffer)
@@ -133,191 +134,219 @@ static void com_core_thread_handler(char *buffer)
 
 static void base_width_handler(char *buffer)
 {
-       if (sscanf(buffer, "%d", &g_conf.base_width) != 1)
+       if (sscanf(buffer, "%d", &g_conf.base_width) != 1) {
                ErrPrint("Failed to parse the base_width\n");
+       }
 }
 
 static void base_height_handler(char *buffer)
 {
-       if (sscanf(buffer, "%d", &g_conf.base_height) != 1)
+       if (sscanf(buffer, "%d", &g_conf.base_height) != 1) {
                ErrPrint("Failed to parse the base_height\n");
+       }
 }
 
 static void minimum_period_handler(char *buffer)
 {
-       if (sscanf(buffer, "%lf", &g_conf.minimum_period) != 1)
+       if (sscanf(buffer, "%lf", &g_conf.minimum_period) != 1) {
                ErrPrint("Failed to parse the minimum_period\n");
+       }
        DbgPrint("Minimum period: %lf\n", g_conf.minimum_period);
 }
 
 static void script_handler(char *buffer)
 {
        g_conf.default_conf.script = strdup(buffer);
-       if (!g_conf.default_conf.script)
+       if (!g_conf.default_conf.script) {
                ErrPrint("Heap: %s\n", strerror(errno));
+       }
 }
 
 static void default_abi_handler(char *buffer)
 {
        g_conf.default_conf.abi = strdup(buffer);
-       if (!g_conf.default_conf.abi)
+       if (!g_conf.default_conf.abi) {
                ErrPrint("Heap: %s\n", strerror(errno));
+       }
 }
 
 static void default_group_handler(char *buffer)
 {
        g_conf.default_conf.pd_group = strdup(buffer);
-       if (!g_conf.default_conf.pd_group)
+       if (!g_conf.default_conf.pd_group) {
                ErrPrint("Heap: %s\n", strerror(errno));
+       }
 }
 
 static void default_period_handler(char *buffer)
 {
-       if (sscanf(buffer, "%lf", &g_conf.default_conf.period) != 1)
+       if (sscanf(buffer, "%lf", &g_conf.default_conf.period) != 1) {
                ErrPrint("Failed to parse the default_period\n");
+       }
        DbgPrint("Default Period: %lf\n", g_conf.default_conf.period);
 }
 
 static void default_packet_time_handler(char *buffer)
 {
-       if (sscanf(buffer, "%lf", &g_conf.default_packet_time) != 1)
+       if (sscanf(buffer, "%lf", &g_conf.default_packet_time) != 1) {
                ErrPrint("Failed to parse the default_packet_time\n");
+       }
        DbgPrint("Default packet time: %lf\n", g_conf.default_packet_time);
 }
 
 static void default_content_handler(char *buffer)
 {
        g_conf.default_content = strdup(buffer);
-       if (!g_conf.default_content)
+       if (!g_conf.default_content) {
                ErrPrint("Heap: %s\n", strerror(errno));
+       }
 }
 
 static void default_title_handler(char *buffer)
 {
        g_conf.default_title = strdup(buffer);
-       if (!g_conf.default_title)
+       if (!g_conf.default_title) {
                ErrPrint("Heap: %s\n", strerror(errno));
+       }
 }
 
 static void minimum_space_handler(char *buffer)
 {
-       if (sscanf(buffer, "%lu", &g_conf.minimum_space) != 1)
+       if (sscanf(buffer, "%lu", &g_conf.minimum_space) != 1) {
                ErrPrint("Failed to parse the minimum_space\n");
+       }
 }
 
 static void replace_tag_handler(char *buffer)
 {
        g_conf.replace_tag = strdup(buffer);
-       if (!g_conf.replace_tag)
+       if (!g_conf.replace_tag) {
                ErrPrint("Heap: %s\n", strerror(errno));
+       }
 }
 
 static void slave_ttl_handler(char *buffer)
 {
-       if (sscanf(buffer, "%lf", &g_conf.slave_ttl) != 1)
+       if (sscanf(buffer, "%lf", &g_conf.slave_ttl) != 1) {
                ErrPrint("Failed to parse the slave_ttl\n");
+       }
        DbgPrint("Slave TTL: %lf\n", g_conf.slave_ttl);
 }
 
 static void slave_activate_time_handler(char *buffer)
 {
-       if (sscanf(buffer, "%lf", &g_conf.slave_activate_time) != 1)
+       if (sscanf(buffer, "%lf", &g_conf.slave_activate_time) != 1) {
                ErrPrint("Failed to parse the slave_activate_time\n");
+       }
        DbgPrint("Slave activate time: %lf\n", g_conf.slave_activate_time);
 }
 
 static void slave_relaunch_time_handler(char *buffer)
 {
-       if (sscanf(buffer, "%lf", &g_conf.slave_relaunch_time) != 1)
+       if (sscanf(buffer, "%lf", &g_conf.slave_relaunch_time) != 1) {
                ErrPrint("Failed to parse the slave_relaunch_time\n");
+       }
        DbgPrint("Slave relaunch time: %lf\n", g_conf.slave_relaunch_time);
 }
 
 static void slave_relaunch_count_handler(char *buffer)
 {
-       if (sscanf(buffer, "%d", &g_conf.slave_relaunch_count) != 1)
+       if (sscanf(buffer, "%d", &g_conf.slave_relaunch_count) != 1) {
                ErrPrint("Failed to parse the relaunch count\n");
+       }
 }
 
 static void max_log_line_handler(char *buffer)
 {
-       if (sscanf(buffer, "%d", &g_conf.max_log_line) != 1)
+       if (sscanf(buffer, "%d", &g_conf.max_log_line) != 1) {
                ErrPrint("Failed to parse the max_log_line\n");
+       }
 }
 
 static void max_log_file_handler(char *buffer)
 {
-       if (sscanf(buffer, "%d", &g_conf.max_log_file) != 1)
+       if (sscanf(buffer, "%d", &g_conf.max_log_file) != 1) {
                ErrPrint("Failed to parse the max_log_file\n");
+       }
 }
 
 static void sqlite_flush_max_handler(char *buffer)
 {
-       if (sscanf(buffer, "%lu", &g_conf.sqlite_flush_max) != 1)
+       if (sscanf(buffer, "%lu", &g_conf.sqlite_flush_max) != 1) {
                ErrPrint("Failed to parse the sqlite_flush_max\n");
+       }
 }
 
 static void db_path_handler(char *buffer)
 {
        g_conf.path.db = strdup(buffer);
-       if (!g_conf.path.db)
+       if (!g_conf.path.db) {
                ErrPrint("Heap: %s\n", strerror(errno));
+       }
 }
 
 static void reader_path_handler(char *buffer)
 {
        g_conf.path.reader = strdup(buffer);
-       if (!g_conf.path.reader)
+       if (!g_conf.path.reader) {
                ErrPrint("Heap: %s\n", strerror(errno));
+       }
 }
 
 static void always_path_handler(char *buffer)
 {
        g_conf.path.always = strdup(buffer);
-       if (!g_conf.path.always)
+       if (!g_conf.path.always) {
                ErrPrint("Heap: %s\n", strerror(errno));
+       }
 }
 
 static void log_path_handler(char *buffer)
 {
        g_conf.path.slave_log = strdup(buffer);
-       if (!g_conf.path.slave_log)
+       if (!g_conf.path.slave_log) {
                ErrPrint("Heap: %s\n", strerror(errno));
+       }
 }
 
 static void script_port_path_handler(char *buffer)
 {
        g_conf.path.script_port = strdup(buffer);
-       if (!g_conf.path.script_port)
+       if (!g_conf.path.script_port) {
                ErrPrint("Heap: %s\n", strerror(errno));
+       }
 }
 
 static void share_path_handler(char *buffer)
 {
        g_conf.path.image = strdup(buffer);
-       if (!g_conf.path.image)
+       if (!g_conf.path.image) {
                ErrPrint("Heap: %s\n", strerror(errno));
+       }
 }
 
 static void input_path_handler(char *buffer)
 {
        g_conf.path.input = strdup(buffer);
-       if (!g_conf.path.input)
+       if (!g_conf.path.input) {
                ErrPrint("Heap: %s\n", strerror(errno));
+       }
 }
 
 static void ping_time_handler(char *buffer)
 {
-       if (sscanf(buffer, "%lf", &g_conf.ping_time) != 1)
+       if (sscanf(buffer, "%lf", &g_conf.ping_time) != 1) {
                ErrPrint("Failed to parse the ping_time\n");
+       }
        g_conf.ping_time /= 2.0f; /*!< Half */
        DbgPrint("Default ping time: %lf\n", g_conf.ping_time);
 }
 
 static void slave_max_loader(char *buffer)
 {
-       if (sscanf(buffer, "%d", &g_conf.slave_max_load) != 1)
+       if (sscanf(buffer, "%d", &g_conf.slave_max_load) != 1) {
                ErrPrint("Failed to parse the slave_max_load\n");
+       }
 }
 
 HAPI int conf_loader(void)
@@ -532,14 +561,17 @@ HAPI int conf_loader(void)
                                /* Ignore empty space */
                        } else {
                                state = TOKEN;
-                               ungetc(c, fp);
+                               if (ungetc(c, fp) != c) {
+                                       ErrPrint("ungetc: %s\n", strerror(errno));
+                               }
                        }
                        break;
                case SPACE:
-                       if (c == '=')
+                       if (c == '=') {
                                state = VALUE;
-                       else if (!isspace(c))
+                       } else if (!isspace(c)) {
                                state = ERROR;
+                       }
                        break;
                case VALUE:
                        if (c == '"') {
@@ -548,8 +580,9 @@ HAPI int conf_loader(void)
                                        state = END;
                                } else if (buffer_idx != 0) {
                                        buffer[buffer_idx++] = c;
-                                       if (buffer_idx >= sizeof(buffer))
+                                       if (buffer_idx >= sizeof(buffer)) {
                                                state = ERROR;
+                                       }
                                } else {
                                        quote = 1;
                                }
@@ -558,33 +591,40 @@ HAPI int conf_loader(void)
                                        /* Ignore */
                                } else if (quote == 1) {
                                        buffer[buffer_idx++] = c;
-                                       if (buffer_idx >= sizeof(buffer))
+                                       if (buffer_idx >= sizeof(buffer)) {
                                                state = ERROR;
+                                       }
                                } else {
                                        buffer[buffer_idx] = '\0';
-                                       ungetc(c, fp);
+                                       if (ungetc(c, fp) != c) {
+                                               ErrPrint("ungetc: %s\n", strerror(errno));
+                                       }
                                        state = END;
                                }
                        } else {
                                buffer[buffer_idx++] = c;
-                               if (buffer_idx >= sizeof(buffer))
+                               if (buffer_idx >= sizeof(buffer)) {
                                        state = ERROR;
+                               }
                        }
                        break;
                case TOKEN:
                        if (c == '=') {
-                               if (token_idx < 0)
+                               if (token_idx < 0) {
                                        state = ERROR;
-                               else
+                               } else {
                                        state = VALUE;
+                               }
                        } else if (isspace(c)) {
-                               if (token_idx < 0)
+                               if (token_idx < 0) {
                                        break;
+                               }
 
-                               if (token_handler[token_idx].name[ch_idx] != '\0')
+                               if (token_handler[token_idx].name[ch_idx] != '\0') {
                                        state = ERROR;
-                               else
+                               } else {
                                        state = SPACE;
+                               }
                        } else  {
                                if (token_idx < 0) {
                                        /* Now start to find a token! */
@@ -594,16 +634,22 @@ HAPI int conf_loader(void)
                                if (token_handler[token_idx].name[ch_idx] == c) {
                                        ch_idx++;
                                } else {
-                                       ungetc(c, fp);
-                                       while (ch_idx-- > 0)
-                                               ungetc(token_handler[token_idx].name[ch_idx], fp);
+                                       if (ungetc(c, fp) != c) {
+                                               ErrPrint("ungetc: %s\n", strerror(errno));
+                                       }
+                                       while (ch_idx-- > 0) {
+                                               if (ungetc(token_handler[token_idx].name[ch_idx], fp) != token_handler[token_idx].name[ch_idx]) {
+                                                       ErrPrint("ungetc: %s\n", strerror(errno));
+                                               }
+                                       }
 
                                        token_idx++;
 
-                                       if (token_handler[token_idx].name == NULL)
+                                       if (token_handler[token_idx].name == NULL) {
                                                state = ERROR;
-                                       else
+                                       } else {
                                                ch_idx = 0;
+                                       }
                                }
                        }
                        break;
@@ -646,7 +692,9 @@ HAPI int conf_loader(void)
                linelen++;
         } while (c != EOF);
 
-       fclose(fp);
+       if (fclose(fp) != 0) {
+               ErrPrint("fclose: %s\n", strerror(errno));
+       }
        return LB_STATUS_SUCCESS;
 }
 
index 2e59b61..cf5a94e 100644 (file)
@@ -52,8 +52,9 @@ static inline void rotate_log(void)
        char *filename;
        int namelen;
 
-       if (s_info.nr_of_lines < MAX_LOG_LINE)
+       if (s_info.nr_of_lines < MAX_LOG_LINE) {
                return;
+       }
 
        s_info.file_id = (s_info.file_id + 1) % MAX_LOG_FILE;
 
@@ -62,12 +63,16 @@ static inline void rotate_log(void)
        if (filename) {
                snprintf(filename, namelen, "%s/%d_%s.%d", SLAVE_LOG_PATH, s_info.file_id, s_info.filename, getpid());
 
-               if (s_info.fp)
-                       fclose(s_info.fp);
+               if (s_info.fp) {
+                       if (fclose(s_info.fp) != 0) {
+                               ErrPrint("fclose: %s\n", strerror(errno));
+                       }
+               }
 
                s_info.fp = fopen(filename, "w+");
-               if (!s_info.fp)
+               if (!s_info.fp) {
                        ErrPrint("Failed to open a file: %s\n", filename);
+               }
 
                DbgFree(filename);
        }
@@ -82,8 +87,9 @@ HAPI int critical_log(const char *func, int line, const char *fmt, ...)
        va_list ap;
        int ret;
 
-       if (!s_info.fp)
+       if (!s_info.fp) {
                return LB_STATUS_ERROR_IO;
+       }
 
        fprintf(s_info.fp, "%lf [%s:%d] ", util_timestamp(), util_basename((char *)func), line);
 
@@ -91,7 +97,9 @@ HAPI int critical_log(const char *func, int line, const char *fmt, ...)
        ret = vfprintf(s_info.fp, fmt, ap);
        va_end(ap);
 
-       fflush(s_info.fp);
+       if (fflush(s_info.fp) != 0) {
+               ErrPrint("fflush: %s\n", strerror(errno));
+       }
 
        s_info.nr_of_lines++;
        rotate_log();
@@ -105,8 +113,9 @@ HAPI int critical_log_init(const char *name)
        int namelen;
        char *filename;
 
-       if (s_info.fp)
+       if (s_info.fp) {
                return LB_STATUS_SUCCESS;
+       }
 
        s_info.filename = strdup(name);
        if (!s_info.filename) {
@@ -149,7 +158,9 @@ HAPI int critical_log_fini(void)
        }
 
        if (s_info.fp) {
-               fclose(s_info.fp);
+               if (fclose(s_info.fp) != 0) {
+                       ErrPrint("fclose: %s\n", strerror(errno));
+               }
                s_info.fp = NULL;
        }
 
index 26ad904..4d002fa 100644 (file)
@@ -92,9 +92,12 @@ static void signal_handler(int signum, siginfo_t *info, void *unused)
                snprintf(log_fname, sizeof(log_fname), "%s/slave.%d", SLAVE_LOG_PATH, getpid());
                fd = open(log_fname, O_WRONLY|O_CREAT|O_SYNC, 0644);
                if (fd >= 0) {
-                       if (write(fd, so_fname, strlen(so_fname)) != strlen(so_fname))
+                       if (write(fd, so_fname, strlen(so_fname)) != strlen(so_fname)) {
                                ErrPrint("Failed to recording the fault SO filename (%s)\n", so_fname);
-                       close(fd);
+                       }
+                       if (close(fd) < 0) {
+                               ErrPrint("close: %s\n", strerror(errno));
+                       }
                }
        }
 
@@ -118,38 +121,49 @@ HAPI int fault_init(void)
        act.sa_sigaction = signal_handler;
        act.sa_flags = SA_SIGINFO;
 
-       if (sigemptyset(&act.sa_mask) != 0)
+       if (sigemptyset(&act.sa_mask) != 0) {
                ErrPrint("Failed to init signal: %s\n", strerror(errno));
+       }
 
-       if (sigaddset(&act.sa_mask, SIGUSR1) != 0)
+       if (sigaddset(&act.sa_mask, SIGUSR1) != 0) {
                ErrPrint("Failed to add set: %s\n", strerror(errno));
-       if (sigaddset(&act.sa_mask, SIGALRM) != 0)
+       }
+       if (sigaddset(&act.sa_mask, SIGALRM) != 0) {
                ErrPrint("Failed to add set: %s\n", strerror(errno));
+       }
 
        ecore_abort = getenv("ECORE_ERROR_ABORT");
        if (!ecore_abort || ecore_abort[0] != '1') {
-               if (sigaddset(&act.sa_mask, SIGSEGV) != 0)
+               if (sigaddset(&act.sa_mask, SIGSEGV) != 0) {
                        ErrPrint("Failed to add set: %s\n", strerror(errno));
-               if (sigaddset(&act.sa_mask, SIGABRT) != 0)
+               }
+               if (sigaddset(&act.sa_mask, SIGABRT) != 0) {
                        ErrPrint("Failed to add set: %s\n", strerror(errno));
-               if (sigaddset(&act.sa_mask, SIGILL) != 0)
+               }
+               if (sigaddset(&act.sa_mask, SIGILL) != 0) {
                        ErrPrint("Failed to add set: %s\n", strerror(errno));
+               }
 
-               if (sigaction(SIGSEGV, &act, NULL) < 0)
+               if (sigaction(SIGSEGV, &act, NULL) < 0) {
                        ErrPrint("Failed to install the SEGV handler\n");
+               }
 
-               if (sigaction(SIGABRT, &act, NULL) < 0)
+               if (sigaction(SIGABRT, &act, NULL) < 0) {
                        ErrPrint("Faield to install the ABRT handler\n");
+               }
 
-               if (sigaction(SIGILL, &act, NULL) < 0)
+               if (sigaction(SIGILL, &act, NULL) < 0) {
                        ErrPrint("Faield to install the ILL handler\n");
+               }
        }
 
-       if (sigaction(SIGUSR1, &act, NULL) < 0)
+       if (sigaction(SIGUSR1, &act, NULL) < 0) {
                ErrPrint("Failed to install the USR1 handler\n");
+       }
 
-       if (sigaction(SIGALRM, &act, NULL) < 0)
+       if (sigaction(SIGALRM, &act, NULL) < 0) {
                ErrPrint("Failed to install the ALRM handler\n");
+       }
 
        return 0;
 }
@@ -165,8 +179,9 @@ HAPI int fault_fini(void)
 
 HAPI int fault_mark_call(const char *pkgname, const char *filename, const char *funcname, int noalarm, int life_time)
 {
-       if (!s_info.disable_checker)
+       if (!s_info.disable_checker) {
                provider_send_call(pkgname, filename, funcname);
+       }
        /*!
         * \NOTE
         *   To use this "alarm", the livebox have to do not use the 'sleep' series functions.
@@ -199,8 +214,9 @@ HAPI int fault_unmark_call(const char *pkgname, const char *filename, const char
                s_info.marked = 0;
        }
 
-       if (!s_info.disable_checker)
+       if (!s_info.disable_checker) {
                provider_send_ret(pkgname, filename, funcname);
+       }
        return 0;
 }
 
index 0af2ba0..c80aff6 100644 (file)
--- a/src/lb.c
+++ b/src/lb.c
@@ -102,8 +102,9 @@ static void pending_timer_freeze(void)
 static void pending_timer_thaw(void)
 {
        DbgPrint("Freezed Count: %d\n", s_info.pending_timer_freezed);
-       if (!s_info.pending_timer_freezed)
+       if (!s_info.pending_timer_freezed) {
                return;
+       }
 
        s_info.pending_timer_freezed--;
        if (s_info.pending_timer && !s_info.pending_timer_freezed) {
@@ -125,8 +126,9 @@ static inline int pd_is_opened(const char *pkgname)
 
        i = 0;
        EINA_LIST_FOREACH(s_info.pd_list, l, tmp) {
-               if (pkgname && !strcmp(pkgname, tmp))
+               if (pkgname && !strcmp(pkgname, tmp)) {
                        return 1;
+               }
 
                i++;
        }
@@ -139,11 +141,13 @@ static Eina_Bool pd_open_pended_cmd_consumer_cb(void *data)
        struct item *item;
 
        item = eina_list_nth(s_info.pd_open_pending_list, 0);
-       if (!item)
+       if (!item) {
                goto cleanout;
+       }
 
-       if (s_info.update)
+       if (s_info.update) {
                return ECORE_CALLBACK_RENEW;
+       }
 
        s_info.pd_open_pending_list = eina_list_remove(s_info.pd_open_pending_list, item);
        /*!
@@ -154,8 +158,9 @@ static Eina_Bool pd_open_pended_cmd_consumer_cb(void *data)
                /* Item is destroyed */
        }
 
-       if (s_info.pd_open_pending_list)
+       if (s_info.pd_open_pending_list) {
                return ECORE_CALLBACK_RENEW;
+       }
 
 cleanout:
        s_info.pd_open_pending_timer = NULL;
@@ -167,11 +172,13 @@ static Eina_Bool pended_cmd_consumer_cb(void *data)
        struct item *item;
 
        item = eina_list_nth(s_info.pending_list, 0);
-       if (!item)
+       if (!item) {
                goto cleanout;
+       }
 
-       if (s_info.update || pd_is_opened(item->inst->item->pkgname) < 0)
+       if (s_info.update || pd_is_opened(item->inst->item->pkgname) < 0) {
                return ECORE_CALLBACK_RENEW;
+       }
 
        s_info.pending_list = eina_list_remove(s_info.pending_list, item);
        /*!
@@ -182,8 +189,9 @@ static Eina_Bool pended_cmd_consumer_cb(void *data)
                /* item is destroyed */
        }
 
-       if (s_info.pending_list)
+       if (s_info.pending_list) {
                return ECORE_CALLBACK_RENEW;
+       }
 
 cleanout:
        s_info.pending_timer = NULL;
@@ -193,8 +201,9 @@ cleanout:
 
 static inline __attribute__((always_inline)) int activate_pending_consumer(void)
 {
-       if (s_info.pending_timer)
+       if (s_info.pending_timer) {
                return 0;
+       }
 
        s_info.pending_timer = ecore_timer_add(0.000001f, pended_cmd_consumer_cb, NULL);
        if (!s_info.pending_timer) {
@@ -206,16 +215,18 @@ static inline __attribute__((always_inline)) int activate_pending_consumer(void)
         * Do not increase the freezed counter.
         * Just freeze the timer.
         */
-       if (s_info.pending_timer_freezed)
+       if (s_info.pending_timer_freezed) {
                ecore_timer_freeze(s_info.pending_timer);
+       }
 
        return 0;
 }
 
 static inline void deactivate_pending_consumer(void)
 {
-       if (!s_info.pending_timer)
+       if (!s_info.pending_timer) {
                return;
+       }
 
        ecore_timer_del(s_info.pending_timer);
        s_info.pending_timer = NULL;
@@ -224,8 +235,9 @@ static inline void deactivate_pending_consumer(void)
 
 static inline void deactivate_pd_open_pending_consumer(void)
 {
-       if (!s_info.pd_open_pending_timer)
+       if (!s_info.pd_open_pending_timer) {
                return;
+       }
 
        ecore_timer_del(s_info.pd_open_pending_timer);
        s_info.pd_open_pending_timer = NULL;
@@ -233,8 +245,9 @@ static inline void deactivate_pd_open_pending_consumer(void)
 
 static inline int __attribute__((always_inline)) activate_pd_open_pending_consumer(void)
 {
-       if (s_info.pd_open_pending_timer)
+       if (s_info.pd_open_pending_timer) {
                return 0;
+       }
 
        s_info.pd_open_pending_timer = ecore_timer_add(0.000001f, pd_open_pended_cmd_consumer_cb, NULL);
        if (!s_info.pd_open_pending_timer) {
@@ -253,19 +266,22 @@ static inline void migrate_to_pd_open_pending_list(const char *pkgname)
        int cnt = 0;
 
        EINA_LIST_FOREACH_SAFE(s_info.pending_list, l, n, item) {
-               if (strcmp(pkgname, item->inst->item->pkgname))
+               if (strcmp(pkgname, item->inst->item->pkgname)) {
                        continue;
+               }
 
                s_info.pending_list = eina_list_remove(s_info.pending_list, item);
                s_info.pd_open_pending_list = eina_list_append(s_info.pd_open_pending_list, item);
                cnt++;
        }
 
-       if (s_info.pd_open_pending_list)
+       if (s_info.pd_open_pending_list) {
                activate_pd_open_pending_consumer();
+       }
 
-       if (!s_info.pending_list)
+       if (!s_info.pending_list) {
                deactivate_pending_consumer();
+       }
 }
 
 static inline void migrate_to_pending_list(const char *pkgname)
@@ -276,19 +292,22 @@ static inline void migrate_to_pending_list(const char *pkgname)
        int cnt = 0;
 
        EINA_LIST_FOREACH_SAFE(s_info.pd_open_pending_list, l, n, item) {
-               if (strcmp(pkgname, item->inst->item->pkgname))
+               if (strcmp(pkgname, item->inst->item->pkgname)) {
                        continue;
+               }
 
                s_info.pd_open_pending_list = eina_list_remove(s_info.pd_open_pending_list, item);
                s_info.pending_list = eina_list_append(s_info.pending_list, item);
                cnt++;
        }
 
-       if (s_info.pending_list)
+       if (s_info.pending_list) {
                activate_pending_consumer();
+       }
 
-       if (!s_info.pd_open_pending_list)
+       if (!s_info.pd_open_pending_list) {
                deactivate_pd_open_pending_consumer();
+       }
 }
 
 static inline int is_pended_item(struct item *item)
@@ -323,8 +342,9 @@ static int append_pending_list(struct item *item)
                        return LB_STATUS_ERROR_EXIST;
                }
 
-               if (activate_pending_consumer() < 0)
+               if (activate_pending_consumer() < 0) {
                        return LB_STATUS_ERROR_FAULT;
+               }
 
                s_info.pending_list = eina_list_append(s_info.pending_list, item);
        }
@@ -344,8 +364,9 @@ static inline int timer_thaw(struct item *item)
        double delay;
        double sleep_time;
 
-       if (!item->timer)
+       if (!item->timer) {
                return 0;
+       }
 
        ecore_timer_thaw(item->timer);
        period = ecore_timer_interval_get(item->timer);
@@ -353,8 +374,9 @@ static inline int timer_thaw(struct item *item)
        delay = util_time_delay_for_compensation(period) - pending;
        ecore_timer_delay(item->timer, delay);
 
-       if (item->sleep_at == 0.0f)
+       if (item->sleep_at == 0.0f) {
                return 0;
+       }
 
        sleep_time = util_timestamp() - item->sleep_at;
        item->sleep_at = 0.0f;
@@ -371,17 +393,19 @@ static inline int timer_thaw(struct item *item)
        return UPDATE_NOT_INVOKED;
 }
 
-static inline void timer_freeze(struct item *item)
+static void timer_freeze(struct item *item)
 {
        struct timeval tv;
 
-       if (!item->timer)
+       if (!item->timer) {
                return;
+       }
 
        ecore_timer_freeze(item->timer);
 
-       if (ecore_timer_interval_get(item->timer) <= 1.0f)
+       if (ecore_timer_interval_get(item->timer) <= 1.0f) {
                return;
+       }
 
        if (gettimeofday(&tv, NULL) < 0) {
                ErrPrint("gettimeofday: %s\n", strerror(errno));
@@ -434,8 +458,9 @@ static inline Eina_List *find_item(struct instance *inst)
        struct item *item;
        
        EINA_LIST_FOREACH(s_info.item_list, l, item) {
-               if (item->inst == inst)
+               if (item->inst == inst) {
                        return l;
+               }
        }
 
        return NULL;
@@ -458,16 +483,18 @@ static inline int output_handler(struct item *item)
        }
 
        if (item->monitor_cnt == 0) {
-               if (!invalid)
+               if (!invalid) {
                        fault_unmark_call(item->inst->item->pkgname, item->inst->id, "update,crashed", NO_ALARM);
+               }
 
                if (item->monitor) {
                        ecore_timer_del(item->monitor);
                        item->monitor = NULL;
                }
 
-               if (s_info.update == item)
+               if (s_info.update == item) {
                        s_info.update = NULL;
+               }
 
                if (item->deleteme) {
                        provider_send_deleted(item->inst->item->pkgname, item->inst->id);
@@ -484,8 +511,9 @@ static int desc_updated_cb(const char *filename, void *data, int over)
 {
        struct item *item;
 
-       if (over)
+       if (over) {
                WarnPrint("Event Q overflow\n");
+       }
 
        item = data;
 
@@ -508,8 +536,9 @@ static int file_updated_cb(const char *filename, void *data, int over)
        char *title = NULL;
        int ret;
 
-       if (over)
+       if (over) {
                WarnPrint("Event Q overflow\n");
+       }
 
        item = data;
 
@@ -538,8 +567,9 @@ static int file_updated_cb(const char *filename, void *data, int over)
 
 static void reset_lb_updated_flag(struct item *item)
 {
-       if (!item->is_lb_updated)
+       if (!item->is_lb_updated) {
                return;
+       }
 
        DbgPrint("[%s] Updated %d times, (content: %s), (title: %s)\n",
                        item->inst->id, item->is_lb_updated,
@@ -558,12 +588,14 @@ static inline int clear_from_pd_open_pending_list(struct item *item)
        struct item *tmp;
 
        EINA_LIST_FOREACH(s_info.pd_open_pending_list, l, tmp) {
-               if (tmp != item)
+               if (tmp != item) {
                        continue;
+               }
 
                s_info.pd_open_pending_list = eina_list_remove_list(s_info.pd_open_pending_list, l);
-               if (!s_info.pd_open_pending_list)
+               if (!s_info.pd_open_pending_list) {
                        deactivate_pd_open_pending_consumer();
+               }
                return LB_STATUS_SUCCESS;
        }
 
@@ -576,12 +608,14 @@ static inline int clear_from_pending_list(struct item *item)
        struct item *tmp;
 
        EINA_LIST_FOREACH(s_info.pending_list, l, tmp) {
-               if (tmp != item)
+               if (tmp != item) {
                        continue;
+               }
 
                s_info.pending_list = eina_list_remove_list(s_info.pending_list, l);
-               if (!s_info.pending_list)
+               if (!s_info.pending_list) {
                        deactivate_pending_consumer();
+               }
                return LB_STATUS_SUCCESS;
        }
 
@@ -596,8 +630,9 @@ static Eina_Bool update_timeout_cb(void *data)
 
        ErrPrint("UPDATE TIMEOUT ========> %s - %s\n", item->inst->item->pkgname, item->inst->id);
 
-       if (s_info.update != item)
+       if (s_info.update != item) {
                ErrPrint("Updating item is not matched\n");
+       }
 
        fault_unmark_call(item->inst->item->pkgname, item->inst->id, "update,crashed", NO_ALARM);
        fault_mark_call(item->inst->item->pkgname, item->inst->id, "update,timeout", NO_ALARM, DEFAULT_LIFE_TIMER);
@@ -619,7 +654,7 @@ static Eina_Bool updator_cb(void *data)
 
        item = data;
 
-       if (item->monitor) {/*!< If this item is already in update process */
+       if (item->monitor) { /*!< If this item is already in update process */
                return ECORE_CALLBACK_RENEW;
        }
 
@@ -689,8 +724,9 @@ static Eina_Bool updator_cb(void *data)
         */
        fault_mark_call(item->inst->item->pkgname, item->inst->id, "update,crashed", NO_ALARM, DEFAULT_LIFE_TIMER);
 
-       if (ret & NEED_TO_SCHEDULE)
+       if (ret & NEED_TO_SCHEDULE) {
                (void)append_pending_list(item);
+       }
 
        if (ret & OUTPUT_UPDATED) {
                /*!
@@ -803,8 +839,9 @@ const char *livebox_find_pkgname(const char *filename)
        struct item *item;
 
        EINA_LIST_FOREACH(s_info.item_list, l, item) {
-               if (!strcmp(item->inst->id, filename))
+               if (!strcmp(item->inst->id, filename)) {
                        return item->inst->item->pkgname;
+               }
        }
 
        return NULL;
@@ -875,8 +912,9 @@ HAPI int lb_open_pd(const char *pkgname)
        char *tmp;
 
        EINA_LIST_FOREACH(s_info.pd_list, l, tmp) {
-               if (!strcmp(pkgname, tmp))
+               if (!strcmp(pkgname, tmp)) {
                        return 0;
+               }
        }
 
        tmp = strdup(pkgname);
@@ -885,8 +923,9 @@ HAPI int lb_open_pd(const char *pkgname)
                return LB_STATUS_ERROR_MEMORY;
        }
 
-       if (!s_info.pd_list)
+       if (!s_info.pd_list) {
                pending_timer_freeze();
+       }
 
        s_info.pd_list = eina_list_append(s_info.pd_list, tmp);
 
@@ -905,14 +944,16 @@ HAPI int lb_close_pd(const char *pkgname)
        char *tmp;
 
        EINA_LIST_FOREACH_SAFE(s_info.pd_list, l, n, tmp) {
-               if (strcmp(tmp, pkgname))
+               if (strcmp(tmp, pkgname)) {
                        continue;
+               }
 
                s_info.pd_list = eina_list_remove(s_info.pd_list, tmp);
                free(tmp);
 
-               if (!s_info.pd_list)
+               if (!s_info.pd_list) {
                        pending_timer_thaw();
+               }
 
                /*!
                 * Move all items in pd_open_pending_list
@@ -945,8 +986,9 @@ HAPI int lb_create(const char *pkgname, const char *id, const char *content_info
 
        if (!skip_need_to_create) {
                ret = so_create_needed(pkgname, cluster, category, abi);
-               if (ret != NEED_TO_CREATE)
+               if (ret != NEED_TO_CREATE) {
                        return LB_STATUS_ERROR_PERMISSION;
+               }
 
                need_to_create = 1;
        }
@@ -986,8 +1028,9 @@ HAPI int lb_create(const char *pkgname, const char *id, const char *content_info
                        return LB_STATUS_ERROR_FAULT;
                }
 
-               if (s_info.paused)
+               if (s_info.paused) {
                        timer_freeze(item);
+               }
        } else {
                DbgPrint("Local update timer is disabled: %lf (%d)\n", period, s_info.secured);
                item->timer = NULL;
@@ -1016,8 +1059,9 @@ HAPI int lb_create(const char *pkgname, const char *id, const char *content_info
                                char *tmp;
 
                                tmp = strdup(*out_content);
-                               if (!tmp)
+                               if (!tmp) {
                                        ErrPrint("Memory: %s\n", strerror(errno));
+                               }
 
                                *out_content = tmp;
                        }
@@ -1026,8 +1070,9 @@ HAPI int lb_create(const char *pkgname, const char *id, const char *content_info
                                char *tmp;
 
                                tmp = strdup(*out_title);
-                               if (!tmp)
+                               if (!tmp) {
                                        ErrPrint("Memory: %s\n", strerror(errno));
+                               }
 
                                *out_title = tmp;
                        }
@@ -1061,8 +1106,9 @@ HAPI int lb_destroy(const char *pkgname, const char *id)
        item = eina_list_data_get(l);
        s_info.item_list = eina_list_remove_list(s_info.item_list, l);
 
-       if (s_info.update == item)
+       if (s_info.update == item) {
                s_info.update = NULL;
+       }
 
        if (item->timer) {
                clear_from_pd_open_pending_list(item);
@@ -1070,10 +1116,11 @@ HAPI int lb_destroy(const char *pkgname, const char *id)
                ecore_timer_del(item->timer);
                item->timer = NULL;
 
-               if (item->monitor)
+               if (item->monitor) {
                        item->deleteme = 1;
-               else
+               } else {
                        update_monitor_del(id, item);
+               }
        }
 
        if (!item->monitor) {
@@ -1106,16 +1153,18 @@ HAPI int lb_resize(const char *pkgname, const char *id, int w, int h)
        item = eina_list_data_get(l);
 
        ret = so_resize(inst, w, h);
-       if (ret < 0)
+       if (ret < 0) {
                return ret;
+       }
 
        if (ret & NEED_TO_SCHEDULE) {
                DbgPrint("%s Returns NEED_TO_SCHEDULE\n", pkgname);
                (void)append_pending_list(item);
        }
 
-       if (ret & OUTPUT_UPDATED)
+       if (ret & OUTPUT_UPDATED) {
                update_monitor_cnt(item);
+       }
 
        return LB_STATUS_SUCCESS;
 }
@@ -1170,8 +1219,9 @@ HAPI int lb_set_period(const char *pkgname, const char *id, double period)
                                return LB_STATUS_ERROR_FAULT;
                        }
 
-                       if (s_info.paused)
+                       if (s_info.paused) {
                                timer_freeze(item);
+                       }
                }
        }
 
@@ -1200,16 +1250,18 @@ HAPI int lb_clicked(const char *pkgname, const char *id, const char *event, doub
        item = eina_list_data_get(l);
 
        ret = so_clicked(inst, event, timestamp, x, y);
-       if (ret < 0)
+       if (ret < 0) {
                return ret;
+       }
 
        if (ret & NEED_TO_SCHEDULE) {
                DbgPrint("%s Returns NEED_TO_SCHEDULE\n", pkgname);
                (void)append_pending_list(item);
        }
 
-       if (ret & OUTPUT_UPDATED)
+       if (ret & OUTPUT_UPDATED) {
                update_monitor_cnt(item);
+       }
 
        return LB_STATUS_SUCCESS;
 }
@@ -1240,8 +1292,9 @@ HAPI int lb_script_event(const char *pkgname, const char *id, const char *emissi
                        if (!strcmp(emission, "lb,show")) {
                                item->is_lb_show = 1;
 
-                               if (item->is_lb_updated && !is_pended_item(item))
+                               if (item->is_lb_updated && !is_pended_item(item)) {
                                        reset_lb_updated_flag(item);
+                               }
 
                                source = util_uri_to_path(source);
                        } else if (!strcmp(emission, "lb,hide")) {
@@ -1262,16 +1315,18 @@ HAPI int lb_script_event(const char *pkgname, const char *id, const char *emissi
        }
 
        ret = so_script_event(inst, emission, source, event_info);
-       if (ret < 0)
+       if (ret < 0) {
                return ret;
+       }
 
        if (ret & NEED_TO_SCHEDULE) {
                DbgPrint("%s Returns NEED_TO_SCHEDULE\n", pkgname);
                (void)append_pending_list(item);
        }
 
-       if (ret & OUTPUT_UPDATED)
+       if (ret & OUTPUT_UPDATED) {
                update_monitor_cnt(item);
+       }
 
        return LB_STATUS_SUCCESS;
 }
@@ -1329,33 +1384,38 @@ HAPI int lb_change_group(const char *pkgname, const char *id, const char *cluste
        item = eina_list_data_get(l);
 
        ret = so_change_group(inst, cluster, category);
-       if (ret < 0)
+       if (ret < 0) {
                return ret;
+       }
 
        if (ret & NEED_TO_SCHEDULE) {
                DbgPrint("%s Returns NEED_TO_SCHEDULE\n", pkgname);
                (void)append_pending_list(item);
        }
 
-       if (ret & OUTPUT_UPDATED)
+       if (ret & OUTPUT_UPDATED) {
                update_monitor_cnt(item);
+       }
 
        return LB_STATUS_SUCCESS;
 }
 
-static inline int lb_sys_event(struct instance *inst, struct item *item, int event)
+static int lb_sys_event(struct instance *inst, struct item *item, int event)
 {
        int ret;
 
        ret = so_sys_event(inst, event);
-       if (ret < 0)
+       if (ret < 0) {
                return ret;
+       }
 
-       if (ret & NEED_TO_SCHEDULE)
+       if (ret & NEED_TO_SCHEDULE) {
                (void)append_pending_list(item);
+       }
 
-       if (ret & OUTPUT_UPDATED)
+       if (ret & OUTPUT_UPDATED) {
                update_monitor_cnt(item);
+       }
 
        return LB_STATUS_SUCCESS;
 }
@@ -1413,14 +1473,17 @@ HAPI int lb_update_all(const char *pkgname, const char *cluster, const char *cat
 
        DbgPrint("Update content for %s\n", pkgname ? pkgname : "(all)");
        EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) {
-               if (item->deleteme)
+               if (item->deleteme) {
                        continue;
+               }
 
-               if (cluster && strcasecmp(item->inst->cluster, cluster))
+               if (cluster && strcasecmp(item->inst->cluster, cluster)) {
                        continue;
+               }
 
-               if (category && strcasecmp(item->inst->category, category))
+               if (category && strcasecmp(item->inst->category, category)) {
                        continue;
+               }
 
                if (pkgname && strlen(pkgname)) {
                        if (!strcmp(item->inst->item->pkgname, pkgname)) {
@@ -1442,8 +1505,9 @@ HAPI int lb_delete_all_deleteme(void)
        int cnt = 0;
 
        EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) {
-               if (!item->deleteme)
+               if (!item->deleteme) {
                        continue;
+               }
 
                update_monitor_del(item->inst->id, item);
                (void)so_destroy(item->inst);
@@ -1462,8 +1526,9 @@ HAPI int lb_system_event_all(int event)
        struct item *item;
 
        EINA_LIST_FOREACH_SAFE(s_info.item_list, l, n, item) {
-               if (item->deleteme)
+               if (item->deleteme) {
                        continue;
+               }
 
                DbgPrint("System event for %s (%d)\n", item->inst->id, event);
                lb_sys_event(item->inst, item, event);
@@ -1487,8 +1552,9 @@ HAPI void lb_pause_all(void)
                        continue;
                }
 
-               if (item->is_paused)
+               if (item->is_paused) {
                        continue;
+               }
 
                timer_freeze(item);
 
@@ -1512,8 +1578,9 @@ HAPI void lb_resume_all(void)
                        continue;
                }
 
-               if (item->is_paused)
+               if (item->is_paused) {
                        continue;
+               }
 
                lb_sys_event(item->inst, item, LB_SYS_EVENT_RESUMED);
 
@@ -1542,8 +1609,9 @@ HAPI int lb_pause(const char *pkgname, const char *id)
        struct item *item;
 
        inst = so_find_instance(pkgname, id);
-       if (!inst)
+       if (!inst) {
                return LB_STATUS_ERROR_INVALID;
+       }
 
        l = find_item(inst);
        if (!l) {
@@ -1552,8 +1620,9 @@ HAPI int lb_pause(const char *pkgname, const char *id)
        }
 
        item = eina_list_data_get(l);
-       if (!item)
+       if (!item) {
                return LB_STATUS_ERROR_FAULT;
+       }
 
        if (item->deleteme) {
                DbgPrint("Instance %s will be deleted (%s)\n", item->inst->item->pkgname, item->inst->id);
@@ -1562,8 +1631,9 @@ HAPI int lb_pause(const char *pkgname, const char *id)
 
        item->is_paused = 1;
 
-       if (s_info.paused)
+       if (s_info.paused) {
                return LB_STATUS_SUCCESS;
+       }
 
        timer_freeze(item);
 
@@ -1580,8 +1650,9 @@ HAPI int lb_resume(const char *pkgname, const char *id)
        int ret;
 
        inst = so_find_instance(pkgname, id);
-       if (!inst)
+       if (!inst) {
                return LB_STATUS_ERROR_INVALID;
+       }
 
        l = find_item(inst);
        if (!l) {
@@ -1590,8 +1661,9 @@ HAPI int lb_resume(const char *pkgname, const char *id)
        }
 
        item = eina_list_data_get(l);
-       if (!item)
+       if (!item) {
                return LB_STATUS_ERROR_FAULT;
+       }
 
        if (item->deleteme) {
                DbgPrint("Instance %s will be deleted (%s)\n", item->inst->item->pkgname, item->inst->id);
@@ -1600,8 +1672,9 @@ HAPI int lb_resume(const char *pkgname, const char *id)
 
        item->is_paused = 0;
 
-       if (s_info.paused)
+       if (s_info.paused) {
                return LB_STATUS_SUCCESS;
+       }
 
        lb_sys_event(inst, item, LB_SYS_EVENT_RESUMED);
 
index 7e35e70..5373177 100644 (file)
@@ -169,8 +169,9 @@ static void font_size_cb(system_settings_key_e key, void *user_data)
 {
        int size;
 
-       if (system_settings_get_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, &size) != SYSTEM_SETTINGS_ERROR_NONE)
+       if (system_settings_get_value_int(SYSTEM_SETTINGS_KEY_FONT_SIZE, &size) != SYSTEM_SETTINGS_ERROR_NONE) {
                return;
+       }
 
        size = convert_font_size(size);
 
@@ -191,8 +192,9 @@ static void mmc_changed_cb(keynode_t *node, void *user_data)
 
 static void time_changed_cb(keynode_t *node, void *user_data)
 {
-       if (vconf_keynode_get_int(node) != VCONFKEY_SYSMAN_STIME_CHANGED)
+       if (vconf_keynode_get_int(node) != VCONFKEY_SYSMAN_STIME_CHANGED) {
                return;
+       }
 
        DbgPrint("Time is changed\n");
        lb_system_event_all(LB_SYS_EVENT_TIME_CHANGED);
@@ -207,10 +209,15 @@ static bool app_create(void *data)
        ret = conf_loader();
        DbgPrint("Configureation manager is initiated: %d\n", ret);
 
-       if (COM_CORE_THREAD)
-               setenv("PROVIDER_COM_CORE_THREAD", "true", 0);
-       else
-               setenv("PROVIDER_COM_CORE_THREAD", "false", 0);
+       if (COM_CORE_THREAD) {
+               if (setenv("PROVIDER_COM_CORE_THREAD", "true", 0) < 0) {
+                       ErrPrint("setenv: %s\n", strerror(errno));
+               }
+       } else {
+               if (setenv("PROVIDER_COM_CORE_THREAD", "false", 0) < 0){
+                       ErrPrint("setenv: %s\n", strerror(errno));
+               }
+       }
 
        ret = livebox_service_init();
        DbgPrint("Livebox service init: %d\n", ret);
@@ -396,12 +403,14 @@ int main(int argc, char *argv[])
        mcheck(mcheck_cb);
 #endif
        option = getenv("PROVIDER_DISABLE_CALL_OPTION");
-       if (option && !strcasecmp(option, "true"))
+       if (option && !strcasecmp(option, "true")) {
                fault_disable_call_option();
+       }
 
        option = getenv("PROVIDER_HEAP_MONITOR_START");
-       if (option && !strcasecmp(option, "true"))
+       if (option && !strcasecmp(option, "true")) {
                s_info.heap_monitor = 1;
+       }
 
        setenv("BUFMGR_LOCK_TYPE", "once", 0);
        setenv("BUFMGR_MAP_CACHE", "true", 0);
index 9678133..53fdd4d 100644 (file)
@@ -51,8 +51,9 @@ static inline struct so_item *find_livebox(const char *pkgname)
        struct so_item *item;
 
        EINA_LIST_FOREACH(s_info.livebox_list, l, item) {
-               if (!strcmp(item->pkgname, pkgname))
+               if (!strcmp(item->pkgname, pkgname)) {
                        return item;
+               }
        }
 
        return NULL;
@@ -125,7 +126,9 @@ static void delete_livebox(struct so_item *item)
        }
 
        heap_monitor_del_target(item->so_fname);
-       dlclose(item->handle);
+       if (dlclose(item->handle) != 0) {
+               ErrPrint("dlclose: %s\n", dlerror());
+       }
        free(item->so_fname);
        free(item->pkgname);
        free(item);
@@ -134,6 +137,7 @@ static void delete_livebox(struct so_item *item)
 static struct so_item *new_adaptor(const char *pkgname, const char *abi)
 {
        struct so_item *item;
+       char *errmsg;
 
        item = calloc(1, sizeof(*item));
        if (!item) {
@@ -177,6 +181,11 @@ static struct so_item *new_adaptor(const char *pkgname, const char *abi)
        }
        fault_unmark_call(pkgname, __func__, __func__, USE_ALARM);
 
+       errmsg = dlerror();
+       if (errmsg) {
+               DbgPrint("dlerror(can be ignored): %s\n", errmsg);
+       }
+
        item->adaptor.create = (adaptor_create_t)dlsym(item->handle, "livebox_create");
        if (!item->adaptor.create) {
                ErrPrint("symbol: livebox_create - %s\n", dlerror());
@@ -192,60 +201,74 @@ static struct so_item *new_adaptor(const char *pkgname, const char *abi)
        }
 
        item->adaptor.pinup = (adaptor_pinup_t)dlsym(item->handle, "livebox_pinup");
-       if (!item->adaptor.pinup)
+       if (!item->adaptor.pinup) {
                ErrPrint("symbol: livebox_pinup - %s\n", dlerror());
+       }
 
        item->adaptor.is_updated = (adaptor_is_updated_t)dlsym(item->handle, "livebox_need_to_update");
-       if (!item->adaptor.is_updated)
+       if (!item->adaptor.is_updated) {
                ErrPrint("symbol: livebox_need_to_update - %s\n", dlerror());
+       }
 
        item->adaptor.update_content = (adaptor_update_content_t)dlsym(item->handle, "livebox_update_content");
-       if (!item->adaptor.update_content)
+       if (!item->adaptor.update_content) {
                ErrPrint("symbol: livebox_update_content - %s\n", dlerror());
+       }
 
        item->adaptor.clicked = (adaptor_clicked_t)dlsym(item->handle, "livebox_clicked");
-       if (!item->adaptor.clicked)
+       if (!item->adaptor.clicked) {
                ErrPrint("symbol: livebox_clicked - %s\n", dlerror());
+       }
 
        item->adaptor.script_event = (adaptor_script_t)dlsym(item->handle, "livebox_content_event");
-       if (!item->adaptor.script_event)
+       if (!item->adaptor.script_event) {
                ErrPrint("symbol: livebox_content_event - %s\n", dlerror());
+       }
 
        item->adaptor.resize = (adaptor_resize_t)dlsym(item->handle, "livebox_resize");
-       if (!item->adaptor.resize)
+       if (!item->adaptor.resize) {
                ErrPrint("symbol: livebox_resize - %s\n", dlerror());
+       }
 
        item->adaptor.create_needed = (adaptor_create_needed_t)dlsym(item->handle, "livebox_need_to_create");
-       if (!item->adaptor.create_needed)
+       if (!item->adaptor.create_needed) {
                ErrPrint("symbol: livebox_need_to_create - %s\n", dlerror());
+       }
 
        item->adaptor.change_group = (adaptor_change_group_t)dlsym(item->handle, "livebox_change_group");
-       if (!item->adaptor.change_group)
+       if (!item->adaptor.change_group) {
                ErrPrint("symbol: livebox_change_group - %s\n", dlerror());
+       }
 
        item->adaptor.get_output_info = (adaptor_get_output_info_t)dlsym(item->handle, "livebox_get_info");
-       if (!item->adaptor.get_output_info)
+       if (!item->adaptor.get_output_info) {
                ErrPrint("symbol: livebox_get_info - %s\n", dlerror());
+       }
 
        item->adaptor.initialize = (adaptor_initialize_t)dlsym(item->handle, "livebox_initialize");
-       if (!item->adaptor.initialize)
+       if (!item->adaptor.initialize) {
                ErrPrint("symbol: livebox_initialize - %s\n", dlerror());
+       }
 
        item->adaptor.finalize = (adaptor_finalize_t)dlsym(item->handle, "livebox_finalize");
-       if (!item->adaptor.finalize)
+       if (!item->adaptor.finalize) {
                ErrPrint("symbol: livebox_finalize - %s\n", dlerror());
+       }
 
        item->adaptor.need_to_destroy = (adaptor_need_to_destroy_t)dlsym(item->handle, "livebox_need_to_destroy");
-       if (!item->adaptor.need_to_destroy)
+       if (!item->adaptor.need_to_destroy) {
                ErrPrint("symbol: livebox_need_to_destroy - %s\n", dlerror());
+       }
 
        item->adaptor.sys_event = (adaptor_system_event_t)dlsym(item->handle, "livebox_system_event");
-       if (!item->adaptor.sys_event)
+       if (!item->adaptor.sys_event) {
                ErrPrint("symbol: lievbox_system_event - %s\n", dlerror());
+       }
 
        item->adaptor.is_pinned_up = (adaptor_is_pinned_up_t)dlsym(item->handle, "livebox_is_pinned_up");
-       if (!item->adaptor.is_pinned_up)
+       if (!item->adaptor.is_pinned_up) {
                ErrPrint("symbol: livebox_is_pinned_up - %s\n", dlerror());
+       }
 
        if (item->adaptor.initialize) {
                int ret;
@@ -267,6 +290,7 @@ static struct so_item *new_adaptor(const char *pkgname, const char *abi)
 static struct so_item *new_livebox(const char *pkgname)
 {
        struct so_item *item;
+       char *errmsg;
 
        item = calloc(1, sizeof(*item));
        if (!item) {
@@ -310,6 +334,11 @@ static struct so_item *new_livebox(const char *pkgname)
        }
        fault_unmark_call(pkgname, __func__, __func__, USE_ALARM);
 
+       errmsg = dlerror();
+       if (errmsg) {
+               DbgPrint("dlerror(can be ignored): %s\n", errmsg);
+       }
+
        item->livebox.create = (create_t)dlsym(item->handle, "livebox_create");
        if (!item->livebox.create) {
                ErrPrint("symbol: livebox_create - %s\n", dlerror());
@@ -325,60 +354,74 @@ static struct so_item *new_livebox(const char *pkgname)
        }
 
        item->livebox.pinup = (pinup_t)dlsym(item->handle, "livebox_pinup");
-       if (!item->livebox.pinup)
+       if (!item->livebox.pinup) {
                ErrPrint("symbol: livebox_pinup - %s\n", dlerror());
+       }
 
        item->livebox.is_updated = (is_updated_t)dlsym(item->handle, "livebox_need_to_update");
-       if (!item->livebox.is_updated)
+       if (!item->livebox.is_updated) {
                ErrPrint("symbol: livebox_need_to_update - %s\n", dlerror());
+       }
 
        item->livebox.update_content = (update_content_t)dlsym(item->handle, "livebox_update_content");
-       if (!item->livebox.update_content)
+       if (!item->livebox.update_content) {
                ErrPrint("symbol: livebox_update_content - %s\n", dlerror());
+       }
 
        item->livebox.clicked = (clicked_t)dlsym(item->handle, "livebox_clicked");
-       if (!item->livebox.clicked)
+       if (!item->livebox.clicked) {
                ErrPrint("symbol: livebox_clicked - %s\n", dlerror());
+       }
 
        item->livebox.script_event = (script_t)dlsym(item->handle, "livebox_content_event");
-       if (!item->livebox.script_event)
+       if (!item->livebox.script_event) {
                ErrPrint("symbol: livebox_content_event - %s\n", dlerror());
+       }
 
        item->livebox.resize = (resize_t)dlsym(item->handle, "livebox_resize");
-       if (!item->livebox.resize)
+       if (!item->livebox.resize) {
                ErrPrint("symbol: livebox_resize - %s\n", dlerror());
+       }
 
        item->livebox.create_needed = (create_needed_t)dlsym(item->handle, "livebox_need_to_create");
-       if (!item->livebox.create_needed)
+       if (!item->livebox.create_needed) {
                ErrPrint("symbol: livebox_need_to_create - %s\n", dlerror());
+       }
 
        item->livebox.change_group = (change_group_t)dlsym(item->handle, "livebox_change_group");
-       if (!item->livebox.change_group)
+       if (!item->livebox.change_group) {
                ErrPrint("symbol: livebox_change_group - %s\n", dlerror());
+       }
 
        item->livebox.get_output_info = (get_output_info_t)dlsym(item->handle, "livebox_get_info");
-       if (!item->livebox.get_output_info)
+       if (!item->livebox.get_output_info) {
                ErrPrint("symbol: livebox_get_info - %s\n", dlerror());
+       }
 
        item->livebox.initialize = (initialize_t)dlsym(item->handle, "livebox_initialize");
-       if (!item->livebox.initialize)
+       if (!item->livebox.initialize) {
                ErrPrint("symbol: livebox_initialize - %s\n", dlerror());
+       }
 
        item->livebox.finalize = (finalize_t)dlsym(item->handle, "livebox_finalize");
-       if (!item->livebox.finalize)
+       if (!item->livebox.finalize) {
                ErrPrint("symbol: livebox_finalize - %s\n", dlerror());
+       }
 
        item->livebox.need_to_destroy = (need_to_destroy_t)dlsym(item->handle, "livebox_need_to_destroy");
-       if (!item->livebox.need_to_destroy)
+       if (!item->livebox.need_to_destroy) {
                ErrPrint("symbol: livebox_need_to_destroy - %s\n", dlerror());
+       }
 
        item->livebox.sys_event = (system_event_t)dlsym(item->handle, "livebox_system_event");
-       if (!item->livebox.sys_event)
+       if (!item->livebox.sys_event) {
                ErrPrint("symbol: livebox_system_event - %s\n", dlerror());
+       }
 
        item->livebox.is_pinned_up = (is_pinned_up_t)dlsym(item->handle, "livebox_is_pinned_up");
-       if (!item->livebox.is_pinned_up)
+       if (!item->livebox.is_pinned_up) {
                ErrPrint("symbol: livebox_is_pinned_up - %s\n", dlerror());
+       }
 
        heap_monitor_add_target(item->so_fname);
 
@@ -470,8 +513,9 @@ static inline struct instance *find_instance(struct so_item *item, const char *i
        Eina_List *l;
 
        EINA_LIST_FOREACH(item->inst_list, l, inst) {
-               if (!strcmp(inst->id, id))
+               if (!strcmp(inst->id, id)) {
                        return inst;
+               }
        }
 
        return NULL;
@@ -482,8 +526,9 @@ HAPI struct instance *so_find_instance(const char *pkgname, const char *id)
        struct so_item *item;
 
        item = find_livebox(pkgname);
-       if (!item)
+       if (!item) {
                return NULL;
+       }
 
        return find_instance(item, id);
 }
@@ -502,18 +547,22 @@ HAPI int so_create(const char *pkgname, const char *id, const char *content_info
                        return LB_STATUS_ERROR_EXIST;
                }
        } else {
-               if (!strcasecmp(abi, "c"))
+               if (!strcasecmp(abi, "c")) {
                        item = new_livebox(pkgname);
-               else
+               } else {
                        item = new_adaptor(pkgname, abi);
-               if (!item)
+               }
+
+               if (!item) {
                        return LB_STATUS_ERROR_FAULT;
+               }
        }
 
        inst = new_instance(id, content_info, cluster, category);
        if (!inst) {
-               if (!item->inst_list)
+               if (!item->inst_list) {
                        delete_livebox(item);
+               }
 
                return LB_STATUS_ERROR_FAULT;
        }
@@ -525,12 +574,13 @@ HAPI int so_create(const char *pkgname, const char *id, const char *content_info
        fault_mark_call(pkgname, id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
        s_info.current_op = LIVEBOX_OP_CREATE;
-       if (item->adaptor.create)
+       if (item->adaptor.create) {
                ret = item->adaptor.create(pkgname, util_uri_to_path(id), content_info, cluster, category);
-       else if (item->livebox.create)
+       } else if (item->livebox.create) {
                ret = item->livebox.create(util_uri_to_path(id), content_info, cluster, category);
-       else /*! \NOTE: This is not possible, but for the exceptional handling */
+       } else { /*! \NOTE: This is not possible, but for the exceptional handling */
                ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+       }
        s_info.current_op = LIVEBOX_OP_UNKNOWN;
 
        fault_unmark_call(pkgname, id, __func__, USE_ALARM);
@@ -558,18 +608,20 @@ HAPI int so_destroy(struct instance *inst)
        int ret;
 
        item = inst->item;
-       if (!item)
+       if (!item) {
                return LB_STATUS_ERROR_INVALID;
+       }
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
        s_info.current_op = LIVEBOX_OP_DESTROY;
-       if (item->adaptor.destroy)
+       if (item->adaptor.destroy) {
                ret = item->adaptor.destroy(item->pkgname, util_uri_to_path(inst->id));
-       else if (item->livebox.destroy)
+       } else if (item->livebox.destroy) {
                ret = item->livebox.destroy(util_uri_to_path(inst->id));
-       else
+       } else {
                ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+       }
        s_info.current_op = LIVEBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
@@ -591,18 +643,20 @@ HAPI char *so_pinup(struct instance *inst, int pinup)
        char *ret;
 
        item = inst->item;
-       if (!item)
+       if (!item) {
                return NULL;
+       }
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
        s_info.current_op = LIVEBOX_OP_PINUP;
-       if (item->adaptor.pinup)
+       if (item->adaptor.pinup) {
                ret = item->adaptor.pinup(item->pkgname, util_uri_to_path(inst->id), pinup);
-       else if (item->livebox.pinup)
+       } else if (item->livebox.pinup) {
                ret = item->livebox.pinup(util_uri_to_path(inst->id), pinup);
-       else
+       } else {
                ret = NULL;
+       }
        s_info.current_op = LIVEBOX_OP_UNKNOWN;
        
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
@@ -615,18 +669,20 @@ HAPI int so_is_pinned_up(struct instance *inst)
        int ret;
 
        item = inst->item;
-       if (!item)
+       if (!item) {
                return LB_STATUS_ERROR_INVALID;
+       }
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
        s_info.current_op = LIVEBOX_OP_IS_PINNED_UP;
-       if (item->adaptor.is_pinned_up)
+       if (item->adaptor.is_pinned_up) {
                ret = item->adaptor.is_pinned_up(item->pkgname, util_uri_to_path(inst->id));
-       else if (item->livebox.is_pinned_up)
+       } else if (item->livebox.is_pinned_up) {
                ret = item->livebox.is_pinned_up(util_uri_to_path(inst->id));
-       else
+       } else {
                ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+       }
        s_info.current_op = LIVEBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
@@ -639,18 +695,20 @@ HAPI int so_is_updated(struct instance *inst)
        int ret;
 
        item = inst->item;
-       if (!item)
+       if (!item) {
                return LB_STATUS_ERROR_INVALID;
+       }
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
        s_info.current_op = LIVEBOX_OP_NEED_TO_UPDATE;
-       if (item->adaptor.is_updated)
+       if (item->adaptor.is_updated) {
                ret = item->adaptor.is_updated(item->pkgname, util_uri_to_path(inst->id));
-       else if (item->livebox.is_updated)
+       } else if (item->livebox.is_updated) {
                ret = item->livebox.is_updated(util_uri_to_path(inst->id));
-       else
+       } else {
                ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+       }
        s_info.current_op = LIVEBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
@@ -664,18 +722,20 @@ HAPI int so_need_to_destroy(struct instance *inst)
        int ret;
 
        item = inst->item;
-       if (!item)
+       if (!item) {
                return LB_STATUS_ERROR_INVALID;
+       }
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
        s_info.current_op = LIVEBOX_OP_NEED_TO_DESTROY;
-       if (item->adaptor.need_to_destroy)
+       if (item->adaptor.need_to_destroy) {
                ret = item->adaptor.need_to_destroy(item->pkgname, util_uri_to_path(inst->id));
-       else if (item->livebox.need_to_destroy)
+       } else if (item->livebox.need_to_destroy) {
                ret = item->livebox.need_to_destroy(util_uri_to_path(inst->id));
-       else
+       } else {
                ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+       }
        s_info.current_op = LIVEBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
@@ -689,18 +749,20 @@ HAPI int so_update(struct instance *inst)
        int ret;
 
        item = inst->item;
-       if (!item)
+       if (!item) {
                return LB_STATUS_ERROR_INVALID;
+       }
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
        s_info.current_op = LIVEBOX_OP_UPDATE_CONTENT;
-       if (item->adaptor.update_content)
+       if (item->adaptor.update_content) {
                ret = item->adaptor.update_content(item->pkgname, util_uri_to_path(inst->id));
-       else if (item->livebox.update_content)
+       } else if (item->livebox.update_content) {
                ret = item->livebox.update_content(util_uri_to_path(inst->id));
-       else
+       } else {
                ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+       }
        s_info.current_op = LIVEBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
@@ -713,19 +775,21 @@ HAPI int so_clicked(struct instance *inst, const char *event, double timestamp,
        int ret;
 
        item = inst->item;
-       if (!item)
+       if (!item) {
                return LB_STATUS_ERROR_INVALID;
+       }
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
        DbgPrint("PERF_DBOX\n");
        s_info.current_op = LIVEBOX_OP_CLICKED;
-       if (item->adaptor.clicked)
+       if (item->adaptor.clicked) {
                ret = item->adaptor.clicked(item->pkgname, util_uri_to_path(inst->id), event, timestamp, x, y);
-       else if (item->livebox.clicked)
+       } else if (item->livebox.clicked) {
                ret = item->livebox.clicked(util_uri_to_path(inst->id), event, timestamp, x, y);
-       else
+       } else {
                ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+       }
        s_info.current_op = LIVEBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
@@ -739,18 +803,20 @@ HAPI int so_script_event(struct instance *inst, const char *emission, const char
        int ret;
 
        item = inst->item;
-       if (!item)
+       if (!item) {
                return LB_STATUS_ERROR_INVALID;
+       }
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
        s_info.current_op = LIVEBOX_OP_CONTENT_EVENT;
-       if (item->adaptor.script_event)
+       if (item->adaptor.script_event) {
                ret = item->adaptor.script_event(item->pkgname, util_uri_to_path(inst->id), emission, source, event_info);
-       else if (item->livebox.script_event)
+       } else if (item->livebox.script_event) {
                ret = item->livebox.script_event(util_uri_to_path(inst->id), emission, source, event_info);
-       else
+       } else {
                ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+       }
        s_info.current_op = LIVEBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
@@ -765,22 +831,25 @@ HAPI int so_resize(struct instance *inst, int w, int h)
        int type;
 
        item = inst->item;
-       if (!item)
+       if (!item) {
                return LB_STATUS_ERROR_INVALID;
+       }
 
        type = livebox_service_size_type(w, h);
-       if (type == LB_SIZE_TYPE_UNKNOWN)
+       if (type == LB_SIZE_TYPE_UNKNOWN) {
                return LB_STATUS_ERROR_INVALID;
+       }
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
        s_info.current_op = LIVEBOX_OP_RESIZE;
-       if (item->adaptor.resize)
+       if (item->adaptor.resize) {
                ret = item->adaptor.resize(item->pkgname, util_uri_to_path(inst->id), type);
-       else if (item->livebox.resize)
+       } else if (item->livebox.resize) {
                ret = item->livebox.resize(util_uri_to_path(inst->id), type);
-       else
+       } else {
                ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+       }
        s_info.current_op = LIVEBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
@@ -795,23 +864,27 @@ HAPI int so_create_needed(const char *pkgname, const char *cluster, const char *
 
        item = find_livebox(pkgname);
        if (!item) {
-               if (!strcasecmp(abi, "c"))
+               if (!strcasecmp(abi, "c")) {
                        item = new_livebox(pkgname);
-               else
+               } else {
                        item = new_adaptor(pkgname, abi);
-               if (!item)
+               }
+
+               if (!item) {
                        return LB_STATUS_ERROR_FAULT;
+               }
        }
 
        fault_mark_call(item->pkgname, __func__, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
        s_info.current_op = LIVEBOX_OP_NEED_TO_CREATE;
-       if (item->adaptor.create_needed)
+       if (item->adaptor.create_needed) {
                ret = item->adaptor.create_needed(pkgname, cluster, category);
-       else if (item->livebox.create_needed)
+       } else if (item->livebox.create_needed) {
                ret = item->livebox.create_needed(cluster, category);
-       else
+       } else {
                ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+       }
        s_info.current_op = LIVEBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, __func__, __func__, USE_ALARM);
@@ -828,12 +901,14 @@ HAPI int so_change_group(struct instance *inst, const char *cluster, const char
        char *tmp_category;
 
        item = inst->item;
-       if (!item)
+       if (!item) {
                return LB_STATUS_ERROR_INVALID;
+       }
 
        tmp_cluster = strdup(cluster);
-       if (!tmp_cluster)
+       if (!tmp_cluster) {
                return LB_STATUS_ERROR_MEMORY;
+       }
 
        tmp_category = strdup(category);
        if (!tmp_category) {
@@ -844,12 +919,13 @@ HAPI int so_change_group(struct instance *inst, const char *cluster, const char
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
        s_info.current_op = LIVEBOX_OP_CHANGE_GROUP;
-       if (item->adaptor.change_group)
+       if (item->adaptor.change_group) {
                ret = item->adaptor.change_group(item->pkgname, util_uri_to_path(inst->id), cluster, category);
-       else if (item->livebox.change_group)
+       } else if (item->livebox.change_group) {
                ret = item->livebox.change_group(util_uri_to_path(inst->id), cluster, category);
-       else
+       } else {
                ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+       }
        s_info.current_op = LIVEBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
@@ -873,8 +949,9 @@ HAPI int so_get_output_info(struct instance *inst, int *w, int *h, double *prior
        int ret;
 
        item = inst->item;
-       if (!item)
+       if (!item) {
                return LB_STATUS_ERROR_INVALID;
+       }
 
        *content = NULL;
        *title = NULL;
@@ -882,12 +959,13 @@ HAPI int so_get_output_info(struct instance *inst, int *w, int *h, double *prior
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
        s_info.current_op = LIVEBOX_OP_GET_INFO;
-       if (item->adaptor.get_output_info)
+       if (item->adaptor.get_output_info) {
                ret = item->adaptor.get_output_info(item->pkgname, util_uri_to_path(inst->id), w, h, priority, content, title);
-       else if (item->livebox.get_output_info)
+       } else if (item->livebox.get_output_info) {
                ret = item->livebox.get_output_info(util_uri_to_path(inst->id), w, h, priority, content, title);
-       else
+       } else {
                ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+       }
        s_info.current_op = LIVEBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
@@ -913,8 +991,9 @@ HAPI int so_get_output_info(struct instance *inst, int *w, int *h, double *prior
                }
        }
 
-       if (main_heap_monitor_is_enabled())
+       if (main_heap_monitor_is_enabled()) {
                DbgPrint("%s allocates %d bytes\n", item->pkgname, heap_monitor_target_usage(item->so_fname));
+       }
 
        return ret;
 }
@@ -925,18 +1004,20 @@ HAPI int so_sys_event(struct instance *inst, int event)
        int ret;
 
        item = inst->item;
-       if (!item)
+       if (!item) {
                return LB_STATUS_ERROR_INVALID;
+       }
 
        fault_mark_call(item->pkgname, inst->id, __func__, USE_ALARM, DEFAULT_LIFE_TIMER);
 
        s_info.current_op = LIVEBOX_OP_SYSTEM_EVENT;
-       if (item->adaptor.sys_event)
+       if (item->adaptor.sys_event) {
                ret = item->adaptor.sys_event(item->pkgname, util_uri_to_path(inst->id), event);
-       else if (item->livebox.sys_event)
+       } else if (item->livebox.sys_event) {
                ret = item->livebox.sys_event(util_uri_to_path(inst->id), event);
-       else
+       } else {
                ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+       }
        s_info.current_op = LIVEBOX_OP_UNKNOWN;
 
        fault_unmark_call(item->pkgname, inst->id, __func__, USE_ALARM);
index 7722f45..9162e3d 100644 (file)
@@ -102,7 +102,9 @@ static Eina_Bool monitor_cb(void *data, Ecore_Fd_Handler *handler)
 
                if (util_check_ext(evt->name, "gnp.") == 0
                        && util_check_ext(evt->name, "csed.") == 0)
+               {
                        continue;
+               }
 
                len = strlen(evt->name) + strlen(IMAGE_PATH) + 1;
                filename = malloc(len);
@@ -155,7 +157,9 @@ HAPI int update_monitor_init(void)
 
        if (s_info.iwd < 0) {
                ErrPrint("Error: %s\n", strerror(errno));
-               close(s_info.ifd);
+               if (close(s_info.ifd) < 0) {
+                       ErrPrint("close: %s\n", strerror(errno));
+               }
                s_info.ifd = LB_STATUS_ERROR_INVALID;
                return LB_STATUS_ERROR_IO;
        }
@@ -164,11 +168,14 @@ HAPI int update_monitor_init(void)
                                ECORE_FD_READ, monitor_cb, NULL, NULL, NULL);
        if (!s_info.handler) {
                ErrPrint("Failed to add a FD handler\n");
-               if (inotify_rm_watch(s_info.ifd, s_info.iwd) < 0)
+               if (inotify_rm_watch(s_info.ifd, s_info.iwd) < 0) {
                        ErrPrint("inotify_rm_watch: %s", strerror(errno));
+               }
                s_info.iwd = -EINVAL;
 
-               close(s_info.ifd);
+               if (close(s_info.ifd) < 0) {
+                       ErrPrint("close: %s\n", strerror(errno));
+               }
                s_info.ifd = LB_STATUS_ERROR_INVALID;
                return LB_STATUS_ERROR_FAULT;
        }
@@ -187,12 +194,15 @@ HAPI int update_monitor_fini(void)
        }
 
        if (s_info.ifd >= 0) {
-               if (inotify_rm_watch(s_info.ifd, s_info.iwd) < 0)
+               if (inotify_rm_watch(s_info.ifd, s_info.iwd) < 0) {
                        ErrPrint("inotify_rm_watch:%s", strerror(errno));
+               }
 
                s_info.iwd = LB_STATUS_ERROR_INVALID;
 
-               close(s_info.ifd);
+               if (close(s_info.ifd) < 0) {
+                       ErrPrint("close: %s\n", strerror(errno));
+               }
                s_info.ifd = LB_STATUS_ERROR_INVALID;
        }
 
index 0d502b3..708541f 100644 (file)
@@ -86,8 +86,9 @@ HAPI const char *util_basename(const char *name)
        int length;
 
        length = name ? strlen(name) : 0;
-       if (!length)
+       if (!length) {
                return ".";
+       }
 
        while (--length > 0 && name[length] != '/');
 
@@ -111,15 +112,17 @@ HAPI char *util_get_current_module(char **symbol)
        register int i;
 
        if (!pthread_getattr_np(pthread_self(), &attr)) {
-               if (!pthread_attr_getstack(&attr, (void *)&stack_boundary, &stack_size))
+               if (!pthread_attr_getstack(&attr, (void *)&stack_boundary, &stack_size)) {
                        stack_boundary += stack_size;
+               }
                pthread_attr_destroy(&attr);
        }
 
        ret = NULL;
        for (i = 0, stack = (int *)&stack; (unsigned int)stack < stack_boundary ; stack++, i++) {
-               if (!dladdr((void *)*stack, &dinfo))
+               if (!dladdr((void *)*stack, &dinfo)) {
                        continue;
+               }
 
                ptr = util_basename(dinfo.dli_fname);
                if (strncmp(ptr, "liblive-", strlen("liblive-"))) {
@@ -135,10 +138,11 @@ HAPI char *util_get_current_module(char **symbol)
                ret = strdup(ptr);
 
                if (symbol) {
-                       if (dinfo.dli_sname)
+                       if (dinfo.dli_sname) {
                                *symbol = strdup(dinfo.dli_sname);
-                       else
+                       } else {
                                *symbol = NULL;
+                       }
                }
                break;
        }
@@ -151,8 +155,9 @@ HAPI const char *util_uri_to_path(const char *uri)
        int len;
 
        len = strlen(SCHEMA_FILE);
-       if (strncasecmp(uri, SCHEMA_FILE, len))
+       if (strncasecmp(uri, SCHEMA_FILE, len)) {
                return NULL;
+       }
 
        return uri + len;
 }
@@ -170,7 +175,7 @@ HAPI double util_time_delay_for_compensation(double period)
                return 0.0f;
        }
 
-       if (gettimeofday(&tv, NULL) < 0){
+       if (gettimeofday(&tv, NULL) < 0) {
                ErrPrint("gettimeofday: %s\n", strerror(errno));
                return period;
        }
@@ -194,8 +199,9 @@ HAPI void *util_timer_add(double interval, Eina_Bool (*cb)(void *data), void *da
        double delay;
 
        timer = ecore_timer_add(interval, cb, data);
-       if (!timer)
+       if (!timer) {
                return NULL;
+       }
 
        delay = util_time_delay_for_compensation(interval) - interval;
        ecore_timer_delay(timer, delay);