else
apptype = STC_APP_TYPE_GUI;
- if (STC_DEBUG_LOG) {
- STC_LOGD("\033[1;36mAPP STATUS\033[0;m: Pkg ID [\033[0;34m%s\033[0;m], "
- "App ID [\033[0;32m%s\033[0;m], PID [\033[1;33m%d\033[0;m], Status [%s], Type [%s]",
+ if (STC_STAT_LOG) {
+ STC_LOGD("\033[1;34mAPP STATUS\033[0;m: PkgID[\033[0;34m%s\033[0;m] "
+ "AppID[\033[0;32m%s\033[0;m] PID[\033[1;33m%d\033[0;m] Status[%s] Type[%s]",
pkgid, appid, pid, statstr, pkgtype);
}
static stc_error_e __ground_status_monitor_init(stc_s *stc)
{
guint i = 0;
+ guint size = 0;
ret_value_msg_if(stc == NULL, STC_ERROR_INVALID_PARAMETER, "failed to get stc data");
- for (i = 0; signal_map[i].member != NULL; i++) {
+ size = sizeof(signal_map) / sizeof(signal_map[0]);
+
+ for (i = 0; signal_map[i].member != NULL && i < size; i++) {
signal_map[i].sub_id =
g_dbus_connection_signal_subscribe(stc->connection,
NULL,
static stc_error_e __ground_status_monitor_deinit(stc_s *stc)
{
guint i = 0;
+ guint size = 0;
ret_value_msg_if(stc == NULL, STC_ERROR_INVALID_PARAMETER, "failed to get stc data");
- for (i = 0; signal_map[i].member != NULL; i++) {
+ size = sizeof(signal_map) / sizeof(signal_map[0]);
+
+ for (i = 0; signal_map[i].member != NULL && i < size; i++) {
g_dbus_connection_signal_unsubscribe(stc->connection,
signal_map[i].sub_id);
signal_map[i].sub_id = 0;