Style: code indentation of alarm-manager.c 36/101036/4
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Wed, 30 Nov 2016 06:50:07 +0000 (15:50 +0900)
committerSemun Lee <sm79.lee@samsung.com>
Tue, 17 Jan 2017 09:06:49 +0000 (01:06 -0800)
The intentionally ignored indentation for the previous commit,
"Remove Profile Build Dependency: Do it at runtime"
is restored in this commit, which was to help review
the commit.

Change-Id: I619ea326027ea65b98eeabb4dfa1c5146a40cb03
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
alarm-manager.c

index 1400ed2..7d72f6b 100644 (file)
@@ -272,98 +272,97 @@ void __free_cached_value(gpointer data)
 
 static void __rtc_set()
 {
-/* Indentation ingored to help understand the patch. */
-if (_APPFW_FEATURE_WAKEUP_USING_RTC) {
-       const char *rtc = default_rtc;
-       struct tm due_tm;
+       if (_APPFW_FEATURE_WAKEUP_USING_RTC) {
+               const char *rtc = default_rtc;
+               struct tm due_tm;
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
-       char log_message[ALARMMGR_LOG_MESSAGE_SIZE] = {0,};
+               char log_message[ALARMMGR_LOG_MESSAGE_SIZE] = {0,};
 #endif
 #ifdef _SIMUL /* RTC does not work in simulator. */
-       ALARM_MGR_EXCEPTION_PRINT("because it is simulator's mode, we don't set RTC.");
-       return;
+               ALARM_MGR_EXCEPTION_PRINT("because it is simulator's mode, we don't set RTC.");
+               return;
 #endif
 
-       if (gfd < 0) {
-               gfd = open(rtc, O_RDWR);
                if (gfd < 0) {
-                       ALARM_MGR_EXCEPTION_PRINT("RTC open failed.");
-                       return;
+                       gfd = open(rtc, O_RDWR);
+                       if (gfd < 0) {
+                               ALARM_MGR_EXCEPTION_PRINT("RTC open failed.");
+                               return;
+                       }
                }
-       }
 
-       /* Read the RTC time/date */
-       int retval = 0;
-       char buf[1024];
+               /* Read the RTC time/date */
+               int retval = 0;
+               char buf[1024];
 #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 */
-               snprintf(log_message, sizeof(log_message), "wakeup time: %d, %s", (int)alarm_context.c_due_time, timebuf);
-       }
+               char *timebuf = ctime(&alarm_context.c_due_time);
+               if (timebuf) {
+                       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
 
-       ALARM_MGR_LOG_PRINT("alarm_context.c_due_time is %d.", (int)alarm_context.c_due_time);
+               ALARM_MGR_LOG_PRINT("alarm_context.c_due_time is %d.", (int)alarm_context.c_due_time);
 
-       if (alarm_context.c_due_time != -1) {
-               struct rtc_wkalrm rtc_wkalarm = { 0, };
-               rtc_wkalarm.enabled = 0;
-               rtc_wkalarm.time.tm_year = 1900;
-               rtc_wkalarm.time.tm_mon = 0;
-               rtc_wkalarm.time.tm_mday = 1;
-               rtc_wkalarm.time.tm_hour = 0;
-               rtc_wkalarm.time.tm_min = 0;
-               rtc_wkalarm.time.tm_sec = 0;
+               if (alarm_context.c_due_time != -1) {
+                       struct rtc_wkalrm rtc_wkalarm = { 0, };
+                       rtc_wkalarm.enabled = 0;
+                       rtc_wkalarm.time.tm_year = 1900;
+                       rtc_wkalarm.time.tm_mon = 0;
+                       rtc_wkalarm.time.tm_mday = 1;
+                       rtc_wkalarm.time.tm_hour = 0;
+                       rtc_wkalarm.time.tm_min = 0;
+                       rtc_wkalarm.time.tm_sec = 0;
 
-               retval = ioctl(gfd, RTC_WKALM_SET, &rtc_wkalarm);
-               if (retval == -1) {
-                       if (errno == ENOTTY)
-                               ALARM_MGR_EXCEPTION_PRINT("Alarm IRQs is not supported.");
+                       retval = ioctl(gfd, RTC_WKALM_SET, &rtc_wkalarm);
+                       if (retval == -1) {
+                               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_r(errno, buf, sizeof(buf)));
+                               ALARM_MGR_EXCEPTION_PRINT("RTC_WKALM_SET disabled ioctl is failed. errno = %s", strerror_r(errno, buf, sizeof(buf)));
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
-                       __save_module_log("FAIL: SET RTC", log_message);
+                               __save_module_log("FAIL: SET RTC", log_message);
 #endif
-                       return;
-               }
-               ALARM_MGR_LOG_PRINT("[alarm-server]RTC_WKALM_SET disabled ioctl is successfully done.");
-
-               time_t due_time = alarm_context.c_due_time;
-               gmtime_r(&due_time, &due_tm);
-
-               ALARM_MGR_LOG_PRINT("Setted RTC Alarm date/time is %d-%d-%d, %02d:%02d:%02d (UTC).",
-                       due_tm.tm_mday, due_tm.tm_mon + 1, due_tm.tm_year + 1900,
-                       due_tm.tm_hour, due_tm.tm_min, due_tm.tm_sec);
-
-               rtc_wkalarm.enabled = 1;
-               rtc_wkalarm.time.tm_year = due_tm.tm_year;
-               rtc_wkalarm.time.tm_mon = due_tm.tm_mon;
-               rtc_wkalarm.time.tm_mday = due_tm.tm_mday;
-               rtc_wkalarm.time.tm_hour = due_tm.tm_hour;
-               rtc_wkalarm.time.tm_min = due_tm.tm_min;
-               rtc_wkalarm.time.tm_sec = due_tm.tm_sec;
-               retval = ioctl(gfd, RTC_WKALM_SET, &rtc_wkalarm);
-               if (retval == -1) {
-                       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_r(errno, buf, sizeof(buf)));
+                               return;
+                       }
+                       ALARM_MGR_LOG_PRINT("[alarm-server]RTC_WKALM_SET disabled ioctl is successfully done.");
+
+                       time_t due_time = alarm_context.c_due_time;
+                       gmtime_r(&due_time, &due_tm);
+
+                       ALARM_MGR_LOG_PRINT("Setted RTC Alarm date/time is %d-%d-%d, %02d:%02d:%02d (UTC).",
+                                       due_tm.tm_mday, due_tm.tm_mon + 1, due_tm.tm_year + 1900,
+                                       due_tm.tm_hour, due_tm.tm_min, due_tm.tm_sec);
+
+                       rtc_wkalarm.enabled = 1;
+                       rtc_wkalarm.time.tm_year = due_tm.tm_year;
+                       rtc_wkalarm.time.tm_mon = due_tm.tm_mon;
+                       rtc_wkalarm.time.tm_mday = due_tm.tm_mday;
+                       rtc_wkalarm.time.tm_hour = due_tm.tm_hour;
+                       rtc_wkalarm.time.tm_min = due_tm.tm_min;
+                       rtc_wkalarm.time.tm_sec = due_tm.tm_sec;
+                       retval = ioctl(gfd, RTC_WKALM_SET, &rtc_wkalarm);
+                       if (retval == -1) {
+                               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_r(errno, buf, sizeof(buf)));
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
-                       __save_module_log("FAIL: SET RTC", log_message);
+                               __save_module_log("FAIL: SET RTC", log_message);
 #endif
-                       return;
-               }
-               ALARM_MGR_LOG_PRINT("[alarm-server]RTC ALARM_SET ioctl is successfully done.");
+                               return;
+                       }
+                       ALARM_MGR_LOG_PRINT("[alarm-server]RTC ALARM_SET ioctl is successfully done.");
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
-               __save_module_log("SET RTC", log_message);
+                       __save_module_log("SET RTC", log_message);
 #endif
+               } 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");
+               }
        } 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");
+               ALARM_MGR_LOG_PRINT("[alarm-server] RTC does not work.");
        }
-} else {
-       ALARM_MGR_LOG_PRINT("[alarm-server] RTC does not work.");
-}
        return;
 }
 
@@ -384,60 +383,59 @@ int __set_time(time_t _time)
        if (ret < 0)
                ALARM_MGR_EXCEPTION_PRINT("settimeofday is failed.[%d]", errno);
 
-/* Indentation ingored to help understand the patch. */
-if (_APPFW_FEATURE_WAKEUP_USING_RTC) {
-       /* Using /dev/alarm, this function changes both OS time and RTC. */
-       const char *rtc0 = default_rtc;
-       struct rtc_time _rtc_time;
+       if (_APPFW_FEATURE_WAKEUP_USING_RTC) {
+               /* Using /dev/alarm, this function changes both OS time and RTC. */
+               const char *rtc0 = default_rtc;
+               struct rtc_time _rtc_time;
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
-       char log_tag[ALARMMGR_LOG_TAG_SIZE] = {0,};
-       char log_message[ALARMMGR_LOG_MESSAGE_SIZE] = {0,};
+               char log_tag[ALARMMGR_LOG_TAG_SIZE] = {0,};
+               char log_message[ALARMMGR_LOG_MESSAGE_SIZE] = {0,};
 #endif
-       char buf[1024];
+               char buf[1024];
 
-       if (gfd < 0) {
-               gfd = open(rtc0, O_RDWR);
                if (gfd < 0) {
-                       ALARM_MGR_EXCEPTION_PRINT("Opening the /dev/alarm is failed.");
-                       perror("\t");
-                       return 1;
+                       gfd = open(rtc0, O_RDWR);
+                       if (gfd < 0) {
+                               ALARM_MGR_EXCEPTION_PRINT("Opening the /dev/alarm is failed.");
+                               perror("\t");
+                               return 1;
+                       }
                }
-       }
 
-       memset(&_rtc_time, 0, sizeof(_rtc_time));
-       _rtc_time.tm_sec = tm.tm_sec;
-       _rtc_time.tm_min = tm.tm_min;
-       _rtc_time.tm_hour = tm.tm_hour;
-       _rtc_time.tm_mday = tm.tm_mday;
-       _rtc_time.tm_mon = tm.tm_mon;
-       _rtc_time.tm_year = tm.tm_year;
-       _rtc_time.tm_wday = tm.tm_wday;
-       _rtc_time.tm_yday = tm.tm_yday;
-       _rtc_time.tm_isdst = tm.tm_isdst;
-
-       ret = ioctl(gfd, RTC_SET_TIME, &_rtc_time);
-       if (ret == -1) {
-               ALARM_MGR_EXCEPTION_PRINT("ALARM_SET_RTC ioctl is failed. errno = %s", strerror_r(errno, buf, sizeof(buf)));
+               memset(&_rtc_time, 0, sizeof(_rtc_time));
+               _rtc_time.tm_sec = tm.tm_sec;
+               _rtc_time.tm_min = tm.tm_min;
+               _rtc_time.tm_hour = tm.tm_hour;
+               _rtc_time.tm_mday = tm.tm_mday;
+               _rtc_time.tm_mon = tm.tm_mon;
+               _rtc_time.tm_year = tm.tm_year;
+               _rtc_time.tm_wday = tm.tm_wday;
+               _rtc_time.tm_yday = tm.tm_yday;
+               _rtc_time.tm_isdst = tm.tm_isdst;
+
+               ret = ioctl(gfd, RTC_SET_TIME, &_rtc_time);
+               if (ret == -1) {
+                       ALARM_MGR_EXCEPTION_PRINT("ALARM_SET_RTC ioctl is failed. errno = %s", strerror_r(errno, buf, sizeof(buf)));
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
-               strncpy(log_tag, "FAIL: SET RTC", strlen("FAIL: SET RTC"));
+                       strncpy(log_tag, "FAIL: SET RTC", strlen("FAIL: SET RTC"));
 #endif
-               perror("\t");
-       }
+                       perror("\t");
+               }
 #ifdef _APPFW_FEATURE_ALARM_MANAGER_MODULE_LOG
-       else
-               strncpy(log_tag, "SET RTC", strlen("SET RTC"));
+               else
+                       strncpy(log_tag, "SET RTC", strlen("SET RTC"));
 
-       char *timebuf = ctime(&_time);
-       if (timebuf) {
-               timebuf[strlen(timebuf) - 1] = '\0'; /* to avoid new line */
-               snprintf(log_message, sizeof(log_message), "RTC & OS =%d, %s", (int)_time, timebuf);
-       }
+               char *timebuf = ctime(&_time);
+               if (timebuf) {
+                       timebuf[strlen(timebuf) - 1] = '\0'; /* to avoid new line */
+                       snprintf(log_message, sizeof(log_message), "RTC & OS =%d, %s", (int)_time, timebuf);
+               }
 
-       __save_module_log(log_tag, log_message);
+               __save_module_log(log_tag, log_message);
 #endif
-} else {
-       ALARM_MGR_LOG_PRINT("[alarm-server] RTC does not work.");
-}
+       } else {
+               ALARM_MGR_LOG_PRINT("[alarm-server] RTC does not work.");
+       }
 
        return 1;
 }