Remove compile warning messages and apply coding rule 77/61877/1 accepted/tizen/ivi/20160311.145938 accepted/tizen/mobile/20160311.142903 accepted/tizen/tv/20160311.144529 accepted/tizen/wearable/20160311.145324 submit/tizen/20160311.052741
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 11 Mar 2016 05:05:57 +0000 (14:05 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 11 Mar 2016 05:05:57 +0000 (14:05 +0900)
Change-Id: I0e7b57ab00711b5c7abc5cf7f2d664b0cbc4f1d2
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
CMakeLists.txt
alarm-manager-registry.c
alarm-manager-schedule.c
alarm-manager-timer.c
alarm-manager.c
include/alarm-internal.h
src/alarm-lib-stub.c
src/alarm-lib.c
tool/alarmmgr_add_periodic_alarm_withcb.c
tool/alarmmgr_add_reference_periodic_alarm_withcb.c
tool/alarmmgr_get_all_info.c

index 7f9c608..ce37919 100644 (file)
@@ -18,7 +18,7 @@ INCLUDE(FindPkgConfig)
 pkg_check_modules(pkgs REQUIRED ${DEPS_PKGS})
 
 FOREACH(flag ${pkgs_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag} -Wall -Wno-unused")
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag} -Wall -Werror")
 ENDFOREACH(flag)
 
 SET (${this_target}_SOURCE_FILES
index aa813aa..f5e9ce5 100644 (file)
@@ -29,7 +29,7 @@
 
 #include<glib.h>
 #include <db-util.h>
-#if !GLIB_CHECK_VERSION (2, 31, 0)
+#if !GLIB_CHECK_VERSION(2, 31, 0)
 #include <glib/gmacros.h>
 #endif
 #include"alarm.h"
@@ -252,11 +252,11 @@ bool _load_alarms_from_registry()
                    g_quark_from_string(app_unique_name);
                __alarm_info->quark_app_service_name =
                    g_quark_from_string(app_service_name);
-               __alarm_info->quark_app_service_name_mod=
+               __alarm_info->quark_app_service_name_mod =
                    g_quark_from_string(app_service_name_mod);
                __alarm_info->quark_dst_service_name =
                    g_quark_from_string(dst_service_name);
-               __alarm_info->quark_dst_service_name_mod=
+               __alarm_info->quark_dst_service_name_mod =
                    g_quark_from_string(dst_service_name_mod);
                __alarm_info->quark_bundle = g_quark_from_string(bundle);
 
index 19ffbcb..e587188 100644 (file)
@@ -32,7 +32,7 @@
 #include"alarm.h"
 #include"alarm-internal.h"
 #define WAKEUP_ALARM_APP_ID "org.tizen.alarm.ALARM"    /*alarm ui
-                                                          application's alarm's dbus_service name instead of 21 value */
+                                                         application's alarm's dbus_service name instead of 21 value */
 #define DST_TIME_DIFF 1
 
 extern __alarm_server_context_t alarm_context;
@@ -64,14 +64,14 @@ bool _init_scheduled_alarm_list()
 
 bool _add_to_scheduled_alarm_list(__alarm_info_t *__alarm_info)
 {
-/*
*     20080328. Sewook Park(sewook7.park@samsung.com)
*     When multiple alarms are expired at same time, dbus rpc call for alarm
*     ui should be invoked first.(Ui conflicting manager cannot manage the
*     different kinds of alarm popups(wake up alarm/org alarm) correctly,
*     when they are displayed at same time)So when arranging the schedule
*     alarm list, wake up alarm element is located ahead.
- */
+       /*
       * 20080328. Sewook Park(sewook7.park@samsung.com)
       * When multiple alarms are expired at same time, dbus rpc call for alarm
       * ui should be invoked first.(Ui conflicting manager cannot manage the
       * different kinds of alarm popups(wake up alarm/org alarm) correctly,
       * when they are displayed at same time)So when arranging the schedule
       * alarm list, wake up alarm element is located ahead.
       */
 
        bool prior = false;
        gint count = 0;
@@ -80,9 +80,8 @@ bool _add_to_scheduled_alarm_list(__alarm_info_t *__alarm_info)
        __scheduled_alarm_t *entry = NULL;
 
        alarm = g_malloc(sizeof(__scheduled_alarm_t));
-       if (alarm == NULL) {
+       if (alarm == NULL)
                return false;
-       }
 
        alarm->used = true;
        alarm->alarm_id = __alarm_info->alarm_id;
@@ -97,8 +96,7 @@ bool _add_to_scheduled_alarm_list(__alarm_info_t *__alarm_info)
 
        if (alarm->__alarm_info->quark_app_service_name != g_quark_from_string(WAKEUP_ALARM_APP_ID)) {
                g_scheduled_alarm_list = g_slist_append(g_scheduled_alarm_list, alarm);
-       }
-       else {
+       } else {
                for (iter = g_scheduled_alarm_list; iter != NULL; iter = g_slist_next(iter)) {
                        count++;
                        entry = iter->data;
@@ -111,8 +109,7 @@ bool _add_to_scheduled_alarm_list(__alarm_info_t *__alarm_info)
                if (!prior) {
                        g_scheduled_alarm_list = g_slist_append(g_scheduled_alarm_list, alarm);
                        ALARM_MGR_LOG_PRINT("appended : prior is %d\tcount is %d\n", prior, count);
-               }
-               else {
+               } else {
                        g_scheduled_alarm_list = g_slist_insert(g_scheduled_alarm_list, alarm, count - 1);
                        ALARM_MGR_LOG_PRINT("appended : prior is %d\tcount is %d\n", prior, count);
                }
@@ -137,9 +134,8 @@ bool _remove_from_scheduled_alarm_list(uid_t uid, alarm_id_t alarm_id)
                }
        }
 
-       if (g_slist_length(g_scheduled_alarm_list) == 0) {
+       if (g_slist_length(g_scheduled_alarm_list) == 0)
                alarm_context.c_due_time = -1;
-       }
 
        return result;
 }
@@ -166,12 +162,11 @@ static time_t __alarm_next_duetime_once(__alarm_info_t *__alarm_info)
        current_dst = duetime_tm.tm_isdst;
        duetime_tm.tm_isdst = -1;
 
-       if (start->year == 0 && start->month == 0 && start->day == 0)
-               /*any date */  {
+       if (start->year == 0 && start->month == 0 && start->day == 0) {
+               /*any date */
                due_time = mktime(&duetime_tm);
-               if (!(due_time > current_time)) {
+               if (!(due_time > current_time))
                        due_time = due_time + 60 * 60 * 24;
-               }
        } else  /*specific date*/ {
                duetime_tm.tm_year = start->year - 1900;
                duetime_tm.tm_mon = start->month - 1;
@@ -181,30 +176,29 @@ static time_t __alarm_next_duetime_once(__alarm_info_t *__alarm_info)
 
        if (due_time <= current_time) {
                ALARM_MGR_EXCEPTION_PRINT("duetime is less than or equal to current time. current_dst = %d", current_dst);
-               duetime_tm.tm_isdst = 0;        // DST off
+               duetime_tm.tm_isdst = 0; /* DST off */
 
                due_time_tmp = mktime(&duetime_tm);
                localtime_r(&due_time_tmp, &tmp_tm);
 
                ALARM_MGR_LOG_PRINT("%d:%d:%d. duetime = %d", tmp_tm.tm_hour, tmp_tm.tm_min, tmp_tm.tm_sec, due_time);
-               if (tmp_tm.tm_hour == start->hour && tmp_tm.tm_min == start->min && tmp_tm.tm_sec == start->sec ) {
+               if (tmp_tm.tm_hour == start->hour && tmp_tm.tm_min == start->min && tmp_tm.tm_sec == start->sec) {
                        due_time = due_time_tmp;
-                       ALARM_MGR_EXCEPTION_PRINT("due_time = %d",due_time);
+                       ALARM_MGR_EXCEPTION_PRINT("due_time = %d", due_time);
                }
-       }
-       else {
+       } else {
                localtime_r(&due_time, &tmp_tm);
                ALARM_MGR_LOG_PRINT("%d:%d:%d. current_dst = %d, duetime_dst = %d", tmp_tm.tm_hour, tmp_tm.tm_min, tmp_tm.tm_sec, current_dst, tmp_tm.tm_isdst);
 
                if (current_dst == 1 && tmp_tm.tm_isdst == 1 && tmp_tm.tm_hour == start->hour + 1) {
-                       // When the calculated duetime is forwarded 1hour due to DST, Adds 23hours.
+                       /* When the calculated duetime is forwarded 1hour due to DST, Adds 23hours. */
                        due_time += 60 * 60 * 23;
                        localtime_r(&due_time, &duetime_tm);
-                       ALARM_MGR_EXCEPTION_PRINT("due_time = %d",due_time);
+                       ALARM_MGR_EXCEPTION_PRINT("due_time = %d", due_time);
                }
        }
 
-       ALARM_MGR_EXCEPTION_PRINT("Final due_time = %d, %s",due_time, ctime(&due_time));
+       ALARM_MGR_EXCEPTION_PRINT("Final due_time = %d, %s", due_time, ctime(&due_time));
        return due_time;
 }
 
@@ -241,9 +235,8 @@ static time_t __alarm_next_duetime_repeat(__alarm_info_t *__alarm_info)
                due_time = mktime(&duetime_tm);
        }
 
-       while (__alarm_info->start > due_time || current_time > due_time || ((!is_time_changed) && (current_time == due_time))) {
+       while (__alarm_info->start > due_time || current_time > due_time || ((!is_time_changed) && (current_time == due_time)))
                due_time += alarm_info->mode.u_interval.interval;
-       }
 
        if (due_time - current_time < 10)
                due_time += alarm_info->mode.u_interval.interval;
@@ -276,9 +269,8 @@ static time_t __alarm_next_duetime_annually(__alarm_info_t *__alarm_info)
        duetime_tm.tm_min = start->min;
        duetime_tm.tm_sec = start->sec;
 
-       if (start->year != 0) {
+       if (start->year != 0)
                duetime_tm.tm_year = start->year - 1900;
-       }
 
        duetime_tm.tm_mon = start->month - 1;
        duetime_tm.tm_mday = start->day;
@@ -291,7 +283,6 @@ static time_t __alarm_next_duetime_annually(__alarm_info_t *__alarm_info)
        }
 
        return due_time;
-
 }
 
 static time_t __alarm_next_duetime_monthly(__alarm_info_t *__alarm_info)
@@ -309,13 +300,11 @@ static time_t __alarm_next_duetime_monthly(__alarm_info_t *__alarm_info)
        duetime_tm.tm_min = start->min;
        duetime_tm.tm_sec = start->sec;
 
-       if (start->year != 0) {
+       if (start->year != 0)
                duetime_tm.tm_year = start->year - 1900;
-       }
 
-       if (start->month != 0) {
+       if (start->month != 0)
                duetime_tm.tm_mon = start->month - 1;
-       }
 
        duetime_tm.tm_mday = start->day;
 
@@ -331,7 +320,6 @@ static time_t __alarm_next_duetime_monthly(__alarm_info_t *__alarm_info)
        }
 
        return due_time;
-
 }
 
 static time_t __alarm_next_duetime_weekly(__alarm_info_t *__alarm_info)
@@ -380,7 +368,7 @@ static time_t __alarm_next_duetime_weekly(__alarm_info_t *__alarm_info)
                localtime_r(&due_time, &tmp_tm);
 
                SECURE_LOGD("%d:%d:%d. duetime = %d", tmp_tm.tm_hour, tmp_tm.tm_min, tmp_tm.tm_sec, due_time);
-               if (tmp_tm.tm_hour != start->hour || tmp_tm.tm_min != start->min || tmp_tm.tm_sec != start->sec ) {
+               if (tmp_tm.tm_hour != start->hour || tmp_tm.tm_min != start->min || tmp_tm.tm_sec != start->sec) {
                        duetime_tm.tm_hour = start->hour;
                        duetime_tm.tm_min = start->min;
                        duetime_tm.tm_sec = start->sec;
@@ -388,17 +376,16 @@ static time_t __alarm_next_duetime_weekly(__alarm_info_t *__alarm_info)
                        due_time = mktime(&duetime_tm);
                        ALARM_MGR_LOG_PRINT("due_time = %d", due_time);
                }
-       }
-       else {
+       } else {
                if (current_dst == 1 && tmp_tm.tm_isdst == 1 && tmp_tm.tm_hour == start->hour + 1) {
-                       // When the calculated duetime is forwarded 1hour due to DST, Adds 23hours.
+                       /* When the calculated duetime is forwarded 1hour due to DST, Adds 23hours. */
                        due_time += 60 * 60 * 23;
                        localtime_r(&due_time, &duetime_tm);
                        ALARM_MGR_LOG_PRINT("due_time = %d", due_time);
                }
        }
 
-       // Gets the dst before calculating the duedate as interval
+       /* Gets the dst before calculating the duedate as interval */
        localtime_r(&due_time, &before_tm);
        SECURE_LOGD("before_dst = %d", before_tm.tm_isdst);
 
@@ -408,42 +395,38 @@ static time_t __alarm_next_duetime_weekly(__alarm_info_t *__alarm_info)
 
        /* CQ defect(72810) : only one time alarm function is not working
           under all recurrence_disabled. */
-       if (due_time > current_time && mode->u_interval.day_of_week == 0) {
+       if (due_time > current_time && mode->u_interval.day_of_week == 0)
                return due_time;
-       }
 
        if (current_time > due_time || !(mode->u_interval.day_of_week & 1 << wday) || ((!is_time_changed) && (current_time == due_time))) {
                int day = wday + 1;
                int interval = 1;
                /*this week */
 
-               if (day == 7) {
+               if (day == 7)
                        day = 0;
-               }
 
                while (!(mode->u_interval.day_of_week & 1 << day) && interval < 8) {
                        day += 1;
                        interval += 1;
 
-                       if (day == 7) {
+                       if (day == 7)
                                day = 0;
-                       }
                }
 
                ALARM_MGR_LOG_PRINT("interval : %d\n", interval);
                due_time += 60 * 60 * 24 * interval;
        }
 
-       // Gets the dst after calculating the duedate as interval
+       /* Gets the dst after calculating the duedate as interval */
        localtime_r(&due_time, &after_tm);
        SECURE_LOGD("after_dst = %d", after_tm.tm_isdst);
 
-       // Revise the duetime as difference in tm_isdst
-       if (before_tm.tm_isdst == 1 && after_tm.tm_isdst == 0) {
-               due_time += 60 * 60;    // Add an hour
-       } else if (before_tm.tm_isdst == 0 && after_tm.tm_isdst == 1) {
-               due_time -= 60 * 60;    // Subtract an hour
-       }
+       /* Revise the duetime as difference in tm_isdst */
+       if (before_tm.tm_isdst == 1 && after_tm.tm_isdst == 0)
+               due_time += 60 * 60;    /* Add an hour */
+       else if (before_tm.tm_isdst == 0 && after_tm.tm_isdst == 1)
+               due_time -= 60 * 60;    /* Subtract an hour */
 
        ALARM_MGR_LOG_PRINT("Final due_time = %d", due_time);
        return due_time;
@@ -451,7 +434,7 @@ static time_t __alarm_next_duetime_weekly(__alarm_info_t *__alarm_info)
 
 time_t _alarm_next_duetime(__alarm_info_t *__alarm_info)
 {
-       int is_dst=0;
+       int is_dst = 0;
        time_t current_time = 0;
        time_t due_time = 0;
        struct tm *cur_tm = NULL ;
@@ -479,18 +462,18 @@ time_t _alarm_next_duetime(__alarm_info_t *__alarm_info)
                due_time = __alarm_next_duetime_weekly(__alarm_info);
        } else {
                ALARM_MGR_EXCEPTION_PRINT("repeat mode(%d) is wrong\n",
-                                         mode->repeat);
+                               mode->repeat);
                return 0;
        }
 
        if (mode->repeat != ALARM_REPEAT_MODE_WEEKLY && mode->repeat != ALARM_REPEAT_MODE_ONCE) {
                due_tm = localtime(&due_time);
-               if (is_dst==0 && due_tm && due_tm->tm_isdst==1){
-                               ALARM_MGR_LOG_PRINT("DST alarm found, enable\n");
-                               due_tm->tm_hour = due_tm->tm_hour - DST_TIME_DIFF;
-               } else if (is_dst==1 && due_tm && due_tm->tm_isdst==0){
-                               ALARM_MGR_LOG_PRINT("DST alarm found. disable\n");
-                               due_tm->tm_hour = due_tm->tm_hour + DST_TIME_DIFF;
+               if (is_dst == 0 && due_tm && due_tm->tm_isdst == 1) {
+                       ALARM_MGR_LOG_PRINT("DST alarm found, enable\n");
+                       due_tm->tm_hour = due_tm->tm_hour - DST_TIME_DIFF;
+               } else if (is_dst == 1 && due_tm && due_tm->tm_isdst == 0) {
+                       ALARM_MGR_LOG_PRINT("DST alarm found. disable\n");
+                       due_tm->tm_hour = due_tm->tm_hour + DST_TIME_DIFF;
                }
                if (due_tm)
                        due_time = mktime(due_tm);
@@ -519,14 +502,14 @@ static bool __find_next_alarm_to_be_scheduled(time_t *min_due_time)
        time(&current_time);
 
        for (iter = alarm_context.alarms; iter != NULL;
-            iter = g_slist_next(iter)) {
+                       iter = g_slist_next(iter)) {
                entry = iter->data;
                due_time = entry->due_time;
 
                double interval = 0;
 
                SECURE_LOGD("alarm[%d] with duetime(%u) at current(%u) pid: (%d)\n",
-                       entry->alarm_id, due_time, current_time, entry->pid);
+                               entry->alarm_id, due_time, current_time, entry->pid);
                if (due_time == 0)      /*0 means this alarm has been disabled*/ {
                        continue;
                }
@@ -540,10 +523,8 @@ static bool __find_next_alarm_to_be_scheduled(time_t *min_due_time)
 
                interval = difftime(due_time, min_time);
 
-               if ((interval < 0) || min_time == -1) {
+               if ((interval < 0) || min_time == -1)
                        min_time = due_time;
-               }
-
        }
 
        *min_due_time = min_time;
@@ -566,9 +547,8 @@ bool _alarm_schedule()
                        entry = iter->data;
                        due_time = entry->due_time;
 
-                       if (due_time == min_time) {
+                       if (due_time == min_time)
                                _add_to_scheduled_alarm_list(entry);
-                       }
                }
                _alarm_set_timer(&alarm_context, alarm_context.timer, min_time);
        }
index 745788d..60dbc72 100644 (file)
@@ -1,10 +1,5 @@
 /*
- *  alarm-manager
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Venkatesha Sarpangala <sarpangala.v@samsung.com>, Jayoun Lee <airjany@samsung.com>,
- * Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
+ * Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,7 +12,6 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
  */
 
 #include <stdio.h>
@@ -28,7 +22,6 @@
 #include <sys/types.h>
 #include <errno.h>
 #include <sys/timerfd.h>
-
 #include <glib.h>
 
 #include "alarm.h"
@@ -85,8 +78,7 @@ bool _alarm_set_timer(__alarm_server_context_t *alarm_context, int timer, time_t
                g_dummy_timer_is_set = true;
                strftime(due_time_r, 30, "%c", &ts_ret);
                ALARM_MGR_LOG_PRINT("create dummy alarm timer(%d), due_time(%s)", timer, due_time_r);
-       }
-       else {
+       } else {
                g_dummy_timer_is_set = false;
        }
 
index 4916f8a..72b7b38 100644 (file)
@@ -1,10 +1,5 @@
 /*
- *  alarm-manager
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Venkatesha Sarpangala <sarpangala.v@samsung.com>, Jayoun Lee <airjany@samsung.com>,
- * Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
+ * Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,7 +12,6 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
  */
 
 #define _GNU_SOURCE
@@ -47,7 +41,7 @@
 #include <eventsystem.h>
 
 #include <glib.h>
-#if !GLIB_CHECK_VERSION (2, 31, 0)
+#if !GLIB_CHECK_VERSION(2, 31, 0)
 #include <glib/gmacros.h>
 #endif
 
@@ -59,8 +53,8 @@
 
 #define SIG_TIMER 0x32
 #define WAKEUP_ALARM_APP_ID       "org.tizen.alarm.ALARM"
-       /* alarm ui application's alarm's dbus_service name instead of 21
         (alarm application's app_id) value */
+/* alarm ui application's alarm's dbus_service name instead of 21
* (alarm application's app_id) value */
 
 __alarm_server_context_t alarm_context;
 bool g_dummy_timer_is_set = FALSE;
@@ -72,10 +66,11 @@ GSList *g_expired_alarm_list = NULL;
 #define RTC_WKALM_BOOT_SET _IOW('p', 0x80, struct rtc_wkalrm)
 #endif
 
-/*     2008. 6. 3 sewook7.park
-       When the alarm becoms sleeping mode, alarm timer is not expired.
-       So using RTC, phone is awaken before alarm rings.
-*/
+/*
+ * 2008. 6. 3 sewook7.park
+ * When the alarm becoms sleeping mode, alarm timer is not expired.
+ * So using RTC, phone is awaken before alarm rings.
+ */
 #define __WAKEUP_USING_RTC__
 #ifdef __WAKEUP_USING_RTC__
 #include <errno.h>
@@ -95,7 +90,7 @@ static int log_index = 0;
 static int log_fd = 0;
 #endif
 
-// display lock and unlock
+/* display lock and unlock */
 #define DEVICED_BUS_NAME "org.tizen.system.deviced"
 #define DEVICED_PATH_DISPLAY           "/Org/Tizen/System/DeviceD/Display"
 #define DEVICED_INTERFACE_DISPLAY      "org.tizen.system.deviced.display"
@@ -106,14 +101,14 @@ static int log_fd = 0;
 #define DEVICED_STAY_CUR_STATE "staycurstate"
 #define DEVICED_SLEEP_MARGIN           "sleepmargin"
 
-// link path for timezone info
+/* link path for timezone info */
 #define TIMEZONE_INFO_LINK_PATH        tzplatform_mkpath(TZ_SYS_ETC, "localtime")
 
 static const char default_rtc[] = "/dev/rtc";
 
 static int gfd = -1;
 
-#endif                         /*__WAKEUP_USING_RTC__*/
+#endif /*__WAKEUP_USING_RTC__*/
 
 /*  GDBus Declaration */
 #define ALARM_MGR_DBUS_PATH    "/org/tizen/alarm/manager"
@@ -122,9 +117,9 @@ GDBusObjectManagerServer *alarmmgr_server = NULL;
 static AlarmManager* interface = NULL;
 
 sqlite3 *alarmmgr_db;
-bool is_time_changed = false;  // for calculating next duetime
+bool is_time_changed = false; /* for calculating next duetime */
 
-#define BILLION 1000000000     // for calculating nano seconds
+#define BILLION 1000000000 /* for calculating nano seconds */
 static time_t periodic_alarm_standard_time = 0;
 
 static bool __alarm_add_to_list(__alarm_info_t *__alarm_info);
@@ -150,8 +145,6 @@ static bool __alarm_update(uid_t uid, int pid, char *app_service_name, alarm_id_
 static void __alarm_send_noti_to_application(const char *app_service_name, alarm_id_t alarm_id);
 static void __alarm_expired();
 static gboolean __alarm_handler_idle(gpointer user_data);
-static void __clean_registry();
-static bool __alarm_manager_reset();
 static void __on_system_time_external_changed(keynode_t *node, void *data);
 static void __initialize_timer();
 static void __initialize_alarm_list();
@@ -162,7 +155,7 @@ static bool __initialize_dbus();
 static bool __initialize_db();
 static void __initialize();
 void on_bus_name_owner_changed(GDBusConnection *connection, const gchar *sender_name, const gchar *object_path,
-             const gchar *interface_name, const gchar *signal_name, GVariant *parameters, gpointer user_data);
+               const gchar *interface_name, const gchar *signal_name, GVariant *parameters, gpointer user_data);
 bool __get_caller_unique_name(int pid, char *unique_name, uid_t uid);
 
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
@@ -175,8 +168,7 @@ int __display_unlock_state(char *state, char *flag);
 
 int __set_time(time_t _time);
 
-struct filtered_alarm_app_s
-{
+struct filtered_alarm_app_s {
        int is_ui_app;
        uid_t uid;
 };
@@ -186,11 +178,10 @@ static void __rtc_set()
 #ifdef __WAKEUP_USING_RTC__
        const char *rtc = default_rtc;
        struct tm due_tm;
-       struct timespec alarm_time;
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
        char log_message[ALARMMGR_LOG_MESSAGE_SIZE] = {0,};
 #endif
-#ifdef _SIMUL  // RTC does not work in simulator.
+#ifdef _SIMUL /* RTC does not work in simulator. */
        ALARM_MGR_EXCEPTION_PRINT("because it is simulator's mode, we don't set RTC.");
        return;
 #endif
@@ -208,7 +199,7 @@ static void __rtc_set()
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
        char *timebuf = ctime(&alarm_context.c_due_time);
        if (timebuf) {
-               timebuf[strlen(timebuf) - 1] = '\0';    // to avoid new line
+               timebuf[strlen(timebuf) - 1] = '\0'; /* to avoid new line */
                snprintf(log_message, sizeof(log_message), "wakeup time: %d, %s", (int)alarm_context.c_due_time, timebuf);
        }
 #endif
@@ -227,9 +218,9 @@ static void __rtc_set()
 
                retval = ioctl(gfd, RTC_WKALM_SET, &rtc_wkalarm);
                if (retval == -1) {
-                       if (errno == ENOTTY) {
+                       if (errno == ENOTTY)
                                ALARM_MGR_EXCEPTION_PRINT("Alarm IRQs is not supported.");
-                       }
+
                        ALARM_MGR_EXCEPTION_PRINT("RTC_WKALM_SET disabled ioctl is failed. errno = %s", strerror(errno));
                        return;
                }
@@ -251,9 +242,9 @@ static void __rtc_set()
                rtc_wkalarm.time.tm_sec = due_tm.tm_sec - 1; /* Wakeup is 1000ms faster than expiring time to correct RTC error. */
                retval = ioctl(gfd, RTC_WKALM_SET, &rtc_wkalarm);
                if (retval == -1) {
-                       if (errno == ENOTTY) {
+                       if (errno == ENOTTY)
                                ALARM_MGR_EXCEPTION_PRINT("Alarm IRQs is not supported.");
-                       }
+
                        ALARM_MGR_EXCEPTION_PRINT("RTC ALARM_SET ioctl is failed. errno = %s", strerror(errno));
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
                        __save_module_log("FAIL: SET RTC", log_message);
@@ -264,18 +255,17 @@ static void __rtc_set()
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
                __save_module_log("SET RTC", log_message);
 #endif
-       }
-       else {
+       } else {
                ALARM_MGR_EXCEPTION_PRINT("[alarm-server]alarm_context.c_due_time is"
                        "less than 10 sec. RTC alarm does not need to be set");
        }
-#endif                         /* __WAKEUP_USING_RTC__ */
+#endif /* __WAKEUP_USING_RTC__ */
        return;
 }
 
 int __set_time(time_t _time)
 {
-       // Using /dev/alarm, this function changes both OS time and RTC.
+       /* Using /dev/alarm, this function changes both OS time and RTC. */
        int ret = 0;
        const char *rtc0 = default_rtc;
        struct rtc_time _rtc_time;
@@ -321,19 +311,18 @@ int __set_time(time_t _time)
        ret = ioctl(gfd, RTC_SET_TIME, &_rtc_time);
        if (ret == -1) {
                ALARM_MGR_EXCEPTION_PRINT("ALARM_SET_RTC ioctl is failed. errno = %s", strerror(errno));
-       #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
+#ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
                strncpy(log_tag, "FAIL: SET RTC", strlen("FAIL: SET RTC"));
-       #endif
+#endif
                perror("\t");
        }
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
-       else {
+       else
                strncpy(log_tag, "SET RTC", strlen("SET RTC"));
-       }
 
        char *timebuf = ctime(&_time);
        if (timebuf) {
-               timebuf[strlen(timebuf) - 1] = '\0';    // to avoid new line
+               timebuf[strlen(timebuf) - 1] = '\0'; /* to avoid new line */
                snprintf(log_message, sizeof(log_message), "RTC & OS =%d, %s", (int)_time, timebuf);
        }
 
@@ -388,16 +377,15 @@ static bool __alarm_add_to_list(__alarm_info_t *__alarm_info)
        alarm_context.alarms = g_slist_append(alarm_context.alarms, __alarm_info);
        ALARM_MGR_LOG_PRINT("[alarm-server]: After add alarm_id(%d)", __alarm_info->alarm_id);
 
-       // alarm list
+       /* alarm list */
        for (iter = alarm_context.alarms; iter != NULL; iter = g_slist_next(iter)) {
                entry = iter->data;
                ALARM_MGR_LOG_PRINT("[alarm-server]: alarm_id(%d).", entry->alarm_id);
        }
 
        if (!(alarm_info->alarm_type & ALARM_TYPE_VOLATILE)) {
-               if (!_save_alarms(__alarm_info)) {
+               if (!_save_alarms(__alarm_info))
                        ALARM_MGR_EXCEPTION_PRINT("Saving alarm_id(%d) in DB is failed.", __alarm_info->alarm_id);
-               }
        }
 
        return true;
@@ -434,9 +422,8 @@ static bool __alarm_update_in_list(__alarm_info_t *__alarm_info,
        }
 
        if (!(alarm_info->alarm_type & ALARM_TYPE_VOLATILE)) {
-               if (!_update_alarms(__alarm_info)) {
+               if (!_update_alarms(__alarm_info))
                        ALARM_MGR_EXCEPTION_PRINT("Updating alarm_id(%d) in DB is failed.", __alarm_info->alarm_id);
-               }
        }
 
        return true;
@@ -462,9 +449,8 @@ static bool __alarm_remove_from_list(uid_t uid, alarm_id_t alarm_id,
 
                        ALARM_MGR_LOG_PRINT("[alarm-server]:Remove alarm id(%d)", entry->alarm_id);
 
-                       if (!(alarm_info->alarm_type & ALARM_TYPE_VOLATILE)) {
+                       if (!(alarm_info->alarm_type & ALARM_TYPE_VOLATILE))
                                _delete_alarms(alarm_id);
-                       }
 
                        alarm_context.alarms = g_slist_remove(alarm_context.alarms, iter->data);
                        g_free(entry);
@@ -595,9 +581,8 @@ gboolean __update_relative_alarms(gpointer user_data)
        for (iter = alarm_context.alarms; iter != NULL; iter = g_slist_next(iter)) {
                entry = iter->data;
                alarm_info_t *alarm_info = &(entry->alarm_info);
-               if (alarm_info->alarm_type & ALARM_TYPE_RELATIVE) {
+               if (alarm_info->alarm_type & ALARM_TYPE_RELATIVE)
                        _update_alarms(entry);
-               }
        }
 
        if (sqlite3_exec(alarmmgr_db, "COMMIT", NULL, NULL, &error_message) != SQLITE_OK) {
@@ -684,9 +669,8 @@ static bool __alarm_update_due_time_of_all_items_in_list(double diff_time)
 
                interval = difftime(due_time, min_time);
 
-               if ((interval < 0) || min_time == -1) {
+               if ((interval < 0) || min_time == -1)
                        min_time = due_time;
-               }
        }
 
        is_time_changed = false;
@@ -736,31 +720,29 @@ static bool __alarm_create_appsvc(alarm_info_t *alarm_info, alarm_id_t *alarm_id
        }
        __alarm_info->quark_app_unique_name = g_quark_from_string(app_name);
 
-       // Get caller_appid and callee_appid to get each package id
-       // caller
+       /* Get caller_appid and callee_appid to get each package id */
+       /* caller */
        __alarm_info->quark_caller_pkgid = g_quark_from_string("null");
 
        if (aul_app_get_appid_bypid_for_uid(pid, caller_appid, 256, uid) == AUL_R_OK) {
                if (pkgmgrinfo_appinfo_get_usr_appinfo(caller_appid, uid, &caller_handle) == PMINFO_R_OK) {
                        if (pkgmgrinfo_appinfo_get_pkgid(caller_handle, &caller_pkgid) == PMINFO_R_OK) {
-                               if (caller_pkgid) {
+                               if (caller_pkgid)
                                        __alarm_info->quark_caller_pkgid = g_quark_from_string(caller_pkgid);
-                               }
                        }
                        pkgmgrinfo_appinfo_destroy_appinfo(caller_handle);
                }
        }
 
-       // callee
+       /* callee */
        __alarm_info->quark_callee_pkgid = g_quark_from_string("null");
 
        b = bundle_decode((bundle_raw *)bundle_data, strlen(bundle_data));
        callee_appid = appsvc_get_appid(b);
        if (pkgmgrinfo_appinfo_get_usr_appinfo(callee_appid, uid, &callee_handle) == PMINFO_R_OK) {
                if (pkgmgrinfo_appinfo_get_pkgid(callee_handle, &callee_pkgid) == PMINFO_R_OK) {
-                       if (callee_pkgid) {
+                       if (callee_pkgid)
                                __alarm_info->quark_callee_pkgid = g_quark_from_string(callee_pkgid);
-                       }
                }
                pkgmgrinfo_appinfo_destroy_appinfo(callee_handle);
        }
@@ -867,13 +849,12 @@ static bool __alarm_create(alarm_info_t *alarm_info, alarm_id_t *alarm_id, uid_t
        __alarm_info->is_ref = is_ref;
        __alarm_info->global = false;
 
-       // Get caller_appid to get caller's package id. There is no callee.
+       /* Get caller_appid to get caller's package id. There is no callee. */
        if (aul_app_get_appid_bypid_for_uid(pid, caller_appid, 256, uid) == AUL_R_OK) {
                if (pkgmgrinfo_appinfo_get_usr_appinfo(caller_appid, uid, &caller_handle) == PMINFO_R_OK) {
                        if (pkgmgrinfo_appinfo_get_pkgid(caller_handle, &caller_pkgid) == PMINFO_R_OK) {
-                               if (caller_pkgid) {
+                               if (caller_pkgid)
                                        __alarm_info->quark_caller_pkgid = g_quark_from_string(caller_pkgid);
-                               }
                        }
                        pkgmgrinfo_appinfo_destroy_appinfo(caller_handle);
                }
@@ -1010,9 +991,9 @@ static bool __alarm_update(uid_t uid, int pid, char *app_service_name, alarm_id_
 
                __rtc_set();
 
-               if (due_time == 0) {
+               if (due_time == 0)
                        ALARM_MGR_EXCEPTION_PRINT("[alarm-server]:Update alarm: due_time is 0.");
-               }
+
                free(__alarm_info);
                return true;
        }
@@ -1028,7 +1009,7 @@ static bool __alarm_update(uid_t uid, int pid, char *app_service_name, alarm_id_
                due_time);
                free(__alarm_info);
                return true;
-       } else if (difftime(due_time, current_time)< 0) {
+       } else if (difftime(due_time, current_time) < 0) {
                ALARM_MGR_EXCEPTION_PRINT("[alarm-server]: Expired Due Time.[Due time=%d, Current Time=%d]!!!Do not add to schedule list\n", due_time, current_time);
                free(__alarm_info);
                return true;
@@ -1138,9 +1119,8 @@ static bool __can_skip_expired_cb(alarm_id_t alarm_id)
                        from = (ts / dur) * dur;
                        to = from + dur;
 
-                       if ( ts >= from && ts < to && from > ts - alarm->mode.u_interval.interval) {
+                       if (ts >= from && ts < to && from > ts - alarm->mode.u_interval.interval)
                                return false;
-                       }
 
                        return true;
                }
@@ -1209,19 +1189,19 @@ static int __get_caller_pid(const char *name)
        GVariant *ret;
        GError *error = NULL;
 
-       ret = g_dbus_connection_call_sync (alarm_context.connection,
-                                          "org.freedesktop.DBus",
-                                          "/org/freedesktop/DBus",
-                                          "org.freedesktop.DBus",
-                                          "GetConnectionUnixProcessID",
-                                          g_variant_new ("(s)", name),
-                                          NULL,
-                                          G_DBUS_CALL_FLAGS_NONE,
-                                          -1,
-                                          NULL,
-                                          &error);
-       g_variant_get (ret, "(u)", &pid);
-       g_variant_unref (ret);
+       ret = g_dbus_connection_call_sync(alarm_context.connection,
+                                       "org.freedesktop.DBus",
+                                       "/org/freedesktop/DBus",
+                                       "org.freedesktop.DBus",
+                                       "GetConnectionUnixProcessID",
+                                       g_variant_new("(s)", name),
+                                       NULL,
+                                       G_DBUS_CALL_FLAGS_NONE,
+                                       -1,
+                                       NULL,
+                                       &error);
+       g_variant_get(ret, "(u)", &pid);
+       g_variant_unref(ret);
 
        return pid;
 }
@@ -1236,17 +1216,15 @@ static int __is_ui_app(const char *appid, uid_t uid)
 
        ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, uid, &appinfo_h);
 
-       if (ret < 0 ) {
+       if (ret < 0)
                return 0;
-       }
 
        char *component = NULL;
        int found = 0;
 
        ret = pkgmgrinfo_appinfo_get_component_type(appinfo_h, &component);
-       if (ret == 0 && component != NULL && strncmp(component, "uiapp", 5) == 0) {
+       if (ret == 0 && component != NULL && strncmp(component, "uiapp", 5) == 0)
                found = 1;
-       }
 
        if (appinfo_h)
                pkgmgrinfo_appinfo_destroy_appinfo(appinfo_h);
@@ -1254,27 +1232,8 @@ static int __is_ui_app(const char *appid, uid_t uid)
        return found;
 }
 
-static int __iter_fn(const char* appid, void *data)
+static int __compare_api_version(int *result, int pid, uid_t uid)
 {
-       struct filtered_alarm_app_s *app = data;
-
-       if (__is_ui_app(appid, app->uid)) {
-               app->is_ui_app = 1;
-               return 1;
-       }
-
-       return 0;
-}
-
-static int __have_ui_apps(bundle *b, uid_t uid)
-{
-       struct filtered_alarm_app_s app;
-       app.uid = uid;
-       appsvc_usr_get_list(b, __iter_fn, &app, uid);
-       return app.is_ui_app;
-}
-
-static int __compare_api_version(int *result, int pid, uid_t uid) {
        int ret = 0;
        pkgmgrinfo_pkginfo_h pkginfo = NULL;
        char pkgid[512] = {0, };
@@ -1288,9 +1247,8 @@ static int __compare_api_version(int *result, int pid, uid_t uid) {
                        ALARM_MGR_EXCEPTION_PRINT("Failed to get pkginfo\n");
                } else {
                        ret = pkgmgrinfo_pkginfo_get_api_version(pkginfo, &pkg_version);
-                       if (ret != PMINFO_R_OK) {
+                       if (ret != PMINFO_R_OK)
                                ALARM_MGR_EXCEPTION_PRINT("Failed to check api version [%d]\n", ret);
-                       }
                        *result = strverscmp(pkg_version, "2.4");
                        pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo);
                }
@@ -1333,7 +1291,7 @@ static void __alarm_expired()
        alarm_id_t alarm_id = -1;
        int app_pid = 0;
        __alarm_info_t *__alarm_info = NULL;
-       char alarm_id_val[32]={0,};
+       char alarm_id_val[32];
        int b_len = 0;
        bundle *b = NULL;
        char *appid = NULL;
@@ -1361,7 +1319,7 @@ static void __alarm_expired()
                        alarm_context.c_due_time - current_time);
                goto done;
        }
-       // 10 seconds is maximum permitted delay from timer expire to this function
+       /* 10 seconds is maximum permitted delay from timer expire to this function */
        if (alarm_context.c_due_time + 10 < current_time) {
                ALARM_MGR_EXCEPTION_PRINT("[alarm-server]: False Alarm. due time is (%d) seconds past.",
                        current_time - alarm_context.c_due_time);
@@ -1377,25 +1335,21 @@ static void __alarm_expired()
                __alarm_info = alarm->__alarm_info;
                app_pid = __alarm_info->pid;
 
-               // Case #1. The process is an application launched by app_control.
-               // It registered an alarm using launch-based APIs like alarm_schedule_xxx, alarmmgr_xxx_appsvc.
+               /* Case #1. The process is an application launched by app_control.
+                * It registered an alarm using launch-based APIs like alarm_schedule_xxx, alarmmgr_xxx_appsvc. */
                if (strncmp(g_quark_to_string(__alarm_info->quark_bundle), "null", 4) != 0) {
                        b_len = strlen(g_quark_to_string(__alarm_info->quark_bundle));
 
                        b = bundle_decode((bundle_raw *)g_quark_to_string(__alarm_info->quark_bundle), b_len);
 
-                       if (b == NULL)
-                       {
+                       if (b == NULL) {
                                ALARM_MGR_EXCEPTION_PRINT("Error!!!..Unable to decode the bundle!!\n");
-                       }
-                       else
-                       {
-                               snprintf(alarm_id_val,31,"%d",alarm_id);
+                       } else {
+                               snprintf(alarm_id_val, sizeof(alarm_id_val), "%d", alarm_id);
 
-                               if (bundle_add_str(b,"http://tizen.org/appcontrol/data/alarm_id", alarm_id_val)){
+                               if (bundle_add_str(b, "http://tizen.org/appcontrol/data/alarm_id", alarm_id_val)) {
                                        ALARM_MGR_EXCEPTION_PRINT("Unable to add alarm id to the bundle\n");
-                               }
-                               else {
+                               } else {
                                        int result = 0;
 
                                        if (__compare_api_version(&result, app_pid, __alarm_info->uid) < 0) {
@@ -1403,19 +1357,19 @@ static void __alarm_expired()
                                                result = -1;
                                        }
 
-                                       if (result < 0) { /* before 2.4 */
-                                               if ( appsvc_usr_run_service(b, 0, NULL, NULL, __alarm_info->uid) < 0) {
+                                       if (result < 0) {
+                                               /* before 2.4 */
+                                               if (appsvc_usr_run_service(b, 0, NULL, NULL, __alarm_info->uid) < 0)
                                                        ALARM_MGR_EXCEPTION_PRINT("Unable to run app svc\n");
-                                               }
-                                               else {
+                                               else
                                                        ALARM_MGR_LOG_PRINT("Successfuly run app svc\n");
-                                               }
-                                       } else { /* since 2.4 */
+                                       } else {
+                                               /* since 2.4 */
                                                appid = (char *)appsvc_get_appid(b);
-                                               if( (__alarm_info->alarm_info.alarm_type & ALARM_TYPE_NOLAUNCH) && !aul_app_is_running(appid))  {
+                                               if ((__alarm_info->alarm_info.alarm_type & ALARM_TYPE_NOLAUNCH) && !aul_app_is_running(appid)) {
                                                        ALARM_MGR_EXCEPTION_PRINT("This alarm is ignored\n");
-                                               } else if ( !(__alarm_info->alarm_info.alarm_type & ALARM_TYPE_INEXACT) ||
-                                                               !__can_skip_expired_cb(__alarm_info->alarm_id) ) {
+                                               } else if (!(__alarm_info->alarm_info.alarm_type & ALARM_TYPE_INEXACT) ||
+                                                               !__can_skip_expired_cb(__alarm_info->alarm_id)) {
                                                        if (__alarm_info->global) {
                                                                if (__find_login_user(&target_uid) < 0) {
                                                                        ALARM_MGR_EXCEPTION_PRINT("Fail to get login user\n");
@@ -1429,21 +1383,17 @@ static void __alarm_expired()
 
                                                        if (ret < 0) {
                                                                ALARM_MGR_EXCEPTION_PRINT("Unable to launch app [%s] \n", appid);
-                                                       }
-                                                       else {
+                                                       } else {
                                                                ALARM_MGR_LOG_PRINT("Successfuly ran app svc\n");
-                                                               if (__is_ui_app(appid, __alarm_info->uid)) {
+                                                               if (__is_ui_app(appid, __alarm_info->uid))
                                                                        device_display_change_state(DISPLAY_STATE_NORMAL);
-                                                               }
                                                        }
                                                }
                                        }
                                }
                                bundle_free(b);
                        }
-               }
-               else
-               {
+               } else {
                        char appid[MAX_SERVICE_NAME_LEN] = { 0, };
                        pkgmgrinfo_appinfo_h appinfo_handle = NULL;
 
@@ -1471,8 +1421,8 @@ static void __alarm_expired()
                                                                "/org/freedesktop/DBus",
                                                                "org.freedesktop.DBus",
                                                                "NameHasOwner",
-                                                               g_variant_new ("(s)", destination_app_service_name),
-                                                               G_VARIANT_TYPE ("(b)"),
+                                                               g_variant_new("(s)", destination_app_service_name),
+                                                               G_VARIANT_TYPE("(b)"),
                                                                G_DBUS_CALL_FLAGS_NONE,
                                                                -1,
                                                                NULL,
@@ -1481,7 +1431,7 @@ static void __alarm_expired()
                                ALARM_MGR_EXCEPTION_PRINT("g_dbus_connection_call_sync() is failed. err: %s", error->message);
                                g_error_free(error);
                        } else {
-                               g_variant_get (result, "(b)", &name_has_owner_reply);
+                               g_variant_get(result, "(b)", &name_has_owner_reply);
                        }
 
                        if (g_quark_to_string(__alarm_info->quark_dst_service_name) != NULL && strncmp(g_quark_to_string(__alarm_info->quark_dst_service_name), "null", 4) == 0) {
@@ -1495,8 +1445,8 @@ static void __alarm_expired()
                        ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, __alarm_info->uid, &appinfo_handle);
                        ALARM_MGR_LOG_PRINT("appid : %s (%x)", appid, appinfo_handle);
 
-                       // Case #2. The process was killed && App type
-                       // This app is launched and owner of DBus connection is changed. and then, expiration noti is sent by DBus.
+                       /* Case #2. The process was killed && App type
+                        * This app is launched and owner of DBus connection is changed. and then, expiration noti is sent by DBus. */
                        if (name_has_owner_reply == false && ret == PMINFO_R_OK) {
                                __expired_alarm_t *expire_info;
                                char alarm_id_str[32] = { 0, };
@@ -1525,25 +1475,24 @@ static void __alarm_expired()
                                bundle_add_str(kb, "__ALARM_MGR_ID", alarm_id_str);
 
                                if (__alarm_info->global) {
-                                       if (__find_login_user(&target_uid) < 0) {
+                                       if (__find_login_user(&target_uid) < 0)
                                                ALARM_MGR_EXCEPTION_PRINT("Fail to get login user\n");
-                                       } else {
-                                               aul_launch_app_for_uid(appid, kb, target_uid);  // on_bus_name_owner_changed will be called.
-                                       }
+                                       else
+                                               aul_launch_app_for_uid(appid, kb, target_uid); /* on_bus_name_owner_changed will be called. */
                                } else {
-                                       aul_launch_app_for_uid(appid, kb, __alarm_info->uid);   // on_bus_name_owner_changed will be called.
+                                       aul_launch_app_for_uid(appid, kb, __alarm_info->uid); /* on_bus_name_owner_changed will be called. */
                                }
 
                                bundle_free(kb);
                        } else {
-                               // Case #3. The process is alive or was killed && non-app type(daemon)
-                               // Expiration noti is sent by DBus. it makes the process alive. (dbus auto activation)
+                               /* Case #3. The process is alive or was killed && non-app type(daemon)
+                                * Expiration noti is sent by DBus. it makes the process alive. (dbus auto activation) */
                                ALARM_MGR_LOG_PRINT("before alarm_send_noti_to_application");
                                ALARM_MGR_LOG_PRINT("WAKEUP pid: %d", __alarm_info->pid);
 
                                /* TODO: implement aul_update_freezer_status */
-                               //aul_update_freezer_status(__alarm_info->pid, "wakeup");
-                               __alarm_send_noti_to_application(destination_app_service_name, alarm_id);       // dbus auto activation
+                               /* aul_update_freezer_status(__alarm_info->pid, "wakeup"); */
+                               __alarm_send_noti_to_application(destination_app_service_name, alarm_id); /* dbus auto activation */
                                ALARM_MGR_LOG_PRINT("after __alarm_send_noti_to_application");
                        }
                }
@@ -1555,14 +1504,13 @@ static void __alarm_expired()
                __save_module_log("EXPIRED", log_message);
 #endif
 
-               if (__alarm_info->alarm_info.mode.repeat == ALARM_REPEAT_MODE_ONCE) {
+               if (__alarm_info->alarm_info.mode.repeat == ALARM_REPEAT_MODE_ONCE)
                        __alarm_remove_from_list(__alarm_info->uid, alarm_id, NULL);
-               } else {
+               else
                        _alarm_next_duetime(__alarm_info);
-               }
        }
 
- done:
+done:
        _clear_scheduled_alarm_list();
        alarm_context.c_due_time = -1;
 
@@ -1586,14 +1534,12 @@ static gboolean __alarm_handler_idle(gpointer user_data)
        }
 
        ALARM_MGR_LOG_PRINT("Lock the display not to enter LCD OFF");
-       if (__display_lock_state(DEVICED_LCD_OFF, DEVICED_STAY_CUR_STATE, 0) != ALARMMGR_RESULT_SUCCESS) {
+       if (__display_lock_state(DEVICED_LCD_OFF, DEVICED_STAY_CUR_STATE, 0) != ALARMMGR_RESULT_SUCCESS)
                ALARM_MGR_EXCEPTION_PRINT("__display_lock_state() is failed");
-       }
 
        if (g_dummy_timer_is_set == true) {
                ALARM_MGR_LOG_PRINT("dummy alarm timer has expired.");
-       }
-       else {
+       } else {
                ALARM_MGR_LOG_PRINT("__alarm_handler_idle");
                __alarm_expired();
        }
@@ -1606,7 +1552,7 @@ static gboolean __alarm_handler_idle(gpointer user_data)
         */
        time(&current_time);
        if (alarm_context.c_due_time == current_time) {
-               ALARM_MGR_LOG_PRINT("Expire alarms forcibly when duetime is same to current time(%d).", current_time)
+               ALARM_MGR_LOG_PRINT("Expire alarms forcibly when duetime is same to current time(%d).", current_time);
                __alarm_expired();
                _alarm_schedule();
        }
@@ -1614,31 +1560,12 @@ static gboolean __alarm_handler_idle(gpointer user_data)
        __rtc_set();
 
        ALARM_MGR_LOG_PRINT("Unlock the display from LCD OFF");
-       if (__display_unlock_state(DEVICED_LCD_OFF, DEVICED_SLEEP_MARGIN) != ALARMMGR_RESULT_SUCCESS) {
+       if (__display_unlock_state(DEVICED_LCD_OFF, DEVICED_SLEEP_MARGIN) != ALARMMGR_RESULT_SUCCESS)
                ALARM_MGR_EXCEPTION_PRINT("__display_unlock_state() is failed");
-       }
 
        return false;
 }
 
-static void __clean_registry()
-{
-
-       /*TODO:remove all db entries */
-}
-
-static bool __alarm_manager_reset()
-{
-       _alarm_disable_timer(alarm_context);
-
-       __alarm_clean_list();
-
-       _clear_scheduled_alarm_list();
-       __clean_registry();
-
-       return true;
-}
-
 static void __on_system_time_external_changed(keynode_t *node, void *data)
 {
        double diff_time = 0.0;
@@ -1666,7 +1593,7 @@ static void __on_system_time_external_changed(keynode_t *node, void *data)
 
        __set_time(cur_time);
 
-       vconf_set_int(VCONFKEY_SYSTEM_TIME_CHANGED,(int)diff_time);
+       vconf_set_int(VCONFKEY_SYSTEM_TIME_CHANGED, (int)diff_time);
        bundle *b = NULL;
        b = bundle_create();
        bundle_add_str(b, EVT_KEY_TIME_CHANGED, EVT_VAL_TIME_CHANGED_TRUE);
@@ -1695,10 +1622,8 @@ static int __on_app_uninstalled(uid_t target_uid, int req_id, const char *pkg_ty
 
        SECURE_LOGD("pkg_type(%s), pkgid(%s), key(%s), value(%s)", pkg_type, pkgid, key, val);
 
-       if (strncmp(key, "end", 3) == 0 && strncmp(val, "ok", 2) == 0)
-       {
-               for (gs_iter = alarm_context.alarms; gs_iter != NULL; )
-               {
+       if (strncmp(key, "end", 3) == 0 && strncmp(val, "ok", 2) == 0) {
+               for (gs_iter = alarm_context.alarms; gs_iter != NULL;) {
                        bool is_found = false;
                        entry = gs_iter->data;
 
@@ -1706,36 +1631,28 @@ static int __on_app_uninstalled(uid_t target_uid, int req_id, const char *pkg_ty
                        const char* callee_pkgid = g_quark_to_string(entry->quark_callee_pkgid);
 
                        if ((caller_pkgid && strncmp(pkgid, caller_pkgid, strlen(pkgid)) == 0) ||
-                               (callee_pkgid && strncmp(pkgid, callee_pkgid, strlen(pkgid)) == 0))
-                       {
+                                       (callee_pkgid && strncmp(pkgid, callee_pkgid, strlen(pkgid)) == 0)) {
                                if (_remove_from_scheduled_alarm_list(entry->uid, entry->alarm_id))
-                               {
                                        is_deleted = true;
-                               }
 
                                alarm_info = &entry->alarm_info;
-                               if (!(alarm_info->alarm_type & ALARM_TYPE_VOLATILE))
-                               {
-                                       if(!_delete_alarms(entry->alarm_id))
-                                       {
+                               if (!(alarm_info->alarm_type & ALARM_TYPE_VOLATILE)) {
+                                       if (!_delete_alarms(entry->alarm_id))
                                                SECURE_LOGE("_delete_alarms() is failed. pkgid[%s], alarm_id[%d]", pkgid, entry->alarm_id);
-                                       }
                                }
                                is_found = true;
                        }
 
                        gs_iter = g_slist_next(gs_iter);
 
-                       if (is_found)
-                       {
+                       if (is_found) {
                                SECURE_LOGD("Remove pkgid[%s], alarm_id[%d]", pkgid, entry->alarm_id);
                                alarm_context.alarms = g_slist_remove(alarm_context.alarms, entry);
                                g_free(entry);
                        }
                }
 
-               if (is_deleted && (g_slist_length(g_scheduled_alarm_list) == 0))
-               {
+               if (is_deleted && (g_slist_length(g_scheduled_alarm_list) == 0)) {
                        _alarm_disable_timer(alarm_context);
                        _alarm_schedule();
                }
@@ -1749,7 +1666,6 @@ static int __on_app_uninstalled(uid_t target_uid, int req_id, const char *pkg_ty
 bool __get_caller_unique_name(int pid, char *unique_name, uid_t uid)
 {
        char caller_appid[256] = {0,};
-       char caller_cmdline[512] = {0,};
 
        if (unique_name == NULL) {
                ALARM_MGR_EXCEPTION_PRINT("unique_name should not be NULL.");
@@ -1774,10 +1690,8 @@ bool __get_caller_unique_name(int pid, char *unique_name, uid_t uid)
                        SECURE_LOGE("Caution!! pid(%d) seems to be killed.",
                                        pid, proc_file);
                        return false;
-               }
-               else {
-                       if (read(fd, process_name, sizeof(process_name) - 1) <= 0)
-                       {
+               } else {
+                       if (read(fd, process_name, sizeof(process_name) - 1) <= 0) {
                                ALARM_MGR_EXCEPTION_PRINT("Unable to get the process name.");
                                close(fd);
                                return false;
@@ -1823,18 +1737,16 @@ static bool __save_module_log(const char *tag, const char *message)
 {
        char buffer[ALARMMGR_LOG_BUFFER_STRING_SIZE] = {0,};
        time_t now;
-       int offset = 0;
 
        if (log_fd == -1) {
                ALARM_MGR_EXCEPTION_PRINT("The file is not ready.");
                return false;
        }
 
-       if (log_index != 0) {
-               offset = lseek(log_fd, 0, SEEK_CUR);
-       } else {
-               offset = lseek(log_fd, 0, SEEK_SET);
-       }
+       if (log_index != 0)
+               lseek(log_fd, 0, SEEK_CUR);
+       else
+               lseek(log_fd, 0, SEEK_SET);
 
        time(&now);
        snprintf(buffer, ALARMMGR_LOG_BUFFER_STRING_SIZE, "[%-6d] %-20s %-120s %d-%s", log_index, tag, message, (int)now, ctime(&now));
@@ -1845,12 +1757,12 @@ static bool __save_module_log(const char *tag, const char *message)
                return false;
        }
 
-       if (++log_index >= ALARMMGR_LOG_BUFFER_SIZE) {
+       if (++log_index >= ALARMMGR_LOG_BUFFER_SIZE)
                log_index = 0;
-       }
+
        return true;
 }
-#endif // _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
+#endif /* _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG */
 
 int __display_lock_state(char *state, char *flag, unsigned int timeout)
 {
@@ -1910,7 +1822,7 @@ int __display_unlock_state(char *state, char *flag)
                return ERR_ALARM_SYSTEM_FAIL;
        }
 
-       g_dbus_message_set_body(msg, g_variant_new("(ss)", state, flag ));
+       g_dbus_message_set_body(msg, g_variant_new("(ss)", state, flag));
 
        reply =  g_dbus_connection_send_message_with_reply_sync(alarm_context.connection, msg, G_DBUS_SEND_MESSAGE_FLAGS_NONE, DEVICED_DBUS_REPLY_TIMEOUT, NULL, NULL, NULL);
        if (!reply) {
@@ -1950,40 +1862,35 @@ static long __get_proper_interval(long interval, int alarm_type)
                entry = gs_iter->data;
                if (entry->alarm_info.alarm_type & ALARM_TYPE_PERIOD) {
                        if (entry->alarm_info.mode.u_interval.interval <= interval &&
-                                       entry->alarm_info.mode.u_interval.interval > maxInterval) {
+                                       entry->alarm_info.mode.u_interval.interval > maxInterval)
                                maxInterval = entry->alarm_info.mode.u_interval.interval;
-                       }
                }
        }
 
        while (maxInterval * 2 <= interval ||
-                       (alarm_type & ALARM_TYPE_INEXACT && maxInterval < MIN_INEXACT_INTERVAL) ) {
+                       (alarm_type & ALARM_TYPE_INEXACT && maxInterval < MIN_INEXACT_INTERVAL))
                maxInterval *= 2;
-       }
 
        return maxInterval;
 }
 
 gboolean __alarm_expired_directly(gpointer user_data)
 {
-       if (g_scheduled_alarm_list == NULL || g_scheduled_alarm_list->data == NULL) {
+       if (g_scheduled_alarm_list == NULL || g_scheduled_alarm_list->data == NULL)
                return false;
-       }
 
-       int time_sec = (int)user_data;
+       int time_sec = (int)(intptr_t)user_data;
        __scheduled_alarm_t *alarm = g_scheduled_alarm_list->data;
        __alarm_info_t *alarm_info = alarm->__alarm_info;
 
-       // Expire alarms with duetime equal to newtime by force
+       /* Expire alarms with duetime equal to newtime by force */
        if (alarm_info->due_time == time_sec) {
-               if (__display_lock_state(DEVICED_LCD_OFF, DEVICED_STAY_CUR_STATE, 0) != ALARMMGR_RESULT_SUCCESS) {
+               if (__display_lock_state(DEVICED_LCD_OFF, DEVICED_STAY_CUR_STATE, 0) != ALARMMGR_RESULT_SUCCESS)
                        ALARM_MGR_EXCEPTION_PRINT("__display_lock_state() is failed");
-               }
 
                if (g_dummy_timer_is_set == true) {
                        ALARM_MGR_LOG_PRINT("dummy alarm timer has expired.");
-               }
-               else {
+               } else {
                        ALARM_MGR_LOG_PRINT("due_time=%d is expired.", alarm_info->due_time);
                        __alarm_expired();
                }
@@ -1991,9 +1898,8 @@ gboolean __alarm_expired_directly(gpointer user_data)
                _alarm_schedule();
                __rtc_set();
 
-               if (__display_unlock_state(DEVICED_LCD_OFF, DEVICED_SLEEP_MARGIN) != ALARMMGR_RESULT_SUCCESS) {
+               if (__display_unlock_state(DEVICED_LCD_OFF, DEVICED_SLEEP_MARGIN) != ALARMMGR_RESULT_SUCCESS)
                        ALARM_MGR_EXCEPTION_PRINT("__display_unlock_state() is failed");
-               }
        }
 
        return false;
@@ -2005,14 +1911,14 @@ void __reschedule_alarms_with_newtime(int cur_time, int new_time, double diff_ti
        char log_message[ALARMMGR_LOG_MESSAGE_SIZE] = {0,};
 #endif
 
-       vconf_set_int(VCONFKEY_SYSTEM_TIME_CHANGED,(int)diff_time);
+       vconf_set_int(VCONFKEY_SYSTEM_TIME_CHANGED, (int)diff_time);
        bundle *b = NULL;
        b = bundle_create();
        bundle_add_str(b, EVT_KEY_TIME_CHANGED, EVT_VAL_TIME_CHANGED_TRUE);
        eventsystem_send_system_event(SYS_EVENT_TIME_CHANGED, b);
        bundle_free(b);
 
-       __alarm_update_due_time_of_all_items_in_list(diff_time);        // Rescheduling alarms with ALARM_TYPE_RELATIVE
+       __alarm_update_due_time_of_all_items_in_list(diff_time); /* Rescheduling alarms with ALARM_TYPE_RELATIVE */
        ALARM_MGR_LOG_PRINT("Next duetime is %d", alarm_context.c_due_time);
 
        _clear_scheduled_alarm_list();
@@ -2022,13 +1928,13 @@ void __reschedule_alarms_with_newtime(int cur_time, int new_time, double diff_ti
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
        char *timebuf = ctime((const time_t *)&new_time);
        if (timebuf) {
-               timebuf[strlen(timebuf) - 1] = '\0';    // to avoid newline
+               timebuf[strlen(timebuf) - 1] = '\0'; /* to avoid newline */
                snprintf(log_message, sizeof(log_message), "Current: %d, New: %d, %s, diff: %f", cur_time, new_time, timebuf, diff_time);
        }
        __save_module_log("CHANGE TIME", log_message);
 #endif
 
-       g_idle_add(__alarm_expired_directly, (gpointer)new_time);       // Expire alarms with duetime equal to newtime directly
+       g_idle_add(__alarm_expired_directly, (gpointer)(intptr_t)new_time); /* Expire alarms with duetime equal to newtime directly */
        return;
 }
 
@@ -2086,16 +1992,15 @@ gboolean alarm_manager_alarm_set_rtc_time(AlarmManager *pObj, GDBusMethodInvocat
 
        retval = ioctl(gfd, RTC_WKALM_SET, &rtc_wkalarm);
        if (retval == -1) {
-               if (errno == ENOTTY) {
+               if (errno == ENOTTY)
                        ALARM_MGR_EXCEPTION_PRINT("Alarm IRQs is not supported.");
-               }
+
                ALARM_MGR_EXCEPTION_PRINT("RTC ALARM_SET ioctl is failed. errno = %s", strerror(errno));
                return_code = ERR_ALARM_SYSTEM_FAIL;
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
                strncpy(log_tag, "FAIL: SET RTC", strlen("FAIL: SET RTC"));
 #endif
-       }
-       else{
+       } else {
                ALARM_MGR_LOG_PRINT("[alarm-server]RTC alarm is setted");
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
                strncpy(log_tag, "SET RTC", strlen("SET RTC"));
@@ -2111,7 +2016,7 @@ gboolean alarm_manager_alarm_set_rtc_time(AlarmManager *pObj, GDBusMethodInvocat
        return true;
 }
 
-static int accrue_msec = 0;    // To check a millisecond part of current time at changing the system time(sec)
+static int accrue_msec = 0; /* To check a millisecond part of current time at changing the system time(sec) */
 
 gboolean alarm_manager_alarm_set_time(AlarmManager *pObj, GDBusMethodInvocation *invoc, int time_sec, gpointer user_data)
 {
@@ -2119,12 +2024,12 @@ gboolean alarm_manager_alarm_set_time(AlarmManager *pObj, GDBusMethodInvocation
        struct timeval cur_time = {0,};
        int return_code = ALARMMGR_RESULT_SUCCESS;
 
-       _alarm_disable_timer(alarm_context);    // Disable the timer to reschedule the alarm before the time is changed.
+       _alarm_disable_timer(alarm_context); /* Disable the timer to reschedule the alarm before the time is changed. */
 
        tzset();
        gettimeofday(&cur_time, NULL);
 
-       accrue_msec += (cur_time.tv_usec / 1000);       // Accrue the millisecond to compensate the time
+       accrue_msec += (cur_time.tv_usec / 1000); /* Accrue the millisecond to compensate the time */
        if (accrue_msec > 500) {
                diff_time = difftime(time_sec, cur_time.tv_sec) - 1;
                accrue_msec -= 1000;
@@ -2132,7 +2037,7 @@ gboolean alarm_manager_alarm_set_time(AlarmManager *pObj, GDBusMethodInvocation
                diff_time = difftime(time_sec, cur_time.tv_sec);
        }
 
-       __set_time(time_sec);   // Change both OS time and RTC
+       __set_time(time_sec); /* Change both OS time and RTC */
        ALARM_MGR_LOG_PRINT("[TIMESTAMP]Current time(%d), New time(%d)(%s), diff_time(%f)",
                                                                        cur_time.tv_sec, time_sec, ctime((const time_t *)&time_sec), diff_time);
 
@@ -2149,14 +2054,14 @@ gboolean alarm_manager_alarm_set_time_with_propagation_delay(AlarmManager *pObj,
        struct timespec delay = {0,};
        struct timespec sleep_time = {0,};
        guint real_newtime = 0;
-       accrue_msec = 0;                // reset accrued msec
+       accrue_msec = 0; /* reset accrued msec */
 
-       _alarm_disable_timer(alarm_context);    // Disable the timer to reschedule the alarm before the time is changed.
+       _alarm_disable_timer(alarm_context); /* Disable the timer to reschedule the alarm before the time is changed. */
 
        tzset();
        clock_gettime(CLOCK_REALTIME, &cur_time);
 
-       // Check validation of requested time
+       /* Check validation of requested time */
        if (req_sec > cur_time.tv_sec || (req_sec == cur_time.tv_sec && req_nsec > cur_time.tv_nsec)) {
                ALARM_MGR_EXCEPTION_PRINT("The requeted time(%d.%09d) must be equal to or less than current time(%d.%09d).",
                        req_sec, req_nsec, cur_time.tv_sec, cur_time.tv_nsec);
@@ -2164,7 +2069,7 @@ gboolean alarm_manager_alarm_set_time_with_propagation_delay(AlarmManager *pObj,
                return true;
        }
 
-       // Compensate propagation delay
+       /* Compensate propagation delay */
        if (req_nsec > cur_time.tv_nsec) {
                delay.tv_sec = cur_time.tv_sec - 1 - req_sec;
                delay.tv_nsec = cur_time.tv_nsec + BILLION - req_nsec;
@@ -2181,9 +2086,9 @@ gboolean alarm_manager_alarm_set_time_with_propagation_delay(AlarmManager *pObj,
                sleep_time.tv_nsec = BILLION - (delay.tv_nsec + new_nsec);
        }
 
-       nanosleep(&sleep_time, NULL);   // Wait until 0 nsec to match both OS time and RTC(sec)
+       nanosleep(&sleep_time, NULL); /* Wait until 0 nsec to match both OS time and RTC(sec) */
 
-       __set_time(real_newtime);       // Change both OS time and RTC
+       __set_time(real_newtime); /* Change both OS time and RTC */
 
        diff_time = difftime(real_newtime, cur_time.tv_sec);
        ALARM_MGR_LOG_PRINT("[TIMESTAMP]Current time(%d.%09d), New time(%d.%09d), Real Newtime(%d), diff_time(%f)",
@@ -2214,7 +2119,7 @@ gboolean alarm_manager_alarm_set_timezone(AlarmManager *pObject, GDBusMethodInvo
 
        retval = stat(TIMEZONE_INFO_LINK_PATH, &statbuf);
        if (retval == 0 || (retval == -1 && errno != ENOENT)) {
-               // unlink the current link
+               /* unlink the current link */
                if (unlink(TIMEZONE_INFO_LINK_PATH) < 0) {
                        ALARM_MGR_EXCEPTION_PRINT("unlink() is failed.");
                        return_code = ERR_ALARM_SYSTEM_FAIL;
@@ -2222,7 +2127,7 @@ gboolean alarm_manager_alarm_set_timezone(AlarmManager *pObject, GDBusMethodInvo
                }
        }
 
-       // create a new symlink when the /opt/etc/localtime is empty.
+       /* create a new symlink when the /opt/etc/localtime is empty. */
        if (symlink(tzpath_str, TIMEZONE_INFO_LINK_PATH) < 0) {
                ALARM_MGR_EXCEPTION_PRINT("Failed to create an symlink of %s.", tzpath_str);
                return_code = ERR_ALARM_SYSTEM_FAIL;
@@ -2231,7 +2136,7 @@ gboolean alarm_manager_alarm_set_timezone(AlarmManager *pObject, GDBusMethodInvo
 
        tzset();
 
-       // Rescheduling alarms
+       /* Rescheduling alarms */
        _alarm_disable_timer(alarm_context);
        __alarm_update_due_time_of_all_items_in_list(0);
        ALARM_MGR_LOG_PRINT("next expiring due_time is %d", alarm_context.c_due_time);
@@ -2247,7 +2152,6 @@ gboolean alarm_manager_alarm_set_timezone(AlarmManager *pObject, GDBusMethodInvo
        eventsystem_send_system_event(SYS_EVENT_TIME_CHANGED, b);
        bundle_free(b);
 
-       b = NULL;
        b = bundle_create();
        bundle_add_str(b, EVT_KEY_TIME_ZONE, tzpath_str);
        eventsystem_send_system_event(SYS_EVENT_TIME_ZONE, b);
@@ -2256,11 +2160,11 @@ gboolean alarm_manager_alarm_set_timezone(AlarmManager *pObject, GDBusMethodInvo
 done:
        g_dbus_method_invocation_return_value(invoc, g_variant_new("(i)", return_code));
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
-       if (return_code == ALARMMGR_RESULT_SUCCESS) {
+       if (return_code == ALARMMGR_RESULT_SUCCESS)
                strncpy(log_tag, "SET TIMEZONE", strlen("SET TIMEZONE"));
-       } else {
+       else
                strncpy(log_tag, "FAIL: SET TIMEZONE", strlen("FAIL: SET TIMEZONE"));
-       }
+
        snprintf(log_message, sizeof(log_message), "Set the timezone to %s.", tzpath_str);
        __save_module_log(log_tag, log_message);
 #endif
@@ -2281,7 +2185,6 @@ gboolean alarm_manager_alarm_create_appsvc(AlarmManager *pObject, GDBusMethodInv
                                    gpointer user_data)
 {
        alarm_info_t alarm_info;
-       int retval = 0;
        int return_code = ALARMMGR_RESULT_SUCCESS;
        int alarm_id = 0;
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
@@ -2317,7 +2220,7 @@ gboolean alarm_manager_alarm_create_appsvc(AlarmManager *pObject, GDBusMethodInv
                alarm_info.alarm_type |= ALARM_TYPE_PERIOD;
                alarm_info.mode.u_interval.interval =
                        __get_proper_interval(mode_interval, alarm_info.alarm_type);
-       } else if (mode_interval <= 0){
+       } else if (mode_interval <= 0) {
                alarm_info.mode.u_interval.interval = 0;
        }
 
@@ -2327,12 +2230,11 @@ gboolean alarm_manager_alarm_create_appsvc(AlarmManager *pObject, GDBusMethodInv
                strncpy(log_tag, "FAIL: CREATE", strlen("FAIL: CREATE"));
 #endif
                ret = false;
-       }
+       } else {
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
-       else {
                strncpy(log_tag, "CREATE", strlen("CREATE"));
-       }
 #endif
+       }
 
        g_dbus_method_invocation_return_value(invoc, g_variant_new("(ii)", alarm_id, return_code));
 
@@ -2357,7 +2259,6 @@ gboolean alarm_manager_alarm_create(AlarmManager *obj, GDBusMethodInvocation *in
                                    gpointer user_data)
 {
        alarm_info_t alarm_info;
-       int retval = 0;
        int return_code = ALARMMGR_RESULT_SUCCESS;
        int alarm_id = 0;
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
@@ -2389,19 +2290,18 @@ gboolean alarm_manager_alarm_create(AlarmManager *obj, GDBusMethodInvocation *in
        alarm_info.alarm_type = alarm_type;
        alarm_info.reserved_info = reserved_info;
 
-       if (!__alarm_create(&alarm_info, &alarm_id, uid, pid, 0, 0, 0, app_service_name,app_service_name_mod,
-                      reserved_service_name, reserved_service_name_mod, &return_code)) {
+       if (!__alarm_create(&alarm_info, &alarm_id, uid, pid, 0, 0, 0, app_service_name, app_service_name_mod,
+                               reserved_service_name, reserved_service_name_mod, &return_code)) {
                ALARM_MGR_EXCEPTION_PRINT("Unable to create alarm! return_code[%d]", return_code);
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
                strncpy(log_tag, "FAIL: CREATE", strlen("FAIL: CREATE"));
 #endif
                ret = false;
-       }
+       } else {
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
-       else {
                strncpy(log_tag, "CREATE", strlen("CREATE"));
-       }
 #endif
+       }
 
        g_dbus_method_invocation_return_value(invoc, g_variant_new("(ii)", alarm_id, return_code));
 
@@ -2478,8 +2378,8 @@ gboolean alarm_manager_alarm_create_periodic(AlarmManager *obj, GDBusMethodInvoc
        }
 
        if (!__alarm_create(&alarm_info, &alarm_id, uid, pid, method, interval * 60, is_ref,
-                           app_service_name, app_service_name_mod,
-                           "null", "null", &return_code)) {
+                               app_service_name, app_service_name_mod,
+                               "null", "null", &return_code)) {
                ALARM_MGR_EXCEPTION_PRINT("Unable to create alarm! return_code[%d]", return_code);
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
                strncpy(log_tag, "FAIL: CREATE", strlen("FAIL: CREATE"));
@@ -2507,7 +2407,6 @@ gboolean alarm_manager_alarm_create_periodic(AlarmManager *obj, GDBusMethodInvoc
 gboolean alarm_manager_alarm_delete(AlarmManager *obj, GDBusMethodInvocation *invoc,
                alarm_id_t alarm_id, gpointer user_data)
 {
-       int retval = 0;
        int return_code = ALARMMGR_RESULT_SUCCESS;
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
        char log_tag[ALARMMGR_LOG_TAG_SIZE] = {0,};
@@ -2553,7 +2452,6 @@ gboolean alarm_manager_alarm_delete_all(AlarmManager *obj, GDBusMethodInvocation
        alarm_info_t* alarm_info = NULL;
        __alarm_info_t* entry = NULL;
        bool is_deleted = false;
-       int retval = 0;
        int return_code = ALARMMGR_RESULT_SUCCESS;
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
        char log_message[ALARMMGR_LOG_MESSAGE_SIZE] = {0,};
@@ -2577,34 +2475,26 @@ gboolean alarm_manager_alarm_delete_all(AlarmManager *obj, GDBusMethodInvocation
 
        SECURE_LOGD("Called by process (pid:%d, unique_name=%s)", pid, app_name);
 
-       for (gs_iter = alarm_context.alarms; gs_iter != NULL; )
-       {
+       for (gs_iter = alarm_context.alarms; gs_iter != NULL;) {
                bool is_found = false;
                entry = gs_iter->data;
                const char* tmp_appname = g_quark_to_string(entry->quark_app_unique_name);
                SECURE_LOGD("Try to remove app_name[%s], alarm_id[%d]\n", tmp_appname, entry->alarm_id);
-               if (tmp_appname && strncmp(app_name, tmp_appname, strlen(tmp_appname)) == 0)
-               {
+               if (tmp_appname && strncmp(app_name, tmp_appname, strlen(tmp_appname)) == 0) {
                        if (_remove_from_scheduled_alarm_list(uid, entry->alarm_id))
-                       {
                                is_deleted = true;
-                       }
 
                        alarm_info = &entry->alarm_info;
-                       if (!(alarm_info->alarm_type & ALARM_TYPE_VOLATILE))
-                       {
-                               if(!_delete_alarms(entry->alarm_id))
-                               {
+                       if (!(alarm_info->alarm_type & ALARM_TYPE_VOLATILE)) {
+                               if (!_delete_alarms(entry->alarm_id))
                                        SECURE_LOGE("_delete_alarms() is failed. pid[%d], alarm_id[%d]", pid, entry->alarm_id);
-                               }
                        }
                        is_found = true;
                }
 
                gs_iter = g_slist_next(gs_iter);
 
-               if (is_found)
-               {
+               if (is_found) {
                        ALARM_MGR_LOG_PRINT("alarm_id[%d] is removed.", entry->alarm_id);
                        SECURE_LOGD("Removing is done. app_name[%s], alarm_id [%d]\n", tmp_appname, entry->alarm_id);
                        alarm_context.alarms = g_slist_remove(alarm_context.alarms, entry);
@@ -2612,8 +2502,7 @@ gboolean alarm_manager_alarm_delete_all(AlarmManager *obj, GDBusMethodInvocation
                }
        }
 
-       if (is_deleted && (g_slist_length(g_scheduled_alarm_list) == 0))
-       {
+       if (is_deleted && (g_slist_length(g_scheduled_alarm_list) == 0)) {
                _alarm_disable_timer(alarm_context);
                _alarm_schedule();
        }
@@ -2675,12 +2564,11 @@ gboolean alarm_manager_alarm_update(AlarmManager *pObj, GDBusMethodInvocation *i
                strncpy(log_tag, "FAIL: UPDATE", strlen("FAIL: UPDATE"));
 #endif
                ret = false;
-       }
+       } else {
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
-       else {
                strncpy(log_tag, "UPDATE", strlen("UPDATE"));
-       }
 #endif
+       }
 
        g_dbus_method_invocation_return_value(invoc, g_variant_new("(i)", return_code));
 
@@ -2699,7 +2587,6 @@ gboolean alarm_manager_alarm_get_number_of_ids(AlarmManager *pObject, GDBusMetho
        GSList *gs_iter = NULL;
        char app_name[256] = { 0 };
        __alarm_info_t *entry = NULL;
-       int retval = 0;
        int num_of_ids = 0;
        int return_code = ALARMMGR_RESULT_SUCCESS;
        uid_t uid;
@@ -2764,13 +2651,13 @@ gboolean alarm_manager_alarm_get_list_of_ids(AlarmManager *pObject, GDBusMethodI
 
        SECURE_LOGD("Called by process (uid: %d, pid:%d, unique_name=%s).", uid, pid, app_name);
 
-       builder = g_variant_builder_new(G_VARIANT_TYPE ("ai"));
+       builder = g_variant_builder_new(G_VARIANT_TYPE("ai"));
        for (gs_iter = alarm_context.alarms; gs_iter != NULL; gs_iter = g_slist_next(gs_iter)) {
                entry = gs_iter->data;
                if (entry->uid == uid &&
                                strncmp(app_name, g_quark_to_string(entry->quark_app_unique_name), strlen(app_name)) == 0) {
-                       g_variant_builder_add (builder, "i", entry->alarm_id);
-                       index ++;
+                       g_variant_builder_add(builder, "i", entry->alarm_id);
+                       index++;
                        SECURE_LOGE("called for alarmid(%d), but max_number_of_ids(%d) index %d.", entry->alarm_id, max_number_of_ids, index);
                }
        }
@@ -2791,7 +2678,6 @@ gboolean alarm_manager_alarm_get_appsvc_info(AlarmManager *pObject, GDBusMethodI
        bool found = false;
        GSList *gs_iter = NULL;
        __alarm_info_t *entry = NULL;
-       int retval = 0;
        int return_code = ALARMMGR_RESULT_SUCCESS;
        gchar *b_data = NULL;
        uid_t uid;
@@ -2831,7 +2717,6 @@ gboolean alarm_manager_alarm_get_info(AlarmManager *pObject, GDBusMethodInvocati
        GSList *gs_iter = NULL;
        __alarm_info_t *entry = NULL;
        alarm_info_t *alarm_info = NULL;
-       int retval = 0;
        int return_code = ALARMMGR_RESULT_SUCCESS;
        uid_t uid;
        const char *name = g_dbus_method_invocation_get_sender(invoc);
@@ -2867,7 +2752,6 @@ gboolean alarm_manager_alarm_get_next_duetime(AlarmManager *pObject, GDBusMethod
        GSList *gs_iter = NULL;
        __alarm_info_t *entry = NULL;
        __alarm_info_t *find_item = NULL;
-       int retval = 0;
        int return_code = ALARMMGR_RESULT_SUCCESS;
        time_t duetime = 0;
        uid_t uid;
@@ -2927,12 +2811,11 @@ gboolean alarm_manager_alarm_get_all_info(AlarmManager *pObject, GDBusMethodInvo
        __alarm_info_t *entry = NULL;
        char *error_message = NULL;
        uid_t uid;
-
        const char *name = g_dbus_method_invocation_get_sender(invoc);
 
        uid = __get_caller_uid(name);
 
-       // Open a DB
+       /* Open a DB */
        time(&current_time);
        localtime_r(&current_time, &current_tm);
        snprintf(db_path_tmp, sizeof(db_path_tmp), "/tmp/alarmmgr_%d%d%d_%02d%02d%02d.db",
@@ -2947,12 +2830,11 @@ gboolean alarm_manager_alarm_get_all_info(AlarmManager *pObject, GDBusMethodInvo
                return true;
        }
 
-       // Drop a table
-       if (sqlite3_exec(alarmmgr_tool_db, query_for_deleting_table, NULL, NULL, &error_message) != SQLITE_OK) {
+       /* Drop a table */
+       if (sqlite3_exec(alarmmgr_tool_db, query_for_deleting_table, NULL, NULL, &error_message) != SQLITE_OK)
                ALARM_MGR_EXCEPTION_PRINT("Deleting the table is failed. error message = %s", error_message);
-       }
 
-       // Create a table if it does not exist
+       /* Create a table if it does not exist */
        if (sqlite3_exec(alarmmgr_tool_db, query_for_creating_table, NULL, NULL, &error_message) != SQLITE_OK) {
                ALARM_MGR_EXCEPTION_PRINT("Creating the table is failed. error message = %s", error_message);
                sqlite3_close(alarmmgr_tool_db);
@@ -2962,7 +2844,7 @@ gboolean alarm_manager_alarm_get_all_info(AlarmManager *pObject, GDBusMethodInvo
                return true;
        }
 
-       // Get information of all alarms and save those into the DB.
+       /* Get information of all alarms and save those into the DB. */
        int index = 0;
        for (gs_iter = alarm_context.alarms; gs_iter != NULL; gs_iter = g_slist_next(gs_iter)) {
                entry = gs_iter->data;
@@ -2994,9 +2876,8 @@ gboolean alarm_manager_alarm_get_all_info(AlarmManager *pObject, GDBusMethodInvo
                                mode->repeat,
                                entry->alarm_info.alarm_type);
 
-               if (sqlite3_exec(alarmmgr_tool_db, query, NULL, NULL, &error_message) != SQLITE_OK) {
+               if (sqlite3_exec(alarmmgr_tool_db, query, NULL, NULL, &error_message) != SQLITE_OK)
                        SECURE_LOGE("sqlite3_exec() is failed. error message = %s", error_message);
-               }
 
                sqlite3_free(query);
        }
@@ -3019,6 +2900,7 @@ gboolean alarm_manager_alarm_set_global(AlarmManager *pObject, GDBusMethodInvoca
        int return_code = ALARMMGR_RESULT_SUCCESS;
        uid_t uid;
        const char *name = g_dbus_method_invocation_get_sender(invoc);
+       char *callee_pkgid;
 
        uid = __get_caller_uid(name);
 
@@ -3038,10 +2920,9 @@ gboolean alarm_manager_alarm_set_global(AlarmManager *pObject, GDBusMethodInvoca
        } else {
                ALARM_MGR_LOG_PRINT("The alarm(%d) is found.", alarm_id);
 
-               char *callee_pkgid = (char *)g_quark_to_string(entry->quark_callee_pkgid);
-               if (strncmp(callee_pkgid, "null", strlen(callee_pkgid)) == 0) {
+               callee_pkgid = (char *)g_quark_to_string(entry->quark_callee_pkgid);
+               if (strncmp(callee_pkgid, "null", strlen(callee_pkgid)) == 0)
                        callee_pkgid = (char *)g_quark_to_string(entry->quark_app_service_name)+6;
-               }
 
                ALARM_MGR_LOG_PRINT("The alarm pkgid : %s.", callee_pkgid);
 
@@ -3049,15 +2930,14 @@ gboolean alarm_manager_alarm_set_global(AlarmManager *pObject, GDBusMethodInvoca
                retval = pkgmgrinfo_pkginfo_get_pkginfo(callee_pkgid, &handle);
                if (retval != PMINFO_R_OK) {
                        ALARM_MGR_EXCEPTION_PRINT("The alarm(%d) is not permitted to set global.", alarm_id);
-                       return_code = ERR_ALARM_INVALID_ID; //TODO change error code
+                       return_code = ERR_ALARM_INVALID_ID; /* TODO change error code */
                } else {
                        bool is_global = 0;
                        retval = pkgmgrinfo_pkginfo_is_global(handle, &is_global);
                        if (retval == PMINFO_R_OK && is_global) {
                                entry->global = global;
-                               if (!__alarm_set_global_to_db(entry, global)) {
+                               if (!__alarm_set_global_to_db(entry, global))
                                        return_code = ERR_ALARM_SYSTEM_FAIL;
-                               }
                        } else if (retval == PMINFO_R_OK && !is_global) {
                                return_code = ERR_ALARM_NOT_PERMITTED_APP;
                        }
@@ -3075,7 +2955,6 @@ gboolean alarm_manager_alarm_get_global(AlarmManager *pObject, GDBusMethodInvoca
        GSList *gs_iter = NULL;
        __alarm_info_t *entry = NULL;
        __alarm_info_t *find_item = NULL;
-       int retval = 0;
        int return_code = ALARMMGR_RESULT_SUCCESS;
        bool global = false;
 
@@ -3127,9 +3006,9 @@ static gboolean __timer_glib_check(GSource *src)
        fd_list = src->poll_fds;
        do {
                tmp = (GPollFD *) fd_list->data;
-               if (tmp->revents & (POLLIN | POLLPRI)) {
+               if (tmp->revents & (POLLIN | POLLPRI))
                        return TRUE;
-               }
+
                fd_list = fd_list->next;
        } while (fd_list);
 
@@ -3210,13 +3089,13 @@ static void __initialize_scheduled_alarm_list()
 
 static bool __initialize_noti()
 {
-       // VCONFKEY_SYSTEM_TIMECHANGE_EXTERNAL is set by OSP app-service.
+       /* VCONFKEY_SYSTEM_TIMECHANGE_EXTERNAL is set by OSP app-service. */
        if (vconf_notify_key_changed
            (VCONFKEY_SYSTEM_TIMECHANGE_EXTERNAL, __on_system_time_external_changed, NULL) < 0) {
                ALARM_MGR_LOG_PRINT("Failed to add callback for time external changing event.");
        }
 
-       // If the caller or callee app is uninstalled, all registered alarms will be canceled.
+       /* If the caller or callee app is uninstalled, all registered alarms will be canceled. */
        int event_type = PMINFO_CLIENT_STATUS_UNINSTALL;
        pkgmgrinfo_client* pc = pkgmgrinfo_client_new(PMINFO_LISTENING);
        pkgmgrinfo_client_set_status_type(pc, event_type);
@@ -3226,19 +3105,20 @@ static bool __initialize_noti()
 }
 
 void on_bus_name_owner_changed(GDBusConnection  *connection,
-                                                                               const gchar             *sender_name,
-                                                                               const gchar             *object_path,
-                                                                               const gchar             *interface_name,
-                                                                               const gchar             *signal_name,
-                                                                               GVariant                        *parameters,
-                                                                               gpointer                        user_data)
-{
-       // On expiry, the killed app can be launched by aul. Then, the owner of the bus name which was registered by the app is changed.
-       // In this case, "NameOwnerChange" signal is broadcasted.
+                               const gchar *sender_name,
+                               const gchar *object_path,
+                               const gchar *interface_name,
+                               const gchar *signal_name,
+                               GVariant *parameters,
+                               gpointer user_data)
+{
+       GSList *entry = NULL;
+       __expired_alarm_t *expire_info = NULL;
+       char *service_name = NULL;
+
+       /* On expiry, the killed app can be launched by aul. Then, the owner of the bus name which was registered by the app is changed.
+        * In this case, "NameOwnerChange" signal is broadcasted. */
        if (signal_name && strcmp(signal_name , "NameOwnerChanged") == 0) {
-               GSList *entry = NULL;
-               __expired_alarm_t *expire_info = NULL;
-               char *service_name = NULL;
                g_variant_get(parameters, "(sss)", &service_name, NULL, NULL);
 
                for (entry = g_expired_alarm_list; entry; entry = entry->next) {
@@ -3396,15 +3276,16 @@ static void __initialize()
 #endif
 
        __initialize_timer();
-       if (__initialize_dbus() == false) {     /* because dbus's initialize
-                                       failed, we cannot continue any more. */
+       if (__initialize_dbus() == false) {
+               /* because dbus's initialize
+                * failed, we cannot continue any more. */
                ALARM_MGR_EXCEPTION_PRINT("because __initialize_dbus failed, "
                                          "alarm-server cannot be runned.\n");
                exit(1);
        }
 
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
-       __initialize_module_log();      // for module log
+       __initialize_module_log(); /* for module log */
 #endif
 
        __initialize_scheduled_alarm_list();
index 87b48b0..69c9c4e 100644 (file)
@@ -231,9 +231,9 @@ time_t _get_periodic_alarm_standard_time(void);
 #define ALARM_MGR_ASSERT_PRINT(FMT, ARG...) do { printf("%5d", getpid()); printf
        ("%s() : "FMT"\n", __FUNCTION__, ##ARG); } while (false)
 #else
-#define ALARM_MGR_LOG_PRINT(FMT, ARG...) LOGD(FMT, ##ARG);
-#define ALARM_MGR_EXCEPTION_PRINT(FMT, ARG...) LOGW(FMT, ##ARG);
-#define ALARM_MGR_ASSERT_PRINT(FMT, ARG...) LOGE(FMT, ##ARG);
+#define ALARM_MGR_LOG_PRINT(FMT, ARG...) LOGD(FMT, ##ARG)
+#define ALARM_MGR_EXCEPTION_PRINT(FMT, ARG...) LOGW(FMT, ##ARG)
+#define ALARM_MGR_ASSERT_PRINT(FMT, ARG...) LOGE(FMT, ##ARG)
 #endif
 
 #endif /*_ALARM_INTERNAL_H*/
index dd79bbe..f655e5f 100644 (file)
@@ -1,10 +1,5 @@
 /*
- *  alarm-manager
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Venkatesha Sarpangala <sarpangala.v@samsung.com>, Jayoun Lee <airjany@samsung.com>,
- * Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
+ * Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
  */
 
-
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
 #include "alarm-internal.h"
 #include "alarm-mgr-stub.h"
 
-#define ALARM_SERVICE_NAME     "appframework.alarm"
-#define ALARM_OBJECT_PATH      "/appframework/alarm"
+#define ALARM_SERVICE_NAME "appframework.alarm"
+#define ALARM_OBJECT_PATH "/appframework/alarm"
 #define ALARM_INTERFACE_NAME "appframework.alarm"
 
-
 bool _send_alarm_create(alarm_context_t context, alarm_info_t *alarm_info,
-                       alarm_id_t *alarm_id, const char *dst_service_name, const char *dst_service_name_mod,
-                       int *error_code);
+               alarm_id_t *alarm_id, const char *dst_service_name,
+               const char *dst_service_name_mod, int *error_code);
 bool _send_alarm_create_appsvc(alarm_context_t context, alarm_info_t *alarm_info,
-                       alarm_id_t *alarm_id, bundle *b,int *error_code);
+               alarm_id_t *alarm_id, bundle *b, int *error_code);
 bool _send_alarm_delete(alarm_context_t context, alarm_id_t alarm_id,
-                       int *error_code);
+               int *error_code);
 bool _send_alarm_get_list_of_ids(alarm_context_t context, int maxnum_of_ids,
-                                alarm_id_t *alarm_id, int *num_of_ids,
-                                int *error_code);
+               alarm_id_t *alarm_id, int *num_of_ids, int *error_code);
 bool _send_alarm_get_number_of_ids(alarm_context_t context, int *num_of_ids,
-                                  int *error_code);
+               int *error_code);
 bool _send_alarm_get_info(alarm_context_t context, alarm_id_t alarm_id,
-                         alarm_info_t *alarm_info, int *error_code);
+               alarm_info_t *alarm_info, int *error_code);
 
 bool _send_alarm_create_appsvc(alarm_context_t context, alarm_info_t *alarm_info,
-                       alarm_id_t *alarm_id, bundle *b,
-                       int *error_code)
+               alarm_id_t *alarm_id, bundle *b,
+               int *error_code)
 {
        gboolean ret;
        GError *error = NULL;
@@ -62,33 +52,31 @@ bool _send_alarm_create_appsvc(alarm_context_t context, alarm_info_t *alarm_info
        bundle_raw *b_data = NULL;
        int datalen = 0;
 
-       if (bundle_encode(b, &b_data, &datalen))
-       {
+       if (bundle_encode(b, &b_data, &datalen)) {
                ALARM_MGR_EXCEPTION_PRINT("Unable to encode the bundle data\n");
-               if (error_code) {
+               if (error_code)
                        *error_code = ERR_ALARM_SYSTEM_FAIL;
-               }
                return false;
        }
 
        ret = alarm_manager_call_alarm_create_appsvc_sync((AlarmManager*)context.proxy,
-                                                   alarm_info->start.year,
-                                                   alarm_info->start.month,
-                                                   alarm_info->start.day,
-                                                   alarm_info->start.hour,
-                                                   alarm_info->start.min,
-                                                   alarm_info->start.sec,
-                                                   alarm_info->end.year,
-                                                   alarm_info->end.month,
-                                                   alarm_info->end.day,
-                                                   alarm_info->mode.u_interval.day_of_week,
-                                                   alarm_info->mode.u_interval.interval,
-                                                   alarm_info->mode.repeat,
-                                                   alarm_info->alarm_type,
-                                                   alarm_info->reserved_info,
-                                                   (char *)b_data,
-                                                   alarm_id, &return_code,
-                                                   NULL, &error);
+                       alarm_info->start.year,
+                       alarm_info->start.month,
+                       alarm_info->start.day,
+                       alarm_info->start.hour,
+                       alarm_info->start.min,
+                       alarm_info->start.sec,
+                       alarm_info->end.year,
+                       alarm_info->end.month,
+                       alarm_info->end.day,
+                       alarm_info->mode.u_interval.day_of_week,
+                       alarm_info->mode.u_interval.interval,
+                       alarm_info->mode.repeat,
+                       alarm_info->alarm_type,
+                       alarm_info->reserved_info,
+                       (char *)b_data,
+                       alarm_id, &return_code,
+                       NULL, &error);
        if (b_data) {
                free(b_data);
                b_data = NULL;
@@ -98,7 +86,7 @@ bool _send_alarm_create_appsvc(alarm_context_t context, alarm_info_t *alarm_info
                /* g_dbus_proxy_call_sync error */
                /* error_code should be set */
                ALARM_MGR_EXCEPTION_PRINT(
-               "alarm_manager_call_alarm_create_appsvc_sync()failed. alarm_id[%d], return_code[%d].", alarm_id, return_code);
+                               "alarm_manager_call_alarm_create_appsvc_sync()failed. alarm_id[%d], return_code[%d].", alarm_id, return_code);
                ALARM_MGR_EXCEPTION_PRINT("error->message is %s(%d)", error->message, error->code);
                if (error_code) {
                        if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -111,57 +99,54 @@ bool _send_alarm_create_appsvc(alarm_context_t context, alarm_info_t *alarm_info
        }
 
        if (return_code != 0) {
-               if (error_code) {
+               if (error_code)
                        *error_code = return_code;
-               }
                return false;
        }
 
        return true;
 }
 
-
 bool _send_alarm_create(alarm_context_t context, alarm_info_t *alarm_info,
-                       alarm_id_t *alarm_id, const char *dst_service_name, const char *dst_service_name_mod,
-                       int *error_code)
+               alarm_id_t *alarm_id, const char *dst_service_name, const char *dst_service_name_mod,
+               int *error_code)
 {
        GError *error = NULL;
        int return_code = 0;
 
        /*TODO: Dbus bus name validation is must & will be added to avoid alarm-server crash*/
        if (g_quark_to_string(context.quark_app_service_name) == NULL
-               && strlen(dst_service_name) == 4
-               && strncmp(dst_service_name, "null",4) == 0) {
-                       ALARM_MGR_EXCEPTION_PRINT("Invalid arg. Provide valid destination or call alarmmgr_init()\n");
-               if (error_code) {
+                       && strlen(dst_service_name) == 4
+                       && strncmp(dst_service_name, "null", 4) == 0) {
+               ALARM_MGR_EXCEPTION_PRINT("Invalid arg. Provide valid destination or call alarmmgr_init()\n");
+               if (error_code)
                        *error_code = ERR_ALARM_INVALID_PARAM;
-               }
                return false;
        }
 
        if (!alarm_manager_call_alarm_create_sync((AlarmManager*)context.proxy,
-                       g_quark_to_string(context.quark_app_service_name),
-                       g_quark_to_string(context.quark_app_service_name_mod),
-                                                   alarm_info->start.year,
-                                                   alarm_info->start.month,
-                                                   alarm_info->start.day,
-                                                   alarm_info->start.hour,
-                                                   alarm_info->start.min,
-                                                   alarm_info->start.sec,
-                                                   alarm_info->end.year,
-                                                   alarm_info->end.month,
-                                                   alarm_info->end.day,
-                                                   alarm_info->mode.u_interval.day_of_week,
-                                                   alarm_info->mode.repeat,
-                                                   alarm_info->alarm_type,
-                                                   alarm_info->reserved_info,
-                                                   dst_service_name, dst_service_name_mod,
-                                                   alarm_id, &return_code,
-                                                   NULL, &error)) {
+                               g_quark_to_string(context.quark_app_service_name),
+                               g_quark_to_string(context.quark_app_service_name_mod),
+                               alarm_info->start.year,
+                               alarm_info->start.month,
+                               alarm_info->start.day,
+                               alarm_info->start.hour,
+                               alarm_info->start.min,
+                               alarm_info->start.sec,
+                               alarm_info->end.year,
+                               alarm_info->end.month,
+                               alarm_info->end.day,
+                               alarm_info->mode.u_interval.day_of_week,
+                               alarm_info->mode.repeat,
+                               alarm_info->alarm_type,
+                               alarm_info->reserved_info,
+                               dst_service_name, dst_service_name_mod,
+                               alarm_id, &return_code,
+                               NULL, &error)) {
                /* g_dbus_proxy_call_sync error error */
                /* error_code should be set */
                ALARM_MGR_EXCEPTION_PRINT(
-               "alarm_manager_call_alarm_create_sync()failed. alarm_id[%d], return_code[%d]", alarm_id, return_code);
+                               "alarm_manager_call_alarm_create_sync()failed. alarm_id[%d], return_code[%d]", alarm_id, return_code);
                ALARM_MGR_EXCEPTION_PRINT("error->message is %s(%d)", error->message, error->code);
                if (error_code) {
                        if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -174,9 +159,8 @@ bool _send_alarm_create(alarm_context_t context, alarm_info_t *alarm_info,
        }
 
        if (return_code != 0) {
-               if (error_code) {
+               if (error_code)
                        *error_code = return_code;
-               }
                return false;
        }
 
@@ -184,26 +168,25 @@ bool _send_alarm_create(alarm_context_t context, alarm_info_t *alarm_info,
 }
 
 bool _send_alarm_create_periodic(alarm_context_t context, int interval, int is_ref,
-                       int method, alarm_id_t *alarm_id, int *error_code)
+               int method, alarm_id_t *alarm_id, int *error_code)
 {
        GError *error = NULL;
        int return_code = 0;
 
        if (g_quark_to_string(context.quark_app_service_name) == NULL) {
                ALARM_MGR_EXCEPTION_PRINT("Invalid arg. Provide valid destination or call alarmmgr_init()\n");
-               if (error_code) {
+               if (error_code)
                        *error_code = ERR_ALARM_INVALID_PARAM;
-               }
                return false;
        }
 
        if (!alarm_manager_call_alarm_create_periodic_sync((AlarmManager*)context.proxy,
-                       g_quark_to_string(context.quark_app_service_name),
-                       g_quark_to_string(context.quark_app_service_name_mod),
-                       interval, is_ref, method,
-                   alarm_id, &return_code, NULL, &error)) {
+                               g_quark_to_string(context.quark_app_service_name),
+                               g_quark_to_string(context.quark_app_service_name_mod),
+                               interval, is_ref, method,
+                               alarm_id, &return_code, NULL, &error)) {
                ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_create_periodic_sync()failed. alarm_id[%d], return_code[%d]",
-                       alarm_id, return_code);
+                               alarm_id, return_code);
                ALARM_MGR_EXCEPTION_PRINT("error->message is %s(%d)", error->message, error->code);
                if (error_code) {
                        if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -216,9 +199,8 @@ bool _send_alarm_create_periodic(alarm_context_t context, int interval, int is_r
        }
 
        if (return_code != 0) {
-               if (error_code) {
+               if (error_code)
                        *error_code = return_code;
-               }
                return false;
        }
 
@@ -233,7 +215,7 @@ bundle *_send_alarm_get_appsvc_info(alarm_context_t context, alarm_id_t alarm_id
        gchar *b_data = NULL;
 
        if (!alarm_manager_call_alarm_get_appsvc_info_sync
-           ((AlarmManager*)context.proxy, alarm_id, &b_data, &return_code, NULL, &error)) {
+                       ((AlarmManager*)context.proxy, alarm_id, &b_data, &return_code, NULL, &error)) {
                /* g_dbus_proxy_call_sync error */
                /*error_code should be set */
                ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_get_appsvc_info_sync() failed. alarm_id[%d], return_code[%d].", alarm_id, return_code);
@@ -246,37 +228,34 @@ bundle *_send_alarm_get_appsvc_info(alarm_context_t context, alarm_id_t alarm_id
                }
                g_error_free(error);
 
-               if (b_data) {
+               if (b_data)
                        g_free(b_data);
-               }
 
                return NULL;
        }
 
        if (return_code != 0) {
-               if (error_code) {
+               if (error_code)
                        *error_code = return_code;
-               }
        } else {
                b = bundle_decode((bundle_raw *)b_data, strlen(b_data));
        }
 
-       if (b_data) {
+       if (b_data)
                g_free(b_data);
-       }
 
        return b;
 }
 
-
-bool _send_alarm_set_rtc_time(alarm_context_t context, alarm_date_t *time, int *error_code){
+bool _send_alarm_set_rtc_time(alarm_context_t context, alarm_date_t *time, int *error_code)
+{
 
        GError *error = NULL;
        int return_code = 0;
 
        if (!alarm_manager_call_alarm_set_rtc_time_sync
-           ((AlarmManager*)context.proxy, time->year, time->month, time->day,
-                time->hour, time->min, time->sec, &return_code, NULL, &error)) {
+                       ((AlarmManager*)context.proxy, time->year, time->month, time->day,
+                        time->hour, time->min, time->sec, &return_code, NULL, &error)) {
                /* g_dbus_proxy_call_sync error */
                /*error_code should be set */
                ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_set_rtc_time() failed. return_code[%d]", return_code);
@@ -293,9 +272,8 @@ bool _send_alarm_set_rtc_time(alarm_context_t context, alarm_date_t *time, int *
        }
 
        if (return_code != 0) {
-               if (error_code) {
+               if (error_code)
                        *error_code = return_code;
-               }
                return false;
        }
 
@@ -308,7 +286,7 @@ bool _send_alarm_delete(alarm_context_t context, alarm_id_t alarm_id, int *error
        int return_code = 0;
 
        if (!alarm_manager_call_alarm_delete_sync
-           ((AlarmManager*)context.proxy, alarm_id, &return_code, NULL, &error)) {
+                       ((AlarmManager*)context.proxy, alarm_id, &return_code, NULL, &error)) {
                /* g_dbus_proxy_call_sync error */
                /*error_code should be set */
                ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_delete_sync() failed. alarm_id[%d], return_code[%d]", alarm_id, return_code);
@@ -325,9 +303,8 @@ bool _send_alarm_delete(alarm_context_t context, alarm_id_t alarm_id, int *error
        }
 
        if (return_code != 0) {
-               if (error_code) {
+               if (error_code)
                        *error_code = return_code;
-               }
                return false;
        }
 
@@ -340,7 +317,7 @@ bool _send_alarm_delete_all(alarm_context_t context, int *error_code)
        int return_code = 0;
 
        if (!alarm_manager_call_alarm_delete_all_sync
-           ((AlarmManager*)context.proxy, &return_code, NULL, &error)) {
+                       ((AlarmManager*)context.proxy, &return_code, NULL, &error)) {
                /* g_dbus_proxy_call_sync error */
                /*error_code should be set */
                ALARM_MGR_EXCEPTION_PRINT("alarm_manager_call_alarm_delete_all_sync() failed. return_code[%d]", return_code);
@@ -357,9 +334,8 @@ bool _send_alarm_delete_all(alarm_context_t context, int *error_code)
        }
 
        if (return_code != 0) {
-               if (error_code) {
+               if (error_code)
                        *error_code = return_code;
-               }
                return false;
        }
 
@@ -367,20 +343,20 @@ bool _send_alarm_delete_all(alarm_context_t context, int *error_code)
 }
 
 bool _send_alarm_get_list_of_ids(alarm_context_t context, int maxnum_of_ids,
-                                alarm_id_t *alarm_id, int *num_of_ids,
-                                int *error_code)
+               alarm_id_t *alarm_id, int *num_of_ids,
+               int *error_code)
 {
        GError *error = NULL;
        GVariant *alarm_array = NULL;
        int return_code = 0;
 
        if (!alarm_manager_call_alarm_get_list_of_ids_sync((AlarmManager*)context.proxy,
-                            maxnum_of_ids, &alarm_array,
-                            num_of_ids, &return_code, NULL, &error)) {
+                               maxnum_of_ids, &alarm_array,
+                               num_of_ids, &return_code, NULL, &error)) {
                /* g_dbus_proxy_call_sync error */
                /*error_code should be set */
                ALARM_MGR_EXCEPTION_PRINT(
-               "alarm_manager_call_alarm_get_list_of_ids_sync() failed by dbus. alarm_id[%d], return_code[%d]\n", alarm_id, return_code);
+                               "alarm_manager_call_alarm_get_list_of_ids_sync() failed by dbus. alarm_id[%d], return_code[%d]\n", alarm_id, return_code);
                ALARM_MGR_EXCEPTION_PRINT("error->message is %s(%d)", error->message, error->code);
                if (error_code) {
                        if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -394,22 +370,18 @@ bool _send_alarm_get_list_of_ids(alarm_context_t context, int maxnum_of_ids,
        }
 
        if (return_code != 0) {
-               if (error_code) {
+               if (error_code)
                        *error_code = return_code;
-               }
                return false;
-       }
-       else
-       {
+       } else {
                GVariantIter *iter = NULL;
                gint i = 0;
-               g_variant_get (alarm_array, "ai", &iter);
-               while (g_variant_iter_loop (iter, "i", &alarm_id[i]))
-               {
+               g_variant_get(alarm_array, "ai", &iter);
+               while (g_variant_iter_loop(iter, "i", &alarm_id[i])) {
                        ALARM_MGR_LOG_PRINT("alarm_id (%d)", alarm_id[i]);
                        i++;
                }
-               g_variant_iter_free (iter);
+               g_variant_iter_free(iter);
                *num_of_ids = i;
                g_variant_unref(alarm_array);
        }
@@ -418,7 +390,7 @@ bool _send_alarm_get_list_of_ids(alarm_context_t context, int maxnum_of_ids,
 }
 
 bool _send_alarm_get_number_of_ids(alarm_context_t context, int *num_of_ids,
-                                  int *error_code)
+               int *error_code)
 {
        GError *error = NULL;
        gint return_code = 0;
@@ -427,8 +399,8 @@ bool _send_alarm_get_number_of_ids(alarm_context_t context, int *num_of_ids,
                /* g_dbus_proxy_call_sync error */
                /* error_code should be set */
                ALARM_MGR_EXCEPTION_PRINT(
-               "alarm_manager_call_alarm_get_number_of_ids_sync() failed by dbus. return_code[%d], return_code[%s].",
-               return_code, error->message);
+                               "alarm_manager_call_alarm_get_number_of_ids_sync() failed by dbus. return_code[%d], return_code[%s].",
+                               return_code, error->message);
                ALARM_MGR_EXCEPTION_PRINT("error->message is %s(%d)", error->message, error->code);
 
                if (error_code) {
@@ -442,9 +414,8 @@ bool _send_alarm_get_number_of_ids(alarm_context_t context, int *num_of_ids,
        }
 
        if (return_code != 0) {
-               if (error_code) {
+               if (error_code)
                        *error_code = return_code;
-               }
                return false;
        }
 
@@ -452,24 +423,24 @@ bool _send_alarm_get_number_of_ids(alarm_context_t context, int *num_of_ids,
 }
 
 bool _send_alarm_get_info(alarm_context_t context, alarm_id_t alarm_id,
-                         alarm_info_t *alarm_info, int *error_code)
+               alarm_info_t *alarm_info, int *error_code)
 {
        GError *error = NULL;
        int return_code = 0;
 
        if (!alarm_manager_call_alarm_get_info_sync((AlarmManager*)context.proxy,
-               alarm_id, &alarm_info->start.year,
-               &alarm_info->start.month, &alarm_info->start.day,
-               &alarm_info->start.hour, &alarm_info->start.min,
-               &alarm_info->start.sec, &alarm_info->end.year,
-               &alarm_info->end.month, &alarm_info->end.day,
-               &alarm_info->mode.u_interval.day_of_week,
-               (gint *)&alarm_info->mode.repeat,
-               &alarm_info->alarm_type, &alarm_info->reserved_info, &return_code, NULL, &error)) {
+                               alarm_id, &alarm_info->start.year,
+                               &alarm_info->start.month, &alarm_info->start.day,
+                               &alarm_info->start.hour, &alarm_info->start.min,
+                               &alarm_info->start.sec, &alarm_info->end.year,
+                               &alarm_info->end.month, &alarm_info->end.day,
+                               &alarm_info->mode.u_interval.day_of_week,
+                               (gint *)&alarm_info->mode.repeat,
+                               &alarm_info->alarm_type, &alarm_info->reserved_info, &return_code, NULL, &error)) {
                /* g_dbus_proxy_call_sync error */
                /* error_code should be set */
                ALARM_MGR_EXCEPTION_PRINT(
-               "alarm_manager_call_alarm_get_info_sync() failed by dbus. alarm_id[%d], return_code[%d]\n", alarm_id, return_code);
+                               "alarm_manager_call_alarm_get_info_sync() failed by dbus. alarm_id[%d], return_code[%d]\n", alarm_id, return_code);
                ALARM_MGR_EXCEPTION_PRINT("error->message is %s(%d)", error->message, error->code);
                if (error_code) {
                        if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -482,9 +453,8 @@ bool _send_alarm_get_info(alarm_context_t context, alarm_id_t alarm_id,
        }
 
        if (return_code != 0) {
-               if (error_code) {
+               if (error_code)
                        *error_code = return_code;
-               }
                return false;
        }
 
@@ -492,18 +462,18 @@ bool _send_alarm_get_info(alarm_context_t context, alarm_id_t alarm_id,
 }
 
 bool _send_alarm_get_next_duetime(alarm_context_t context,
-                                alarm_id_t alarm_id, time_t* duetime,
-                                int *error_code)
+               alarm_id_t alarm_id, time_t* duetime,
+               int *error_code)
 {
        GError *error = NULL;
        int return_code = 0;
 
        if (!alarm_manager_call_alarm_get_next_duetime_sync((AlarmManager*)context.proxy,
-                            alarm_id, (gint *)duetime, &return_code, NULL, &error)) {
+                               alarm_id, (gint *)duetime, &return_code, NULL, &error)) {
                /*g_dbus_proxy_call_sync error */
                /*error_code should be set */
                ALARM_MGR_EXCEPTION_PRINT(
-               "alarm_manager_call_alarm_get_next_duetime_sync() failed by dbus. alarm_id[%d], return_code[%d]\n", alarm_id, return_code);
+                               "alarm_manager_call_alarm_get_next_duetime_sync() failed by dbus. alarm_id[%d], return_code[%d]\n", alarm_id, return_code);
                ALARM_MGR_EXCEPTION_PRINT("error->message is %s(%d)", error->message, error->code);
                if (error_code) {
                        if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
@@ -516,9 +486,8 @@ bool _send_alarm_get_next_duetime(alarm_context_t context,
        }
 
        if (return_code != 0) {
-               if (error_code) {
+               if (error_code)
                        *error_code = return_code;
-               }
                return false;
        }
 
@@ -546,9 +515,8 @@ bool _send_alarm_get_all_info(alarm_context_t context, char ** db_path, int *err
        }
 
        if (return_code != ALARMMGR_RESULT_SUCCESS) {
-               if (error_code) {
+               if (error_code)
                        *error_code = return_code;
-               }
                return false;
        }
 
@@ -568,23 +536,20 @@ bool _send_alarm_set_time(alarm_context_t context, int new_time, int *error_code
                        ALARM_MGR_EXCEPTION_PRINT("dbus error message: %s", error->message);
                        g_error_free(error);
                }
-               if (error_code) {
+               if (error_code)
                        *error_code = ERR_ALARM_SYSTEM_FAIL;
-               }
                return false;
        }
 
        if (return_code != ALARMMGR_RESULT_SUCCESS) {
-               if (error_code) {
+               if (error_code)
                        *error_code = return_code;
-               }
                return false;
        }
 
        return true;
 }
 
-
 bool _send_alarm_set_time_with_propagation_delay(alarm_context_t context, unsigned int new_sec, unsigned int new_nsec, unsigned int req_sec, unsigned int req_nsec, int *error_code)
 {
        GError *error = NULL;
@@ -606,9 +571,8 @@ bool _send_alarm_set_time_with_propagation_delay(alarm_context_t context, unsign
        }
 
        if (return_code != ALARMMGR_RESULT_SUCCESS) {
-               if (error_code) {
+               if (error_code)
                        *error_code = return_code;
-               }
                return false;
        }
 
@@ -636,9 +600,8 @@ bool _send_alarm_set_timezone(alarm_context_t context, char *tzpath_str, int *er
        }
 
        if (return_code != ALARMMGR_RESULT_SUCCESS) {
-               if (error_code) {
+               if (error_code)
                        *error_code = return_code;
-               }
                return false;
        }
 
@@ -666,9 +629,8 @@ bool _send_alarm_set_global(alarm_context_t context, const alarm_id_t alarm_id,
        }
 
        if (return_code != ALARMMGR_RESULT_SUCCESS) {
-               if (error_code) {
+               if (error_code)
                        *error_code = return_code;
-               }
                return false;
        }
 
@@ -697,9 +659,8 @@ bool _send_alarm_get_global(alarm_context_t context, const alarm_id_t alarm_id,
        }
 
        if (return_code != ALARMMGR_RESULT_SUCCESS) {
-               if (error_code) {
+               if (error_code)
                        *error_code = return_code;
-               }
                return false;
        }
 
index c8b7058..29cfaec 100644 (file)
@@ -1,10 +1,5 @@
 /*
- *  alarm-manager
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Venkatesha Sarpangala <sarpangala.v@samsung.com>, Jayoun Lee <airjany@samsung.com>,
- * Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
+ * Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,7 +12,6 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
  */
 
 #define _GNU_SOURCE
@@ -75,7 +69,7 @@ static void __add_resultcb(alarm_id_t alarm_id, alarm_cb_t cb_func, void *data)
        alarm_cb_info_t *info;
 
        info = (alarm_cb_info_t *) malloc(sizeof(alarm_cb_info_t));
-       if(info == NULL)
+       if (info == NULL)
                return;
        info->alarm_id = alarm_id;
        info->cb_func = cb_func;
@@ -138,23 +132,20 @@ static void __handle_expired_signal(GDBusConnection *conn,
        g_variant_get(param, "(is)", &alarm_id, &package_name);
        ALARM_MGR_LOG_PRINT("[alarm-lib] : Alarm expired for [%s] : Alarm id [%d]", package_name, alarm_id);
 
-       if (alarm_context.alarm_handler != NULL) {
+       if (alarm_context.alarm_handler != NULL)
                alarm_context.alarm_handler(alarm_id, alarm_context.user_param);
-       }
 
        info = __find_resultcb(alarm_id);
-       if (info && info->cb_func) {
+       if (info && info->cb_func)
                info->cb_func(alarm_id, info->priv_data);
-       }
+
        g_free(package_name);
 }
 
 static int __alarm_validate_date(alarm_date_t *date, int *error_code)
 {
-
-       if (date->year == 0 && date->month == 0 && date->day == 0) {
+       if (date->year == 0 && date->month == 0 && date->day == 0)
                return true;
-       }
 
        int year = date->year;
        int month = date->month;
@@ -167,15 +158,15 @@ static int __alarm_validate_date(alarm_date_t *date, int *error_code)
        }
 
        if ((month == 1 || month == 3 || month == 5 || month == 7 || month == 8
-            || month == 10 || month == 12)
-           && (day < 1 || day > 31)) {
+                               || month == 10 || month == 12)
+                       && (day < 1 || day > 31)) {
                if (error_code)
                        *error_code = ERR_ALARM_INVALID_DATE;
                return false;
        }
 
        if ((month == 4 || month == 6 || month == 9 || month == 11)
-           && (day < 1 || day > 30)) {
+                       && (day < 1 || day > 30)) {
                if (error_code)
                        *error_code = ERR_ALARM_INVALID_DATE;
                return false;
@@ -199,7 +190,6 @@ static int __alarm_validate_date(alarm_date_t *date, int *error_code)
        }
 
        return true;
-
 }
 
 static bool __alarm_validate_time(alarm_date_t *date, int *error_code)
@@ -219,7 +209,8 @@ static bool __alarm_validate_time(alarm_date_t *date, int *error_code)
        return true;
 }
 
-static int __compare_api_version(int *result, uid_t uid) {
+static int __compare_api_version(int *result, uid_t uid)
+{
        int ret = 0;
        pkgmgrinfo_pkginfo_h pkginfo = NULL;
        char pkgid[512] = {0, };
@@ -233,9 +224,9 @@ static int __compare_api_version(int *result, uid_t uid) {
                        ALARM_MGR_EXCEPTION_PRINT("Failed to get pkginfo\n");
                } else {
                        ret = pkgmgrinfo_pkginfo_get_api_version(pkginfo, &pkg_version);
-                       if (ret != PMINFO_R_OK) {
+                       if (ret != PMINFO_R_OK)
                                ALARM_MGR_EXCEPTION_PRINT("Failed to check api version [%d]\n", ret);
-                       }
+
                        *result = strverscmp(pkg_version, "2.4");
                        pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo);
                }
@@ -298,9 +289,10 @@ static bool __is_permitted(const char *app_id, int alarm_type)
                }
        }
 
-out :
+out:
        if (handle)
                pkgmgrinfo_appinfo_destroy_appinfo(handle);
+
        return _return;
 }
 
@@ -333,17 +325,17 @@ static int __sub_init()
        }
 
        alarm_context.proxy = g_dbus_proxy_new_sync(alarm_context.connection,
-                                                       G_DBUS_PROXY_FLAGS_NONE,
-                                                       NULL,
-                                                       "org.tizen.alarm.manager",
-                                                       "/org/tizen/alarm/manager",
-                                                       "org.tizen.alarm.manager",
-                                                       NULL,
-                                                       NULL);
+                       G_DBUS_PROXY_FLAGS_NONE,
+                       NULL,
+                       "org.tizen.alarm.manager",
+                       "/org/tizen/alarm/manager",
+                       "org.tizen.alarm.manager",
+                       NULL,
+                       NULL);
 
        if (alarm_context.proxy == NULL) {
                ALARM_MGR_EXCEPTION_PRINT("Creating a proxy is failed.");
-               g_object_unref (alarm_context.connection);
+               g_object_unref(alarm_context.connection);
                pthread_mutex_unlock(&init_lock);
                return ERR_ALARM_SYSTEM_FAIL;
        }
@@ -370,7 +362,7 @@ EXPORT_API int alarmmgr_init(const char *appid)
 
        if (b_initialized) {
                SECURE_LOGD("alarm was already initialized. app_service_name=%s",
-                    g_quark_to_string(alarm_context.quark_app_service_name));
+                               g_quark_to_string(alarm_context.quark_app_service_name));
                return ALARMMGR_RESULT_SUCCESS;
        }
 
@@ -443,12 +435,10 @@ EXPORT_API int alarmmgr_set_cb(alarm_cb_t handler, void *user_param)
 
 EXPORT_API alarm_entry_t *alarmmgr_create_alarm(void)
 {
-       alarm_info_t *alarm = (alarm_info_t *) malloc(sizeof(alarm_info_t));
+       alarm_info_t *alarm = (alarm_info_t *)malloc(sizeof(alarm_info_t));
 
-       if (NULL == alarm)
-       {
+       if (alarm == NULL)
                return NULL;
-       }
 
        alarm->start.year = 0;
        alarm->start.month = 0;
@@ -476,9 +466,9 @@ EXPORT_API alarm_entry_t *alarmmgr_create_alarm(void)
 
 EXPORT_API int alarmmgr_free_alarm(alarm_entry_t *alarm)
 {
-       if (alarm == NULL) {
+       if (alarm == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
+
        free(alarm);
 
        return ALARMMGR_RESULT_SUCCESS;
@@ -486,15 +476,13 @@ EXPORT_API int alarmmgr_free_alarm(alarm_entry_t *alarm)
 
 EXPORT_API int alarmmgr_set_time(alarm_entry_t *alarm, alarm_date_t time)
 {
-       alarm_info_t *alarm_info;       /*= (alarm_info_t*)alarm;*/
+       alarm_info_t *alarm_info;
        int error_code;
 
-       if (alarm == NULL) {
+       if (alarm == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
-
-       alarm_info = (alarm_info_t *) alarm;
 
+       alarm_info = (alarm_info_t *)alarm;
        if (!__alarm_validate_date(&time, &error_code)) {
                ALARM_MGR_EXCEPTION_PRINT("start date error\n");
                return error_code;
@@ -511,13 +499,12 @@ EXPORT_API int alarmmgr_set_time(alarm_entry_t *alarm, alarm_date_t time)
 }
 
 EXPORT_API int alarmmgr_get_time(const alarm_entry_t *alarm,
-                                alarm_date_t *time)
+               alarm_date_t *time)
 {
-       alarm_info_t *alarm_info = (alarm_info_t *) alarm;
+       alarm_info_t *alarm_info = (alarm_info_t *)alarm;
 
-       if (alarm == NULL) {
+       if (alarm == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
        if (time != NULL)
                memcpy(time, &alarm_info->start, sizeof(alarm_date_t));
@@ -526,22 +513,19 @@ EXPORT_API int alarmmgr_get_time(const alarm_entry_t *alarm,
 }
 
 EXPORT_API int alarmmgr_set_repeat_mode(alarm_entry_t *alarm,
-                                       alarm_repeat_mode_t repeat,
-                                       int interval)
+               alarm_repeat_mode_t repeat, int interval)
 {
-       alarm_info_t *alarm_info = (alarm_info_t *) alarm;
+       alarm_info_t *alarm_info = (alarm_info_t *)alarm;
 
-       if (repeat >= ALARM_REPEAT_MODE_MAX) {
+       if (repeat >= ALARM_REPEAT_MODE_MAX)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
        alarm_info->mode.repeat = repeat;
 
        if (repeat == ALARM_REPEAT_MODE_REPEAT
-           || repeat == ALARM_REPEAT_MODE_WEEKLY) {
-               if (interval <= 0) {
+                       || repeat == ALARM_REPEAT_MODE_WEEKLY) {
+               if (interval <= 0)
                        return ERR_ALARM_INVALID_PARAM;
-               }
                alarm_info->mode.u_interval.interval = interval;
        }
 
@@ -549,14 +533,12 @@ EXPORT_API int alarmmgr_set_repeat_mode(alarm_entry_t *alarm,
 }
 
 EXPORT_API int alarmmgr_get_repeat_mode(const alarm_entry_t *alarm,
-                                       alarm_repeat_mode_t *repeat,
-                                       int *interval)
+               alarm_repeat_mode_t *repeat, int *interval)
 {
-       alarm_info_t *alarm_info = (alarm_info_t *) alarm;
+       alarm_info_t *alarm_info = (alarm_info_t *)alarm;
 
-       if (alarm == NULL) {
+       if (alarm == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
        if (repeat != NULL)
                *repeat = alarm_info->mode.repeat;
@@ -568,14 +550,12 @@ EXPORT_API int alarmmgr_get_repeat_mode(const alarm_entry_t *alarm,
 
 EXPORT_API int alarmmgr_set_type(alarm_entry_t *alarm, int alarm_type)
 {
-       alarm_info_t *alarm_info;       /*= (alarm_info_t*)alarm;*/
+       alarm_info_t *alarm_info;
 
-       if (alarm == NULL) {
+       if (alarm == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
-
-       alarm_info = (alarm_info_t *) alarm;
 
+       alarm_info = (alarm_info_t *)alarm;
        alarm_info->alarm_type = alarm_type;
        alarm_info->alarm_type &= (~ALARM_TYPE_RELATIVE);
 
@@ -584,11 +564,10 @@ EXPORT_API int alarmmgr_set_type(alarm_entry_t *alarm, int alarm_type)
 
 EXPORT_API int alarmmgr_get_type(const alarm_entry_t *alarm, int *alarm_type)
 {
-       alarm_info_t *alarm_info = (alarm_info_t *) alarm;
+       alarm_info_t *alarm_info = (alarm_info_t *)alarm;
 
-       if (alarm == NULL) {
+       if (alarm == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
        if (alarm_type != NULL)
                *alarm_type = alarm_info->alarm_type;
@@ -596,7 +575,6 @@ EXPORT_API int alarmmgr_get_type(const alarm_entry_t *alarm, int *alarm_type)
        return ALARMMGR_RESULT_SUCCESS;
 }
 
-
 static int __alarmmgr_init_appsvc(void)
 {
        if (b_initialized) {
@@ -612,45 +590,45 @@ static int __alarmmgr_init_appsvc(void)
        return ALARMMGR_RESULT_SUCCESS;
 }
 
-EXPORT_API void *alarmmgr_get_alarm_appsvc_info(alarm_id_t alarm_id, int *return_code){
+EXPORT_API void *alarmmgr_get_alarm_appsvc_info(alarm_id_t alarm_id, int *return_code)
+{
 
        int ret = 0;
 
        ret = __sub_init();
-       if (ret < 0){
-               if (return_code) {
+       if (ret < 0) {
+               if (return_code)
                        *return_code = ret;
-               }
+
                return NULL;
        }
 
        ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_get_alarm_appsvc_info() is called.");
 
        if (alarm_id <= 0) {
-               if (return_code) {
+               if (return_code)
                        *return_code = ERR_ALARM_INVALID_ID;
-               }
+
                return NULL;
        }
 
        return _send_alarm_get_appsvc_info(alarm_context, alarm_id, return_code);
-
 }
 
-EXPORT_API int alarmmgr_set_rtc_time(alarm_date_t *time){
+EXPORT_API int alarmmgr_set_rtc_time(alarm_date_t *time)
+{
 
        int ret = 0;
        int error_code = 0;
 
-       if (!time){
+       if (!time) {
                ALARM_MGR_EXCEPTION_PRINT("Invalid parameter time\n");
                return ERR_ALARM_INVALID_PARAM;
        }
 
        ret = __sub_init();
-       if (ret < 0){
+       if (ret < 0)
                return ret;
-       }
 
        ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_set_rtc_time() is called\n");
 
@@ -664,16 +642,13 @@ EXPORT_API int alarmmgr_set_rtc_time(alarm_date_t *time){
                return error_code;
        }
 
-       time->year-=1900;
-       time->month-=1;
+       time->year -= 1900;
+       time->month -= 1;
 
-       if (!_send_alarm_set_rtc_time
-               (alarm_context, time, &error_code)){
-                       return error_code;
-       }
+       if (!_send_alarm_set_rtc_time(alarm_context, time, &error_code))
+               return error_code;
 
        return ALARMMGR_RESULT_SUCCESS;
-
 }
 
 EXPORT_API int alarmmgr_add_alarm_appsvc_with_localtime(alarm_entry_t *alarm, void *bundle_data, alarm_id_t *alarm_id)
@@ -683,41 +658,32 @@ EXPORT_API int alarmmgr_add_alarm_appsvc_with_localtime(alarm_entry_t *alarm, vo
        int error_code = 0;
        const char *appid = NULL;
        int result;
-
-       bundle *b=(bundle *)bundle_data;
+       bundle *b;
 
        ALARM_MGR_LOG_PRINT("[alarm-lib]:alarm_create() is called\n");
 
-       if (alarm == NULL) {
+       if (alarm == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
-       if (NULL == b)
-       {
+       b = (bundle *)bundle_data;
+       if (b == NULL) {
                ALARM_MGR_EXCEPTION_PRINT("Invalid parameter bundle\n");
                return ERR_ALARM_INVALID_PARAM;
        }
 
        operation = appsvc_get_operation(b);
-
-       if (NULL == operation)
-       {
+       if (operation == NULL)
                appsvc_set_operation(b, APPSVC_OPERATION_DEFAULT);
-       }
 
-       if (__alarmmgr_init_appsvc() < 0)
-       {
+       if (__alarmmgr_init_appsvc() < 0) {
                ALARM_MGR_EXCEPTION_PRINT("Unable to initialize dbus!!!\n");
                return ERR_ALARM_SYSTEM_FAIL;
        }
 
-       alarm_info = (alarm_info_t *) alarm;
-
+       alarm_info = (alarm_info_t *)alarm;
        appid = appsvc_get_appid(b);
-
-       if ( (NULL == appid && (alarm_info->alarm_type & ALARM_TYPE_NOLAUNCH)) ||
-                       (NULL == appid && operation && !strcmp(operation, APPSVC_OPERATION_DEFAULT)) )
-       {
+       if ((appid == NULL && (alarm_info->alarm_type & ALARM_TYPE_NOLAUNCH)) ||
+                       (appid == NULL && operation && !strcmp(operation, APPSVC_OPERATION_DEFAULT))) {
                ALARM_MGR_EXCEPTION_PRINT("Invalid parameter\n");
                return ERR_ALARM_INVALID_PARAM;
        }
@@ -737,15 +703,14 @@ EXPORT_API int alarmmgr_add_alarm_appsvc_with_localtime(alarm_entry_t *alarm, vo
        alarm_mode_t *mode = &alarm_info->mode;
 
        ALARM_MGR_EXCEPTION_PRINT("start(%d-%d-%d, %02d:%02d:%02d), end(%d-%d-%d), repeat(%d), interval(%d), type(%d)",
-               alarm_info->start.day, alarm_info->start.month, alarm_info->start.year,
-               alarm_info->start.hour, alarm_info->start.min, alarm_info->start.sec,
-               alarm_info->end.year, alarm_info->end.month, alarm_info->end.day,
-               alarm_info->mode.repeat, alarm_info->mode.u_interval, alarm_info->alarm_type);
+                       alarm_info->start.day, alarm_info->start.month, alarm_info->start.year,
+                       alarm_info->start.hour, alarm_info->start.min, alarm_info->start.sec,
+                       alarm_info->end.year, alarm_info->end.month, alarm_info->end.day,
+                       alarm_info->mode.repeat, alarm_info->mode.u_interval, alarm_info->alarm_type);
 
        /* TODO: This should be changed to > ALARM_REPEAT_MODE_MAX ? */
-       if (mode->repeat >= ALARM_REPEAT_MODE_MAX) {
+       if (mode->repeat >= ALARM_REPEAT_MODE_MAX)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
        if (!__alarm_validate_date(&alarm_info->start, &error_code)) {
                ALARM_MGR_EXCEPTION_PRINT("start date error\n");
@@ -762,20 +727,15 @@ EXPORT_API int alarmmgr_add_alarm_appsvc_with_localtime(alarm_entry_t *alarm, vo
                return error_code;
        }
 
-
-       if (!_send_alarm_create_appsvc(alarm_context, alarm_info, alarm_id, b, &error_code)) {
+       if (!_send_alarm_create_appsvc(alarm_context, alarm_info, alarm_id, b, &error_code))
                return error_code;
-       }
 
        return ALARMMGR_RESULT_SUCCESS;
 }
 
-
-
-
 EXPORT_API int alarmmgr_add_alarm_with_localtime(alarm_entry_t *alarm,
-                                                const char *destination,
-                                                alarm_id_t *alarm_id)
+               const char *destination,
+               alarm_id_t *alarm_id)
 {
        char dst_service_name[MAX_SERVICE_NAME_LEN] = { 0 };
        char dst_service_name_mod[MAX_SERVICE_NAME_LEN] = { 0 };
@@ -786,14 +746,12 @@ EXPORT_API int alarmmgr_add_alarm_with_localtime(alarm_entry_t *alarm,
 
        ALARM_MGR_LOG_PRINT("[alarm-lib]:alarm_create() is called\n");
 
-       if (alarm == NULL) {
+       if (alarm == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
        alarm_info = (alarm_info_t *) alarm;
-       if (alarm_info == NULL || alarm_id == NULL) {
+       if (alarm_info == NULL || alarm_id == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
        int error_code;
        alarm_mode_t *mode = &alarm_info->mode;
@@ -803,17 +761,16 @@ EXPORT_API int alarmmgr_add_alarm_with_localtime(alarm_entry_t *alarm,
                return ret;
 
        ALARM_MGR_LOG_PRINT("start(%d-%d-%d, %02d:%02d:%02d), end(%d-%d-%d), repeat(%d), interval(%d), type(%d)",
-               alarm_info->start.day, alarm_info->start.month, alarm_info->start.year,
-               alarm_info->start.hour, alarm_info->start.min, alarm_info->start.sec,
-               alarm_info->end.year, alarm_info->end.month, alarm_info->end.day,
-               alarm_info->mode.repeat, alarm_info->mode.u_interval, alarm_info->alarm_type);
+                       alarm_info->start.day, alarm_info->start.month, alarm_info->start.year,
+                       alarm_info->start.hour, alarm_info->start.min, alarm_info->start.sec,
+                       alarm_info->end.year, alarm_info->end.month, alarm_info->end.day,
+                       alarm_info->mode.repeat, alarm_info->mode.u_interval, alarm_info->alarm_type);
 
        /* TODO: This should be changed to > ALARM_REPEAT_MODE_MAX ? */
-       if (mode->repeat >= ALARM_REPEAT_MODE_MAX) {
+       if (mode->repeat >= ALARM_REPEAT_MODE_MAX)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
-       if (destination && strlen(destination) >= MAX_PKG_NAME_LEN){
+       if (destination && strlen(destination) >= MAX_PKG_NAME_LEN) {
                ALARM_MGR_EXCEPTION_PRINT("[alarm-lib]: destination name is too long!\n");
                return ERR_ALARM_INVALID_PARAM;
        }
@@ -839,37 +796,29 @@ EXPORT_API int alarmmgr_add_alarm_with_localtime(alarm_entry_t *alarm,
                snprintf(dst_service_name, MAX_SERVICE_NAME_LEN, "ALARM.%s", destination);
                memset(dst_service_name_mod, 'a', MAX_SERVICE_NAME_LEN-1);
 
-               for (i=0; i<=strlen(dst_service_name); i++)
-               {
-                       if (dst_service_name[i] == '.' )
-                       {
+               for (i = 0; i <= strlen(dst_service_name); i++) {
+                       if (dst_service_name[i] == '.') {
                                dst_service_name_mod[j] = dst_service_name[i];
                                j++;
-                       }
-                       else
-                       {
+                       } else {
                                dst_service_name_mod[j] = dst_service_name[i];
                        }
                        j++;
                }
 
-               if (!_send_alarm_create(alarm_context, alarm_info, alarm_id, dst_service_name, dst_service_name_mod, &error_code)) {
+               if (!_send_alarm_create(alarm_context, alarm_info, alarm_id, dst_service_name, dst_service_name_mod, &error_code))
                        return error_code;
-               }
        } else {
-               if (!_send_alarm_create(alarm_context, alarm_info, alarm_id, "null", "null", &error_code)) {
+               if (!_send_alarm_create(alarm_context, alarm_info, alarm_id, "null", "null", &error_code))
                        return error_code;
-               }
        }
 
        return ALARMMGR_RESULT_SUCCESS;
 }
 
-
-
 EXPORT_API int alarmmgr_add_alarm_appsvc(int alarm_type, time_t trigger_at_time,
-                                 time_t interval, void *bundle_data,
-                                 alarm_id_t *alarm_id)
+               time_t interval, void *bundle_data,
+               alarm_id_t *alarm_id)
 {
        int error_code = 0;
        int result;
@@ -878,45 +827,38 @@ EXPORT_API int alarmmgr_add_alarm_appsvc(int alarm_type, time_t trigger_at_time,
        alarm_info_t alarm_info;
        const char *operation = NULL;
        const char *appid = NULL;
+       bundle *b;
 
        ALARM_MGR_LOG_PRINT("[alarm-lib]:alarm_create() is called\n");
 
-       bundle *b=(bundle *)bundle_data;
-
-       if (NULL == b)
-       {
+       b = (bundle *)bundle_data;
+       if (b == NULL) {
                ALARM_MGR_EXCEPTION_PRINT("Invalid parameter bundle\n");
                return ERR_ALARM_INVALID_PARAM;
        }
-       operation = appsvc_get_operation(b);
 
-       if (NULL == operation)
-       {
+       operation = appsvc_get_operation(b);
+       if (operation == NULL)
                appsvc_set_operation(b, APPSVC_OPERATION_DEFAULT);
-       }
 
        appid = appsvc_get_appid(b);
 
-       if ( (NULL == appid && (alarm_type & ALARM_TYPE_NOLAUNCH)) ||
-                       (NULL == appid && operation && !strcmp(operation, APPSVC_OPERATION_DEFAULT)) )
-       {
+       if ((appid == NULL && (alarm_type & ALARM_TYPE_NOLAUNCH)) ||
+                       (appid == NULL && operation && !strcmp(operation, APPSVC_OPERATION_DEFAULT))) {
                ALARM_MGR_EXCEPTION_PRINT("Invalid parameter\n");
                return ERR_ALARM_INVALID_PARAM;
        }
 
-       if (__alarmmgr_init_appsvc() < 0)
-       {
+       if (__alarmmgr_init_appsvc() < 0) {
                ALARM_MGR_EXCEPTION_PRINT("Unable to initialize dbus!!!\n");
                return ERR_ALARM_SYSTEM_FAIL;
        }
 
-       if (alarm_id == NULL) {
+       if (alarm_id == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
-       if (trigger_at_time < 0) {
+       if (trigger_at_time < 0)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
        alarm_info.alarm_type = alarm_type;
        alarm_info.alarm_type |= ALARM_TYPE_RELATIVE;
@@ -925,10 +867,9 @@ EXPORT_API int alarmmgr_add_alarm_appsvc(int alarm_type, time_t trigger_at_time,
                return ERR_ALARM_SYSTEM_FAIL;
 
        if (result < 0) {
-               if (alarm_info.alarm_type & ALARM_TYPE_INEXACT) {
+               if (alarm_info.alarm_type & ALARM_TYPE_INEXACT)
                        alarm_info.alarm_type ^= ALARM_TYPE_INEXACT;
-               }
-       } else { //Since 2.4
+       } else { /* Since 2.4 */
                if (!__is_permitted(appid, alarm_info.alarm_type)) {
                        ALARM_MGR_EXCEPTION_PRINT("[%s] is not permitted \n", appid);
                        return ERR_ALARM_NOT_PERMITTED_APP;
@@ -936,19 +877,15 @@ EXPORT_API int alarmmgr_add_alarm_appsvc(int alarm_type, time_t trigger_at_time,
        }
 
        gettimeofday(&current_time, NULL);
-
-       if (current_time.tv_usec > 500 * 1000)
-       {
-               // When the millisecond part of the current_time is bigger than 500ms,
-               // the duetime increases by extra 1sec.
+       if (current_time.tv_usec > 500 * 1000) {
+               /* When the millisecond part of the current_time is bigger than 500ms,
+                * the duetime increases by extra 1sec. */
                current_time.tv_sec += (trigger_at_time + 1);
-       }
-       else
-       {
+       } else {
                current_time.tv_sec += trigger_at_time;
        }
 
-       tzset();        // Processes the TZ environment variable, and Set timezone, daylight, and tzname.
+       tzset(); /* Processes the TZ environment variable, and Set timezone, daylight, and tzname. */
        localtime_r(&current_time.tv_sec, &duetime_tm);
 
        alarm_info.start.year = duetime_tm.tm_year + 1900;
@@ -963,9 +900,8 @@ EXPORT_API int alarmmgr_add_alarm_appsvc(int alarm_type, time_t trigger_at_time,
        alarm_info.start.min = duetime_tm.tm_min;
        alarm_info.start.sec = duetime_tm.tm_sec;
 
-       if ((alarm_info.alarm_type & ALARM_TYPE_INEXACT) && interval < MIN_INEXACT_INTERVAL) {
+       if ((alarm_info.alarm_type & ALARM_TYPE_INEXACT) && interval < MIN_INEXACT_INTERVAL)
                interval = MIN_INEXACT_INTERVAL;
-       }
 
        if (interval <= 0) {
                alarm_info.mode.repeat = ALARM_REPEAT_MODE_ONCE;
@@ -976,21 +912,19 @@ EXPORT_API int alarmmgr_add_alarm_appsvc(int alarm_type, time_t trigger_at_time,
        }
 
        ALARM_MGR_LOG_PRINT("trigger_at_time(%d), start(%d-%d-%d, %02d:%02d:%02d), repeat(%d), interval(%d), type(%d)",
-               trigger_at_time, alarm_info.start.day, alarm_info.start.month, alarm_info.start.year,
-               alarm_info.start.hour, alarm_info.start.min, alarm_info.start.sec,
-               alarm_info.mode.repeat, alarm_info.mode.u_interval.interval, alarm_info.alarm_type);
+                       trigger_at_time, alarm_info.start.day, alarm_info.start.month, alarm_info.start.year,
+                       alarm_info.start.hour, alarm_info.start.min, alarm_info.start.sec,
+                       alarm_info.mode.repeat, alarm_info.mode.u_interval.interval, alarm_info.alarm_type);
 
-       if (!_send_alarm_create_appsvc(alarm_context, &alarm_info, alarm_id, b, &error_code)) {
+       if (!_send_alarm_create_appsvc(alarm_context, &alarm_info, alarm_id, b, &error_code))
                return error_code;
-       }
 
        return ALARMMGR_RESULT_SUCCESS;
 }
 
-
 EXPORT_API int alarmmgr_add_alarm(int alarm_type, time_t trigger_at_time,
-                                 time_t interval, const char *destination,
-                                 alarm_id_t *alarm_id)
+               time_t interval, const char *destination,
+               alarm_id_t *alarm_id)
 {
        char dst_service_name[MAX_SERVICE_NAME_LEN] = { 0 };
        char dst_service_name_mod[MAX_SERVICE_NAME_LEN] = { 0 };
@@ -1009,15 +943,13 @@ EXPORT_API int alarmmgr_add_alarm(int alarm_type, time_t trigger_at_time,
        if (ret < 0)
                return ret;
 
-       if (alarm_id == NULL) {
+       if (alarm_id == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
-       if (trigger_at_time < 0) {
+       if (trigger_at_time < 0)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
-       if (destination && strlen(destination) >= MAX_PKG_NAME_LEN){
+       if (destination && strlen(destination) >= MAX_PKG_NAME_LEN) {
                ALARM_MGR_EXCEPTION_PRINT("[alarm-lib]: destination name is too long!\n");
                return ERR_ALARM_INVALID_PARAM;
        }
@@ -1027,18 +959,15 @@ EXPORT_API int alarmmgr_add_alarm(int alarm_type, time_t trigger_at_time,
 
        gettimeofday(&current_time, NULL);
 
-       if (current_time.tv_usec > 500 * 1000)
-       {
-               // When the millisecond part of the current_time is bigger than 500ms,
-               // the duetime increases by extra 1sec.
+       if (current_time.tv_usec > 500 * 1000) {
+               /* When the millisecond part of the current_time is bigger than 500ms,
+                * the duetime increases by extra 1sec. */
                current_time.tv_sec += (trigger_at_time + 1);
-       }
-       else
-       {
+       } else {
                current_time.tv_sec += trigger_at_time;
        }
 
-       tzset();        // Processes the TZ environment variable, and Set timezone, daylight, and tzname.
+       tzset(); /* Processes the TZ environment variable, and Set timezone, daylight, and tzname. */
        localtime_r(&current_time.tv_sec, &duetime_tm);
 
        alarm_info.start.year = duetime_tm.tm_year + 1900;
@@ -1062,49 +991,44 @@ EXPORT_API int alarmmgr_add_alarm(int alarm_type, time_t trigger_at_time,
        }
 
        ALARM_MGR_LOG_PRINT("trigger_at_time(%d), start(%d-%d-%d, %02d:%02d:%02d), repeat(%d), interval(%d), type(%d)",
-               trigger_at_time, alarm_info.start.day, alarm_info.start.month, alarm_info.start.year,
-               alarm_info.start.hour, alarm_info.start.min, alarm_info.start.sec,
-               alarm_info.mode.repeat, alarm_info.mode.u_interval, alarm_info.alarm_type);
+                       trigger_at_time, alarm_info.start.day, alarm_info.start.month, alarm_info.start.year,
+                       alarm_info.start.hour, alarm_info.start.min, alarm_info.start.sec,
+                       alarm_info.mode.repeat, alarm_info.mode.u_interval, alarm_info.alarm_type);
 
        if (destination != NULL) {
                memset(dst_service_name, 0,
-                      strlen(destination) + strlen("ALARM.") + 2);
+                               strlen(destination) + strlen("ALARM.") + 2);
                snprintf(dst_service_name, MAX_SERVICE_NAME_LEN, "ALARM.%s",
-                        destination);
-               memset(dst_service_name_mod,'a',MAX_SERVICE_NAME_LEN-1);
-
-               j=0;
-
-               for(i=0;i<=strlen(dst_service_name);i++)
-               {
-                       if (dst_service_name[i] == '.')
-                       {
-                               dst_service_name_mod[j]=dst_service_name[i];
-                               j++;
-                       }
-                       else
-                       {
-                               dst_service_name_mod[j]=dst_service_name[i];
-                       }
-                       j++;
-               }
-
-               if (!_send_alarm_create
-                   (alarm_context, &alarm_info, alarm_id, dst_service_name,dst_service_name_mod,
-                    &error_code)) {
-                       return error_code;
+                               destination);
+               memset(dst_service_name_mod, 'a', MAX_SERVICE_NAME_LEN - 1);
+
+               j = 0;
+               for (i = 0; i <= strlen(dst_service_name); i++) {
+                       if (dst_service_name[i] == '.') {
+                               dst_service_name_mod[j] = dst_service_name[i];
+                               j++;
+                       } else {
+                               dst_service_name_mod[j] = dst_service_name[i];
+                       }
+                       j++;
                }
-       } else
-           if (!_send_alarm_create
-               (alarm_context, &alarm_info, alarm_id, "null","null", &error_code)) {
-               return error_code;
+
+               if (!_send_alarm_create(alarm_context, &alarm_info,
+                                       alarm_id, dst_service_name,
+                                       dst_service_name_mod,
+                                       &error_code))
+                       return error_code;
+       } else {
+               if (!_send_alarm_create(alarm_context, &alarm_info, alarm_id,
+                                       "null", "null", &error_code))
+                       return error_code;
        }
 
        return ALARMMGR_RESULT_SUCCESS;
 }
 
 EXPORT_API int alarmmgr_add_alarm_withcb(int alarm_type, time_t trigger_at_time,
-                                 time_t interval, alarm_cb_t handler, void *user_param, alarm_id_t *alarm_id)
+               time_t interval, alarm_cb_t handler, void *user_param, alarm_id_t *alarm_id)
 {
        int error_code = 0;
        struct timeval current_time;
@@ -1113,9 +1037,8 @@ EXPORT_API int alarmmgr_add_alarm_withcb(int alarm_type, time_t trigger_at_time,
        int ret = 0;
        char appid[256] = {0,};
 
-       if (aul_app_get_appid_bypid(getpid(), appid, sizeof(appid)) != AUL_R_OK) {
+       if (aul_app_get_appid_bypid(getpid(), appid, sizeof(appid)) != AUL_R_OK)
                ALARM_MGR_EXCEPTION_PRINT("aul_app_get_appid_bypid() is failed. PID %d may not be app.", getpid());
-       }
 
        ret = alarmmgr_init(appid);
        if (ret < 0)
@@ -1123,13 +1046,11 @@ EXPORT_API int alarmmgr_add_alarm_withcb(int alarm_type, time_t trigger_at_time,
 
        ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_add_alarm_withcb() is called");
 
-       if (alarm_id == NULL) {
+       if (alarm_id == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
-       if (trigger_at_time < 0) {
+       if (trigger_at_time < 0)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
        alarm_info.alarm_type = alarm_type;
        alarm_info.alarm_type |= ALARM_TYPE_RELATIVE;
@@ -1137,18 +1058,15 @@ EXPORT_API int alarmmgr_add_alarm_withcb(int alarm_type, time_t trigger_at_time,
 
        gettimeofday(&current_time, NULL);
 
-       if (current_time.tv_usec > 500 * 1000)
-       {
-               // When the millisecond part of the current_time is bigger than 500ms,
-               // the duetime increases by extra 1sec.
+       if (current_time.tv_usec > 500 * 1000) {
+               /* When the millisecond part of the current_time is bigger than 500ms, */
+               /* the duetime increases by extra 1sec. */
                current_time.tv_sec += (trigger_at_time + 1);
-       }
-       else
-       {
+       } else {
                current_time.tv_sec += trigger_at_time;
        }
 
-       tzset();        // Processes the TZ environment variable, and Set timezone, daylight, and tzname.
+       tzset(); /* Processes the TZ environment variable, and Set timezone, daylight, and tzname. */
        localtime_r(&current_time.tv_sec, &duetime_tm);
 
        alarm_info.start.year = duetime_tm.tm_year + 1900;
@@ -1172,13 +1090,13 @@ EXPORT_API int alarmmgr_add_alarm_withcb(int alarm_type, time_t trigger_at_time,
        }
 
        ALARM_MGR_LOG_PRINT("trigger_at_time(%d), start(%d-%d-%d, %02d:%02d:%02d), repeat(%d), interval(%d), type(%d)",
-               trigger_at_time, alarm_info.start.day, alarm_info.start.month, alarm_info.start.year,
-               alarm_info.start.hour, alarm_info.start.min, alarm_info.start.sec,
-               alarm_info.mode.repeat, alarm_info.mode.u_interval.interval, alarm_info.alarm_type);
+                       trigger_at_time, alarm_info.start.day, alarm_info.start.month, alarm_info.start.year,
+                       alarm_info.start.hour, alarm_info.start.min, alarm_info.start.sec,
+                       alarm_info.mode.repeat, alarm_info.mode.u_interval.interval, alarm_info.alarm_type);
 
-       if (!_send_alarm_create(alarm_context, &alarm_info, alarm_id, "null","null", &error_code)) {
+       if (!_send_alarm_create(alarm_context, &alarm_info, alarm_id, "null", "null", &error_code))
                return error_code;
-       }
+
        __add_resultcb(*alarm_id, handler, user_param);
 
        return ALARMMGR_RESULT_SUCCESS;
@@ -1196,9 +1114,8 @@ EXPORT_API int alarmmgr_remove_alarm(alarm_id_t alarm_id)
 
        ALARM_MGR_LOG_PRINT("[alarm-lib]:alarm_delete(%d) is called\n", alarm_id);
 
-       if (alarm_id <= 0) {
+       if (alarm_id <= 0)
                return ERR_ALARM_INVALID_ID;
-       }
 
        if (!_send_alarm_delete(alarm_context, alarm_id, &error_code))
                return error_code;
@@ -1215,9 +1132,7 @@ EXPORT_API int alarmmgr_remove_all(void)
        int return_code = ALARMMGR_RESULT_SUCCESS;
        int ret = __sub_init();
        if (ret < 0)
-       {
                return ret;
-       }
 
        if (!_send_alarm_delete_all(alarm_context, &error_code))
                return error_code;
@@ -1237,9 +1152,8 @@ EXPORT_API int alarmmgr_enum_alarm_ids(alarm_enum_fn_t fn, void *user_param)
        int ret = 0;
        GVariantIter *iter = NULL;
 
-       if (fn == NULL) {
+       if (fn == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
        ret = __sub_init();
        if (ret < 0) {
@@ -1249,11 +1163,11 @@ EXPORT_API int alarmmgr_enum_alarm_ids(alarm_enum_fn_t fn, void *user_param)
 
        SECURE_LOGD("alarm_manager_call_alarm_get_number_of_ids_sync() is called");
        if (!alarm_manager_call_alarm_get_number_of_ids_sync(
-           (AlarmManager*)alarm_context.proxy, &maxnum_of_ids, &return_code, NULL, &error)) {
+                               (AlarmManager*)alarm_context.proxy, &maxnum_of_ids, &return_code, NULL, &error)) {
                /* dbus error. error_code should be set */
                ALARM_MGR_EXCEPTION_PRINT(
-                   "alarm_manager_call_alarm_get_number_of_ids_sync() is failed by dbus. return_code[%d], err message[%s] err code[%d]",
-                   return_code, error->message, error->code);
+                               "alarm_manager_call_alarm_get_number_of_ids_sync() is failed by dbus. return_code[%d], err message[%s] err code[%d]",
+                               return_code, error->message, error->code);
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
                        ret = ERR_ALARM_NO_PERMISSION;
                else
@@ -1271,10 +1185,10 @@ EXPORT_API int alarmmgr_enum_alarm_ids(alarm_enum_fn_t fn, void *user_param)
 
        SECURE_LOGD("alarm_manager_call_alarm_get_list_of_ids_sync() is called");
        if (!alarm_manager_call_alarm_get_list_of_ids_sync(
-                    (AlarmManager*)alarm_context.proxy, maxnum_of_ids, &alarm_array, &num_of_ids, &return_code, NULL, &error)) {
+                               (AlarmManager*)alarm_context.proxy, maxnum_of_ids, &alarm_array, &num_of_ids, &return_code, NULL, &error)) {
                /* dbus error. error_code should be set */
                ALARM_MGR_EXCEPTION_PRINT(
-                   "alarm_manager_call_alarm_get_list_of_ids_sync() failed by dbus. num_of_ids[%d], return_code[%d]. err message[%s] err code[%d]", num_of_ids, return_code, error->message, error->code);
+                               "alarm_manager_call_alarm_get_list_of_ids_sync() failed by dbus. num_of_ids[%d], return_code[%d]. err message[%s] err code[%d]", num_of_ids, return_code, error->message, error->code);
                if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
                        ret = ERR_ALARM_NO_PERMISSION;
                else
@@ -1283,9 +1197,8 @@ EXPORT_API int alarmmgr_enum_alarm_ids(alarm_enum_fn_t fn, void *user_param)
                return ret;
        }
 
-       if (return_code != ALARMMGR_RESULT_SUCCESS) {
+       if (return_code != ALARMMGR_RESULT_SUCCESS)
                return return_code;
-       }
 
        if (error != NULL) {
                ALARM_MGR_EXCEPTION_PRINT("Alarm server is not ready dbus. error message %s.", error->message);
@@ -1298,9 +1211,8 @@ EXPORT_API int alarmmgr_enum_alarm_ids(alarm_enum_fn_t fn, void *user_param)
        }
 
        g_variant_get(alarm_array, "ai", &iter);
-       while (g_variant_iter_loop(iter, "i", &alarm_id))
-       {
-               (*fn) (alarm_id, user_param);
+       while (g_variant_iter_loop(iter, "i", &alarm_id)) {
+               (*fn)(alarm_id, user_param);
                ALARM_MGR_LOG_PRINT("alarm_id (%d)", alarm_id);
        }
        g_variant_iter_free(iter);
@@ -1314,7 +1226,6 @@ EXPORT_API int alarmmgr_get_info(alarm_id_t alarm_id, alarm_entry_t *alarm)
 {
        int error_code;
        alarm_info_t *alarm_info = (alarm_info_t *) alarm;
-
        int ret;
 
        ret = __sub_init();
@@ -1323,19 +1234,17 @@ EXPORT_API int alarmmgr_get_info(alarm_id_t alarm_id, alarm_entry_t *alarm)
 
        ALARM_MGR_LOG_PRINT("[alarm-lib]:alarm_get_info() is called\n");
 
-       if (alarm_id < 0 || alarm_info == NULL) {
+       if (alarm_id < 0 || alarm_info == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
-       if (!_send_alarm_get_info(alarm_context, alarm_id, alarm_info, &error_code)) {
+       if (!_send_alarm_get_info(alarm_context, alarm_id, alarm_info, &error_code))
                return error_code;
-       }
 
        return ALARMMGR_RESULT_SUCCESS;
 }
 
 int alarmmgr_create(alarm_info_t *alarm_info, char *destination,
-                   alarm_id_t *alarm_id)
+               alarm_id_t *alarm_id)
 {
        char dst_service_name[MAX_SERVICE_NAME_LEN] = { 0 };
        alarm_mode_t *mode = &alarm_info->mode;
@@ -1343,19 +1252,17 @@ int alarmmgr_create(alarm_info_t *alarm_info, char *destination,
 
        ALARM_MGR_LOG_PRINT("[alarm-lib]:alarm_create() is called\n");
 
-       if (alarm_info == NULL || alarm_id == NULL) {
+       if (alarm_info == NULL || alarm_id == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
        ALARM_MGR_LOG_PRINT("alarm_info->start.year(%d), "
-                           "alarm_info->start.month(%d), alarm_info->start.day(%d)",
-                           alarm_info->start.year, alarm_info->start.month,
-                           alarm_info->start.day);
+                       "alarm_info->start.month(%d), alarm_info->start.day(%d)",
+                       alarm_info->start.year, alarm_info->start.month,
+                       alarm_info->start.day);
 
        /* TODO: This should be changed to > ALARM_REPEAT_MODE_MAX ? */
-       if (mode->repeat >= ALARM_REPEAT_MODE_MAX) {
+       if (mode->repeat >= ALARM_REPEAT_MODE_MAX)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
        if (!__alarm_validate_date(&alarm_info->start, &error_code)) {
                ALARM_MGR_EXCEPTION_PRINT("start date error\n");
@@ -1374,23 +1281,21 @@ int alarmmgr_create(alarm_info_t *alarm_info, char *destination,
 
        if (destination != NULL) {
                memset(dst_service_name, 0,
-                      strlen(destination) + strlen("ALARM.") + 2);
+                               strlen(destination) + strlen("ALARM.") + 2);
                snprintf(dst_service_name, MAX_SERVICE_NAME_LEN, "ALARM.%s",
-                        destination);
-               if (!_send_alarm_create
-                   (alarm_context, alarm_info, alarm_id, dst_service_name,"null",
-                    &error_code)) {
+                               destination);
+               if (!_send_alarm_create(alarm_context, alarm_info,
+                                       alarm_id, dst_service_name, "null",
+                                       &error_code))
                        return error_code;
-               }
        }
-/*TODO: Currently this API is not exported. Hence not modifying*/
-       if (!_send_alarm_create
-           (alarm_context, alarm_info, alarm_id, "null", "null", &error_code)) {
+
+       /*TODO: Currently this API is not exported. Hence not modifying*/
+       if (!_send_alarm_create(alarm_context, alarm_info, alarm_id,
+                               "null", "null", &error_code))
                return error_code;
-       }
 
        return ALARMMGR_RESULT_SUCCESS;
-
 }
 
 int alarmmgr_get_number_of_ids(int *num_of_ids)
@@ -1398,26 +1303,24 @@ int alarmmgr_get_number_of_ids(int *num_of_ids)
        int error_code;
        ALARM_MGR_LOG_PRINT("[alarm-lib]: alarm_get_number_of_ids() is called.");
 
-       if (num_of_ids == NULL) {
+       if (num_of_ids == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
+
        ALARM_MGR_LOG_PRINT("call alarm_get_number_of_ids\n");
-       if (!_send_alarm_get_number_of_ids(alarm_context, num_of_ids, &error_code)) {
+       if (!_send_alarm_get_number_of_ids(alarm_context, num_of_ids, &error_code))
                return error_code;
-       }
 
        return ALARMMGR_RESULT_SUCCESS;
 }
 
 int alarmmgr_get_list_of_ids(int maxnum_of_ids, alarm_id_t *alarm_id,
-                            int *num_of_ids)
+               int *num_of_ids)
 {
        int error_code;
        ALARM_MGR_LOG_PRINT("[alarm-lib]:alarm_get_list_of_ids() is called.");
 
-       if (maxnum_of_ids < 0 || alarm_id == NULL || num_of_ids == NULL) {
+       if (maxnum_of_ids < 0 || alarm_id == NULL || num_of_ids == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
        if (maxnum_of_ids == 0) {
                *num_of_ids = 0;
@@ -1425,7 +1328,7 @@ int alarmmgr_get_list_of_ids(int maxnum_of_ids, alarm_id_t *alarm_id,
        }
 
        if (!_send_alarm_get_list_of_ids
-           (alarm_context, maxnum_of_ids, alarm_id, num_of_ids, &error_code)) {
+                       (alarm_context, maxnum_of_ids, alarm_id, num_of_ids, &error_code)) {
                return error_code;
        }
 
@@ -1437,13 +1340,11 @@ EXPORT_API int alarmmgr_get_next_duetime(alarm_id_t alarm_id, time_t* duetime)
        int error_code;
        ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_get_next_duetime() is called.");
 
-       if (duetime == NULL) {
+       if (duetime == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
-       if (!_send_alarm_get_next_duetime(alarm_context, alarm_id, duetime, &error_code)) {
+       if (!_send_alarm_get_next_duetime(alarm_context, alarm_id, duetime, &error_code))
                return error_code;
-       }
 
        return ALARMMGR_RESULT_SUCCESS;
 }
@@ -1453,20 +1354,18 @@ EXPORT_API int alarmmgr_get_all_info(char **db_path)
        int error_code;
        ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_get_all_info() is called.");
 
-       if (db_path == NULL) {
+       if (db_path == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
-       if (!_send_alarm_get_all_info(alarm_context, db_path, &error_code)) {
+       if (!_send_alarm_get_all_info(alarm_context, db_path, &error_code))
                return error_code;
-       }
 
        ALARM_MGR_LOG_PRINT("[alarm-lib]: successfully save info in %s.", *db_path);
        return ALARMMGR_RESULT_SUCCESS;
 }
 
 EXPORT_API int alarmmgr_add_periodic_alarm_withcb(int interval, periodic_method_e method,
-        alarm_cb_t handler, void *user_param, alarm_id_t *alarm_id)
+               alarm_cb_t handler, void *user_param, alarm_id_t *alarm_id)
 {
        int error_code = 0;
        alarm_info_t alarm_info;
@@ -1475,28 +1374,28 @@ EXPORT_API int alarmmgr_add_periodic_alarm_withcb(int interval, periodic_method_
 
        if (aul_app_get_appid_bypid(getpid(), appid, sizeof(appid)) != AUL_R_OK) {
                ALARM_MGR_EXCEPTION_PRINT("aul_app_get_appid_bypid() is failed. PID %d may not be app.",
-                       getpid());
+                               getpid());
        }
 
        ret = alarmmgr_init(appid);
        if (ret < 0)
                return ret;
 
-       if (alarm_id == NULL) {
+       if (alarm_id == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
-       if (!_send_alarm_create_periodic(alarm_context, interval, 0, (int)method, alarm_id,
-               &error_code)) {
+       if (!_send_alarm_create_periodic(alarm_context, interval, 0,
+                               (int)method, alarm_id,
+                               &error_code))
                return error_code;
-       }
+
        __add_resultcb(*alarm_id, handler, user_param);
 
        return ALARMMGR_RESULT_SUCCESS;
 }
 
 EXPORT_API int alarmmgr_add_reference_periodic_alarm_withcb(int interval,
-        alarm_cb_t handler, void *user_param, alarm_id_t *alarm_id)
+               alarm_cb_t handler, void *user_param, alarm_id_t *alarm_id)
 {
        int error_code = 0;
        alarm_info_t alarm_info;
@@ -1505,21 +1404,19 @@ EXPORT_API int alarmmgr_add_reference_periodic_alarm_withcb(int interval,
 
        if (aul_app_get_appid_bypid(getpid(), appid, sizeof(appid)) != AUL_R_OK) {
                ALARM_MGR_EXCEPTION_PRINT("aul_app_get_appid_bypid() is failed. PID %d may not be app.",
-                       getpid());
+                               getpid());
        }
 
        ret = alarmmgr_init(appid);
        if (ret < 0)
                return ret;
 
-       if (alarm_id == NULL) {
+       if (alarm_id == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
        if (!_send_alarm_create_periodic(alarm_context, interval, 1, 0,
-               alarm_id, &error_code)) {
+                               alarm_id, &error_code))
                return error_code;
-       }
 
        __add_resultcb(*alarm_id, handler, user_param);
 
@@ -1531,9 +1428,8 @@ EXPORT_API int alarmmgr_set_systime(int new_time)
        int error_code;
        ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_set_systime(%d) is called.", new_time);
 
-       if (__sub_init() < 0) {
+       if (__sub_init() < 0)
                return ERR_ALARM_SYSTEM_FAIL;
-       }
 
        if (!_send_alarm_set_time(alarm_context, new_time, &error_code)) {
                ALARM_MGR_EXCEPTION_PRINT("Failed to set time. error: %d", error_code);
@@ -1548,11 +1444,10 @@ EXPORT_API int alarmmgr_set_systime_with_propagation_delay(struct timespec new_t
 {
        int error_code;
        ALARM_MGR_LOG_PRINT("[alarm-lib] New: %d(sec) %09d(nsec), Requested: %d(sec) %09d(nsec)",
-               new_time.tv_sec, new_time.tv_nsec, req_time.tv_sec, req_time.tv_nsec);
+                       new_time.tv_sec, new_time.tv_nsec, req_time.tv_sec, req_time.tv_nsec);
 
-       if (__sub_init() < 0) {
+       if (__sub_init() < 0)
                return ERR_ALARM_SYSTEM_FAIL;
-       }
 
        if (!_send_alarm_set_time_with_propagation_delay(alarm_context, new_time.tv_sec, new_time.tv_nsec, req_time.tv_sec, req_time.tv_nsec, &error_code)) {
                ALARM_MGR_EXCEPTION_PRINT("Failed to set time with propagation delay. error: %d", error_code);
@@ -1568,50 +1463,43 @@ EXPORT_API int alarmmgr_set_timezone(char *tzpath_str)
        int error_code;
        ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_set_timezone() is called.");
 
-       if (tzpath_str == NULL) {
+       if (tzpath_str == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
-       if (__sub_init() < 0) {
+       if (__sub_init() < 0)
                return ERR_ALARM_SYSTEM_FAIL;
-       }
 
-       if (!_send_alarm_set_timezone(alarm_context, tzpath_str, &error_code)) {
+       if (!_send_alarm_set_timezone(alarm_context, tzpath_str, &error_code))
                return error_code;
-       }
 
        ALARM_MGR_LOG_PRINT("[alarm-lib]: successfully set the timezone(%s) by pid(%d)", tzpath_str, getpid());
        return ALARMMGR_RESULT_SUCCESS;
 }
 
 EXPORT_API int alarmmgr_set_global(const alarm_id_t alarm_id,
-                                       bool global)
+               bool global)
 {
        int error_code;
        ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_set_global() is called.");
 
-       if (!_send_alarm_set_global(alarm_context, alarm_id, global, &error_code)) {
+       if (!_send_alarm_set_global(alarm_context, alarm_id, global, &error_code))
                return error_code;
-       }
 
        return ALARMMGR_RESULT_SUCCESS;
 }
 
 
 EXPORT_API int alarmmgr_get_global(const alarm_id_t alarm_id,
-                                       bool *global)
+               bool *global)
 {
        bool _global;
        int error_code;
 
-       if (global == NULL) {
+       if (global == NULL)
                return ERR_ALARM_INVALID_PARAM;
-       }
 
-       if (!_send_alarm_get_global(alarm_context, alarm_id, &_global, &error_code)) {
+       if (!_send_alarm_get_global(alarm_context, alarm_id, &_global, &error_code))
                return error_code;
-       }
 
        return ALARMMGR_RESULT_SUCCESS;
 }
-
index 338b1b1..1c7195a 100644 (file)
@@ -40,15 +40,12 @@ int main(int argc, char** argv)
        mainloop = g_main_loop_new(NULL, FALSE);
        result = alarmmgr_init("org.tizen.alarmmgr.periodic");
 
-       if (result < 0) {
+       if (result < 0)
                printf("fail to alarmmgr_init : error_code : %d\n", result);
-       } else {
+       else
                create_test();
-       }
 
        g_main_loop_run(mainloop);
 
        return 0;
 }
-
-
index d01c4f0..b8c1a23 100644 (file)
@@ -37,11 +37,10 @@ int main(int argc, char** argv)
        mainloop = g_main_loop_new(NULL, FALSE);
        result = alarmmgr_init("org.tizen.alarmmgr.refperiodic");
 
-       if (result < 0) {
+       if (result < 0)
                printf("fail to alarmmgr_init : error_code : %d\n", result);
-       } else {
+       else
                create_test();
-       }
 
        g_main_loop_run(mainloop);
 
index fe9b438..40106de 100644 (file)
@@ -1,7 +1,5 @@
 /*
- *  alarm-manager
- *
- * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2014 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -30,29 +28,23 @@ int main()
        printf("=== Hi :) I will save info of all registered alarms in /tmp/alarmmgr_{datetime}.db\n");
 
        int ret = alarmmgr_init("alarmmgr_tool");
-       if (ret != ALARMMGR_RESULT_SUCCESS)
-       {
+       if (ret != ALARMMGR_RESULT_SUCCESS) {
                LOGE("alarmmgr_init() is failed. ret = %d", ret);
                printf("=== Failed to get all alarms's info :(\n");
        }
 
        char *db_path = NULL;
        ret = alarmmgr_get_all_info(&db_path);
-       if (ret != ALARMMGR_RESULT_SUCCESS)
-       {
+       if (ret != ALARMMGR_RESULT_SUCCESS) {
                LOGE("alarmmgr_get_all_info() is failed. ret = %d", ret);
                printf("=== Failed to get all alarms's info :(\n");
-       }
-       else
-       {
+       } else {
                LOGE("Getting all alarm's info is done successfully.");
                printf("=== Success :)\n    Please check %s\n", db_path);
        }
 
        if (db_path)
-       {
                free(db_path);
-       }
 
        return 0;
 }