Rearrange the scope of each temporary variables
[platform/core/uifw/voice-control.git] / common / vc_command.c
index 77e363b..e6b5767 100644 (file)
 #include "voice_control_common.h"
 #include "voice_control_key_defines.h"
 
+static pthread_mutex_t g_cmd_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t g_cmd_list_mutex = PTHREAD_MUTEX_INITIALIZER;
+#define CMD_MUTEX_LOCK()       pthread_mutex_lock(&g_cmd_mutex)
+#define CMD_MUTEX_UNLOCK()     pthread_mutex_unlock(&g_cmd_mutex)
+#define CMD_LIST_MUTEX_LOCK()  pthread_mutex_lock(&g_cmd_list_mutex)
+#define CMD_LIST_MUTEX_UNLOCK()        pthread_mutex_unlock(&g_cmd_list_mutex)
+
 static int g_feature_enabled = -1;
+static bool g_privilege_allowed = false;
 
-static int g_privilege_allowed = 1; /* Always True */
+static pthread_mutex_t g_cynara_mutex = PTHREAD_MUTEX_INITIALIZER;
 static cynara *p_cynara = NULL;
+static GList *g_cmd_list = NULL;
 static GList *g_cmdlist_list = NULL;
 
 
@@ -78,7 +87,7 @@ static int __vc_cmd_get_feature_enabled()
                }
        }
 
-       return 0;
+       return VC_ERROR_NONE;
 }
 
 static int __check_privilege_initialize()
@@ -102,7 +111,7 @@ static int __check_privilege(const char* uid, const char * privilege)
 
        fp = fopen(label_path, "r");
        if (fp != NULL) {
-               if (sizeof(smack_label) != fread(smack_label, 1, sizeof(smack_label), fp))
+               if (0 >= fread(smack_label, 1, sizeof(smack_label), fp))
                        SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] fail to fread");
 
                fclose(fp);
@@ -123,34 +132,50 @@ static int __check_privilege(const char* uid, const char * privilege)
 static void __check_privilege_deinitialize()
 {
        if (p_cynara)
-               cynara_finish(p_cynara);
+       {
+               int ret = cynara_finish(p_cynara);
+               if (ret != CYNARA_API_SUCCESS)
+                       SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] cynara finish %d", ret);
+       }
        p_cynara = NULL;
 }
 
 static int __vc_cmd_check_privilege()
 {
-       char uid[16];
+       if (true == g_privilege_allowed)
+               return VC_ERROR_NONE;
 
-       if (0 == g_privilege_allowed) {
-               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Permission is denied");
-               return VC_ERROR_PERMISSION_DENIED;
-       } else if (-1 == g_privilege_allowed) {
-               if (false == __check_privilege_initialize()) {
+       pthread_mutex_lock(&g_cynara_mutex);
+
+       if (false == g_privilege_allowed) {
+               bool ret = true;
+               ret = __check_privilege_initialize();
+               if (false == ret) {
                        SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] privilege initialize is failed");
+                       g_privilege_allowed = false;
+                       pthread_mutex_unlock(&g_cynara_mutex);
                        return VC_ERROR_PERMISSION_DENIED;
                }
-               snprintf(uid, 16, "%d", getuid());
-               if (false == __check_privilege(uid, VC_PRIVILEGE)) {
-                       SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Permission is denied");
-                       g_privilege_allowed = 0;
+
+               char uid[32];
+               snprintf(uid, 32, "%d", getuid());
+               ret = true;
+               ret = __check_privilege(uid, VC_PRIVILEGE_RECORDER);
+               if (false == ret) {
+                       //LCOV_EXCL_START
+                       SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Permission is denied(%s)(%s)", VC_PRIVILEGE_RECORDER, uid);
                        __check_privilege_deinitialize();
+                       g_privilege_allowed = false;
+                       pthread_mutex_unlock(&g_cynara_mutex);
                        return VC_ERROR_PERMISSION_DENIED;
+                       //LCOV_EXCL_STOP
                }
+
                __check_privilege_deinitialize();
        }
 
-       g_privilege_allowed = 1;
-
+       g_privilege_allowed = true;
+       pthread_mutex_unlock(&g_cynara_mutex);
        return VC_ERROR_NONE;
 }
 
@@ -163,8 +188,11 @@ int vc_cmd_list_create(vc_cmd_list_h* vc_cmd_list)
                return VC_ERROR_PERMISSION_DENIED;
        }
 
+       CMD_LIST_MUTEX_LOCK();
+
        if (NULL == vc_cmd_list) {
                SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL");
+               CMD_LIST_MUTEX_UNLOCK();
                return VC_ERROR_INVALID_PARAMETER;
        }
 
@@ -172,6 +200,7 @@ int vc_cmd_list_create(vc_cmd_list_h* vc_cmd_list)
 
        if (NULL == list) {
                SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Not enough memory");
+               CMD_LIST_MUTEX_UNLOCK();
                return VC_ERROR_OUT_OF_MEMORY;
        }
 
@@ -184,6 +213,7 @@ int vc_cmd_list_create(vc_cmd_list_h* vc_cmd_list)
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "[List] list(%p)", *vc_cmd_list);
 
+       CMD_LIST_MUTEX_UNLOCK();
        return VC_ERROR_NONE;
 }
 
@@ -196,12 +226,14 @@ int vc_cmd_list_destroy(vc_cmd_list_h vc_cmd_list, bool release_command)
                return VC_ERROR_PERMISSION_DENIED;
        }
 
+       CMD_LIST_MUTEX_LOCK();
+
        if (NULL == vc_cmd_list) {
                SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL");
+               CMD_LIST_MUTEX_UNLOCK();
                return VC_ERROR_INVALID_PARAMETER;
        }
 
-       vc_cmd_list_remove_all(vc_cmd_list, release_command);
 
        vc_cmd_list_s* list = NULL;
        list = (vc_cmd_list_s*)vc_cmd_list;
@@ -209,33 +241,23 @@ int vc_cmd_list_destroy(vc_cmd_list_h vc_cmd_list, bool release_command)
        SLOG(LOG_DEBUG, TAG_VCCMD, "[List] list(%p)", list);
 
        GList *iter = NULL;
-       vc_cmd_list_s *data = NULL;
-
-       /* if list have item */
-       if (g_list_length(g_cmdlist_list) > 0) {
-               /* Get a first item */
-               iter = g_list_first(g_cmdlist_list);
-
-               while (NULL != iter) {
-                       data = iter->data;
-                       if (data && list == data) {
-                               g_cmdlist_list = g_list_remove_link(g_cmdlist_list, iter);
+       iter = g_list_find(g_cmdlist_list, list);
+       if (NULL == iter) {
+               SLOG(LOG_ERROR, TAG_VCCMD, "Fail to destroy client : handle is not valid");
+               CMD_LIST_MUTEX_UNLOCK();
+               return VC_ERROR_INVALID_PARAMETER;
+       }
 
-                               free(data);
-                               data = NULL;
+       g_cmdlist_list = g_list_delete_link(g_cmdlist_list, iter);
 
-                               SLOG(LOG_DEBUG, TAG_VCCMD, "Client destroy");
-                               g_list_free(iter);
+       vc_cmd_list_remove_all((vc_cmd_list_h)list, release_command);
+       free(list);
+       list = NULL;
 
-                               return VC_ERROR_NONE;
-                       }
-                       /* Next item */
-                       iter = g_list_next(iter);
-               }
-       }
-       SLOG(LOG_ERROR, TAG_VCCMD, "Fail to destroy client : handle is not valid");
+       SLOG(LOG_DEBUG, TAG_VCCMD, "Client destroy");
 
-       return VC_ERROR_INVALID_PARAMETER;
+       CMD_LIST_MUTEX_UNLOCK();
+       return VC_ERROR_NONE;
 }
 
 int vc_cmd_list_get_count(vc_cmd_list_h vc_cmd_list, int* count)
@@ -315,41 +337,34 @@ int vc_cmd_list_remove(vc_cmd_list_h vc_cmd_list, vc_cmd_h vc_command)
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "[List] list(%p), command(%p)", list, cmd);
 
-       vc_cmd_s* temp_cmd = NULL;
        GSList *iter = NULL;
-
-       iter = g_slist_nth(list->list, 0);
-
-       while (NULL != iter) {
-               temp_cmd = iter->data;
-
-               if (NULL != temp_cmd && cmd == temp_cmd) {
-                       list->list = g_slist_remove(list->list, temp_cmd);
-                       /*
-                       if (true == release_command) {
-                               SLOG(LOG_DEBUG, TAG_VCCMD, "Release command data");
-                               if (NULL != temp_cmd->command)          free(temp_cmd->command);
-                               if (NULL != temp_cmd->parameter)        free(temp_cmd->parameter);
-                               free(temp_cmd);
-                               temp_cmd = NULL;
-                       }
-                       */
-               }
-
-               iter = g_slist_next(iter);
+       iter = g_slist_find(list->list, cmd);
+       if (NULL == iter) {
+               SLOG(LOG_ERROR, TAG_VCCMD, "Fail to destroy command : handle is not valid");
+               return VC_ERROR_INVALID_PARAMETER;
        }
 
-       int count = g_slist_length(list->list);
+       list->list = g_slist_remove_link(list->list, iter);
+       SLOG(LOG_DEBUG, TAG_VCCMD, "destroy command");
 
-       if (0 == count) {
+       int len = g_slist_length(list->list);
+       if (0 == len)
                list->index = -1;
-       } else if (list->index == count) {
-               list->index = count - 1;
-       }
+       else if (list->index == len)
+               list->index = len - 1;
 
        return VC_ERROR_NONE;
 }
 
+static void __vc_cmd_list_remove_all_foreach(gpointer data)
+{
+       vc_cmd_s *temp = (vc_cmd_s *)data;
+       if (temp) {
+               SECURE_SLOG(LOG_DEBUG, TAG_VCCMD, "Free command(%p)", temp);
+               vc_cmd_destroy((vc_cmd_h)temp);
+       }
+}
+
 int vc_cmd_list_remove_all(vc_cmd_list_h vc_cmd_list, bool release_command)
 {
        if (0 != __vc_cmd_get_feature_enabled()) {
@@ -366,37 +381,24 @@ int vc_cmd_list_remove_all(vc_cmd_list_h vc_cmd_list, bool release_command)
                return VC_ERROR_INVALID_PARAMETER;
        }
 
-       vc_cmd_list_s* list = NULL;
-       list = (vc_cmd_list_s*)vc_cmd_list;
+       vc_cmd_list_s* cmd_list = (vc_cmd_list_s*)vc_cmd_list;
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "[List] list (%p), release command (%s)"
-                , list, release_command ? "true" : "false");
+                , cmd_list, release_command ? "true" : "false");
 
-       int count = g_slist_length(list->list);
-
-       int i ;
-       vc_cmd_s *temp_cmd;
-
-       for (i = 0; i < count ; i++) {
-               temp_cmd = g_slist_nth_data(list->list, 0);
-
-               if (NULL != temp_cmd) {
-                       list->list = g_slist_remove(list->list, temp_cmd);
+       if (NULL == cmd_list->list) {
+               SLOG(LOG_DEBUG, TAG_VCCMD, "@@@ List is already empty.");
+               return VC_ERROR_NONE;
+       }
 
-                       if (true == release_command) {
-                               SLOG(LOG_DEBUG, TAG_VCCMD, "Free command(%p)", temp_cmd);
-                               if (NULL != temp_cmd->command)          free(temp_cmd->command);
-                               if (NULL != temp_cmd->parameter)        free(temp_cmd->parameter);
-                               if (NULL != temp_cmd->appid)            free(temp_cmd->appid);
-                               if (NULL != temp_cmd->invocation_name)  free(temp_cmd->invocation_name);
-                               if (NULL != temp_cmd->fixed)            free(temp_cmd->fixed);
-                               free(temp_cmd);
-                               temp_cmd = NULL;
-                       }
-               }
+       if (true == release_command) {
+               g_slist_free_full(cmd_list->list, __vc_cmd_list_remove_all_foreach);
+       } else {
+               g_slist_free(cmd_list->list);
        }
-       list->list = NULL;
-       list->index = -1;
+
+       cmd_list->list = NULL;
+       cmd_list->index = -1;
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "@@@");
 
@@ -412,7 +414,7 @@ int vc_cmd_list_foreach_commands(vc_cmd_list_h vc_cmd_list, vc_cmd_list_cb callb
                return VC_ERROR_PERMISSION_DENIED;
        }
 
-       if (NULL == vc_cmd_list) {
+       if (NULL == vc_cmd_list || NULL == callback) {
                SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL");
                return VC_ERROR_INVALID_PARAMETER;
        }
@@ -420,28 +422,18 @@ int vc_cmd_list_foreach_commands(vc_cmd_list_h vc_cmd_list, vc_cmd_list_cb callb
        vc_cmd_list_s* list = NULL;
        list = (vc_cmd_list_s*)vc_cmd_list;
 
-       int count = g_slist_length(list->list);
-       int i ;
-
        GSList *iter = NULL;
-       vc_cmd_s *temp_cmd;
-
        iter = g_slist_nth(list->list, 0);
-
-       for (i = 0; i < count; i++) {
-               if (NULL == iter) {
+       while (NULL != iter) {
+               vc_cmd_s *temp_cmd = NULL;
+               temp_cmd = iter->data;
+               if (NULL == temp_cmd) {
                        SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] No command in list");
                        return VC_ERROR_OPERATION_FAILED;
                }
+               if (false == callback((vc_cmd_h)temp_cmd, user_data))
+                       break;
 
-               temp_cmd = iter->data;
-
-               if (NULL != temp_cmd) {
-                       if (false == callback((vc_cmd_h)temp_cmd, user_data)) {
-                               break;
-                       }
-
-               }
                iter = g_slist_next(iter);
        }
 
@@ -461,7 +453,7 @@ int vc_cmd_list_filter_by_type(vc_cmd_list_h original, int type, vc_cmd_list_h*
                return VC_ERROR_PERMISSION_DENIED;
        }
 
-       if (NULL == original) {
+       if (NULL == original || NULL == filtered) {
                SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL");
                return VC_ERROR_INVALID_PARAMETER;
        }
@@ -480,56 +472,45 @@ int vc_cmd_list_filter_by_type(vc_cmd_list_h original, int type, vc_cmd_list_h*
                return VC_ERROR_OPERATION_FAILED;
        }
 
-       int count = g_slist_length(list->list);
-       int i;
-
        GSList *iter = NULL;
-       vc_cmd_s *iter_cmd;
-
        iter = g_slist_nth(list->list, 0);
-
-       for (i = 0; i < count; i++) {
-               if (NULL == iter) {
+       while (NULL != iter) {
+               vc_cmd_s *iter_cmd = NULL;
+               iter_cmd = iter->data;
+               if (NULL == iter_cmd) {
                        SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] No command in list");
                        return VC_ERROR_OPERATION_FAILED;
                }
-               if (NULL != iter->data) {
-                       iter_cmd = iter->data;
-
-                       if (NULL != iter_cmd) {
-                               int iter_type;
-                               if (0 != vc_cmd_get_type((vc_cmd_h)iter_cmd, &iter_type)) {
-                                       SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Fail to get command type");
-                                       continue;
-                               }
 
-                               if (iter_type == type) {
-                                       vc_cmd_h temp_cmd;
-                                       if (0 != vc_cmd_create(&temp_cmd)) {
-                                               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Fail to create cmd");
-                                               continue;
-                                       }
-
-                                       memcpy(temp_cmd, iter_cmd, sizeof(vc_cmd_s));
-                                       if (NULL != iter_cmd->command) {
-                                               ((vc_cmd_s*)temp_cmd)->command = strdup(iter_cmd->command);
-                                       }
-                                       if (NULL != iter_cmd->parameter) {
-                                               ((vc_cmd_s*)temp_cmd)->parameter = strdup(iter_cmd->parameter);
-                                       }
-
-                                       if (0 != vc_cmd_list_add(temp_list, temp_cmd)) {
-                                               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Fail to cmd list add");
-                                               vc_cmd_destroy(temp_cmd);
-                                               continue;
-                                       }
-                               }
+               int iter_type = 0;
+               if (0 != vc_cmd_get_type((vc_cmd_h)iter_cmd, &iter_type)) {
+                       SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Fail to get command type");
+                       continue;
+               }
+
+               if (iter_type == type) {
+                       vc_cmd_h temp_cmd;
+                       if (0 != vc_cmd_create(&temp_cmd)) {
+                               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Fail to create cmd");
+                               continue;
+                       }
+
+                       memcpy(temp_cmd, iter_cmd, sizeof(vc_cmd_s));
+                       if (NULL != iter_cmd->command)
+                               ((vc_cmd_s *)temp_cmd)->command = strdup(iter_cmd->command);
+                       if (NULL != iter_cmd->parameter)
+                               ((vc_cmd_s *)temp_cmd)->parameter = strdup(iter_cmd->parameter);
+
+                       if (0 != vc_cmd_list_add(temp_list, temp_cmd)) {
+                               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Fail to cmd list add");
+                               vc_cmd_destroy(temp_cmd);
+                               continue;
                        }
                }
                iter = g_slist_next(iter);
        }
 
-       count = 0;
+       int count = 0;
        if (0 != vc_cmd_list_get_count(temp_list, &count)) {
                SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Fail to get count");
        } else {
@@ -618,6 +599,10 @@ int vc_cmd_list_next(vc_cmd_list_h vc_cmd_list)
        list = (vc_cmd_list_s*)vc_cmd_list;
 
        int count = g_slist_length(list->list);
+       if (0 == count) {
+               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] List is empty");
+               return VC_ERROR_EMPTY;
+       }
 
        if (list->index < count - 1) {
                list->index = list->index + 1;
@@ -647,6 +632,11 @@ int vc_cmd_list_prev(vc_cmd_list_h vc_cmd_list)
        vc_cmd_list_s* list = NULL;
        list = (vc_cmd_list_s*)vc_cmd_list;
 
+       if (0 == g_slist_length(list->list)) {
+               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] List is empty");
+               return VC_ERROR_EMPTY;
+       }
+
        if (list->index > 0) {
                list->index = list->index - 1;
                SLOG(LOG_DEBUG, TAG_VCCMD, "[DEBUG] List index : %d", list->index);
@@ -703,8 +693,11 @@ int vc_cmd_create(vc_cmd_h* vc_command)
                return VC_ERROR_PERMISSION_DENIED;
        }
 
+       CMD_MUTEX_LOCK();
+
        if (NULL == vc_command) {
                SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL");
+               CMD_MUTEX_UNLOCK();
                return VC_ERROR_INVALID_PARAMETER;
        }
 
@@ -712,6 +705,7 @@ int vc_cmd_create(vc_cmd_h* vc_command)
 
        if (NULL == command) {
                SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Not enough memory");
+               CMD_MUTEX_UNLOCK();
                return VC_ERROR_OUT_OF_MEMORY;
        }
 
@@ -733,8 +727,11 @@ int vc_cmd_create(vc_cmd_h* vc_command)
 
        *vc_command = (vc_cmd_h)command;
 
+       g_cmd_list = g_list_append(g_cmd_list, command);
+
        SLOG(LOG_DEBUG, TAG_VCCMD, "[Create command][%p]", *vc_command);
 
+       CMD_MUTEX_UNLOCK();
        return VC_ERROR_NONE;
 }
 
@@ -747,8 +744,11 @@ int vc_cmd_destroy(vc_cmd_h vc_command)
                return VC_ERROR_PERMISSION_DENIED;
        }
 
+       CMD_MUTEX_LOCK();
+
        if (NULL == vc_command) {
                SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL");
+               CMD_MUTEX_UNLOCK();
                return VC_ERROR_INVALID_PARAMETER;
        }
 
@@ -757,35 +757,38 @@ int vc_cmd_destroy(vc_cmd_h vc_command)
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "[Destroy command][%p]", command);
 
-       if (NULL != command) {
-               if (NULL != command->command) {
-                       free(command->command);
-                       command->command = NULL;
-               }
-               if (NULL != command->parameter) {
-                       free(command->parameter);
-                       command->parameter = NULL;
-               }
-               if (NULL != command->invocation_name) {
-                       free(command->invocation_name);
-                       command->invocation_name = NULL;
-               }
-               if (NULL != command->appid) {
-                       free(command->appid);
-                       command->appid = NULL;
-               }
-               if (NULL != command->fixed) {
-                       free(command->fixed);
-                       command->fixed = NULL;
-               }
-               if (NULL != command->coordinates) {
-                       free(command->coordinates);
-                       command->coordinates = NULL;
-               }
-               free(command);
-               command = NULL;
+       GList *iter = NULL;
+       iter = g_list_find(g_cmd_list, command);
+       if (NULL == iter) {
+               SLOG(LOG_ERROR, TAG_VCCMD, "Fail to command destroy : handle is not valid");
+               CMD_MUTEX_UNLOCK();
+               return VC_ERROR_INVALID_PARAMETER;
        }
 
+       g_cmd_list = g_list_delete_link(g_cmd_list, iter);
+
+       if (command->command)
+               free(command->command);
+       command->command = NULL;
+       if (command->parameter)
+               free(command->parameter);
+       command->parameter = NULL;
+       if (command->invocation_name)
+               free(command->invocation_name);
+       command->invocation_name = NULL;
+       if (command->appid)
+               free(command->appid);
+       command->appid = NULL;
+       if (command->fixed)
+               free(command->fixed);
+       command->fixed = NULL;
+       if (command->coordinates)
+               free(command->coordinates);
+       command->coordinates = NULL;
+       free(command);
+       command = NULL;
+
+       CMD_MUTEX_UNLOCK();
        return VC_ERROR_NONE;
 }
 
@@ -806,14 +809,13 @@ int vc_cmd_set_id(vc_cmd_h vc_command, int id)
        vc_cmd_s* cmd = NULL;
        cmd = (vc_cmd_s*)vc_command;
 
-       if (NULL != cmd) {
-               cmd->id = id;
-               SLOG(LOG_DEBUG, TAG_VCCMD, "[Set id][%p] id(%d)", vc_command, cmd->id);
-       }
+       cmd->id = id;
+       SLOG(LOG_DEBUG, TAG_VCCMD, "[Set id][%p] id(%d)", vc_command, cmd->id);
 
-       return 0;
+       return VC_ERROR_NONE;
 }
 
+//LCOV_EXCL_START
 int vc_cmd_get_id(vc_cmd_h vc_command, int* id)
 {
        if (0 != __vc_cmd_get_feature_enabled()) {
@@ -831,13 +833,12 @@ int vc_cmd_get_id(vc_cmd_h vc_command, int* id)
        vc_cmd_s* cmd = NULL;
        cmd = (vc_cmd_s*)vc_command;
 
-       if (NULL != cmd) {
-               *id = cmd->id;
-               SLOG(LOG_DEBUG, TAG_VCCMD, "[Get id][%p] id(%d)", vc_command, *id);
-       }
+       *id = cmd->id;
+       SLOG(LOG_DEBUG, TAG_VCCMD, "[Get id][%p] id(%d)", vc_command, *id);
 
-       return 0;
+       return VC_ERROR_NONE;
 }
+//LCOV_EXCL_STOP
 
 int vc_cmd_set_appid(vc_cmd_h vc_command, const char* appid)
 {
@@ -858,15 +859,13 @@ int vc_cmd_set_appid(vc_cmd_h vc_command, const char* appid)
        vc_cmd_s* cmd = NULL;
        cmd = (vc_cmd_s*)vc_command;
 
-       if (NULL != cmd->appid) {
+       if (cmd->appid)
                free(cmd->appid);
-               cmd->appid = NULL;
-       }
-
+       cmd->appid = NULL;
        cmd->appid = strdup(appid);
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "[Set appid][%p] appid(%s)", vc_command, cmd->appid);
-       return 0;
+       return VC_ERROR_NONE;
 }
 
 int vc_cmd_get_appid(vc_cmd_h vc_command, char** appid)
@@ -883,12 +882,14 @@ int vc_cmd_get_appid(vc_cmd_h vc_command, char** appid)
        vc_cmd_s* cmd = NULL;
        cmd = (vc_cmd_s*)vc_command;
 
-       if (NULL != cmd->appid) {
+       if (cmd->appid)
                *appid = strdup(gettext(cmd->appid));
-       }
+       else
+               *appid = NULL;
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "[Get appid][%p] appid(%s)", vc_command, *appid);
-       return 0;
+
+       return VC_ERROR_NONE;
 }
 
 int vc_cmd_set_command(vc_cmd_h vc_command, const char* command)
@@ -900,7 +901,7 @@ int vc_cmd_set_command(vc_cmd_h vc_command, const char* command)
                return VC_ERROR_PERMISSION_DENIED;
        }
 
-       if (NULL == vc_command) {
+       if (NULL == vc_command || NULL == command) {
                SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter ");
                return VC_ERROR_INVALID_PARAMETER;
        }
@@ -908,19 +909,14 @@ int vc_cmd_set_command(vc_cmd_h vc_command, const char* command)
        vc_cmd_s* cmd = NULL;
        cmd = (vc_cmd_s*)vc_command;
 
-       if (NULL != cmd->command) {
+       if (cmd->command)
                free(cmd->command);
-       }
-
        cmd->command = NULL;
-
-       if (NULL != command) {
-               cmd->command = strdup(command);
-       }
+       cmd->command = strdup(command);
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "[Set command][%p] Command(%s)", vc_command, cmd->command);
 
-       return 0;
+       return VC_ERROR_NONE;
 }
 
 int vc_cmd_get_command(vc_cmd_h vc_command, char** command)
@@ -940,13 +936,14 @@ int vc_cmd_get_command(vc_cmd_h vc_command, char** command)
        vc_cmd_s* cmd = NULL;
        cmd = (vc_cmd_s*)vc_command;
 
-       if (NULL != cmd->command) {
+       if (cmd->command)
                *command = strdup(gettext(cmd->command));
-       }
+       else
+               *command = NULL;
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "[Get command][%p] Command(%s)", vc_command, *command);
 
-       return 0;
+       return VC_ERROR_NONE;
 }
 
 int vc_cmd_set_unfixed_command(vc_cmd_h vc_command, const char* command)
@@ -958,7 +955,7 @@ int vc_cmd_set_unfixed_command(vc_cmd_h vc_command, const char* command)
                return VC_ERROR_PERMISSION_DENIED;
        }
 
-       if (NULL == vc_command) {
+       if (NULL == vc_command || NULL == command) {
                SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter ");
                return VC_ERROR_INVALID_PARAMETER;
        }
@@ -966,18 +963,13 @@ int vc_cmd_set_unfixed_command(vc_cmd_h vc_command, const char* command)
        vc_cmd_s* cmd = NULL;
        cmd = (vc_cmd_s*)vc_command;
 
-       if (NULL != cmd->parameter) {
+       if (cmd->parameter)
                free(cmd->parameter);
-       }
-
        cmd->parameter = NULL;
+       cmd->parameter = strdup(command);
+       SLOG(LOG_DEBUG, TAG_VCCMD, "[Set unfixed command][%p] unfixed command(%s)", vc_command, cmd->parameter);
 
-       if (NULL != command) {
-               cmd->parameter = strdup(command);
-               SLOG(LOG_DEBUG, TAG_VCCMD, "[Set unfixed command][%p] unfixed command(%s)", vc_command, cmd->parameter);
-       }
-
-       return 0;
+       return VC_ERROR_NONE;
 }
 
 int vc_cmd_get_unfixed_command(vc_cmd_h vc_command, char** command)
@@ -994,14 +986,17 @@ int vc_cmd_get_unfixed_command(vc_cmd_h vc_command, char** command)
        vc_cmd_s* cmd = NULL;
        cmd = (vc_cmd_s*)vc_command;
 
-       if (NULL != cmd->parameter) {
+       if (cmd->parameter)
                *command = strdup(gettext(cmd->parameter));
-               SLOG(LOG_DEBUG, TAG_VCCMD, "[Get unfixed command][%p] unfixed command(%s)", vc_command, *command);
-       }
+       else
+               *command = NULL;
+
+       SLOG(LOG_DEBUG, TAG_VCCMD, "[Get unfixed command][%p] unfixed command(%s)", vc_command, *command);
 
-       return 0;
+       return VC_ERROR_NONE;
 }
 
+//LCOV_EXCL_START
 int vc_cmd_set_fixed_command(vc_cmd_h vc_command, const char* fixed)
 {
        if (0 != __vc_cmd_get_feature_enabled()) {
@@ -1021,15 +1016,13 @@ int vc_cmd_set_fixed_command(vc_cmd_h vc_command, const char* fixed)
        vc_cmd_s* cmd = NULL;
        cmd = (vc_cmd_s*)vc_command;
 
-       if (NULL != cmd->fixed) {
+       if (cmd->fixed)
                free(cmd->fixed);
-               cmd->fixed = NULL;
-       }
-
+       cmd->fixed = NULL;
        cmd->fixed = strdup(fixed);
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "[Set parameter][%p] fixed command(%s)", vc_command, cmd->fixed);
-       return 0;
+       return VC_ERROR_NONE;
 }
 
 int vc_cmd_get_fixed_command(vc_cmd_h vc_command, char** fixed)
@@ -1046,13 +1039,16 @@ int vc_cmd_get_fixed_command(vc_cmd_h vc_command, char** fixed)
        vc_cmd_s* cmd = NULL;
        cmd = (vc_cmd_s*)vc_command;
 
-       if (NULL != cmd->fixed) {
+       if (cmd->fixed)
                *fixed = strdup(gettext(cmd->fixed));
-               SLOG(LOG_DEBUG, TAG_VCCMD, "[Get fixed command][%p] fixed command(%s)", vc_command, *fixed);
-       }
+       else
+               *fixed = NULL;
+
+       SLOG(LOG_DEBUG, TAG_VCCMD, "[Get fixed command][%p] fixed command(%s)", vc_command, *fixed);
 
-       return 0;
+       return VC_ERROR_NONE;
 }
+//LCOV_EXCL_STOP
 
 int vc_cmd_set_invocation_name(vc_cmd_h vc_command, const char* invocation_name)
 {
@@ -1073,17 +1069,16 @@ int vc_cmd_set_invocation_name(vc_cmd_h vc_command, const char* invocation_name)
        vc_cmd_s* cmd = NULL;
        cmd = (vc_cmd_s*)vc_command;
 
-       if (NULL != cmd->invocation_name) {
+       if (cmd->invocation_name)
                free(cmd->invocation_name);
-               cmd->invocation_name = NULL;
-       }
-
+       cmd->invocation_name = NULL;
        cmd->invocation_name = strdup(invocation_name);
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "[Set invocation name][%p] invocation_name(%s)", vc_command, cmd->invocation_name);
-       return 0;
+       return VC_ERROR_NONE;
 }
 
+//LCOV_EXCL_START
 int vc_cmd_get_invocation_name(vc_cmd_h vc_command, char** invocation_name)
 {
        if (0 != __vc_cmd_get_feature_enabled()) {
@@ -1098,13 +1093,15 @@ int vc_cmd_get_invocation_name(vc_cmd_h vc_command, char** invocation_name)
        vc_cmd_s* cmd = NULL;
        cmd = (vc_cmd_s*)vc_command;
 
-       if (NULL != cmd->invocation_name) {
+       if (cmd->invocation_name)
                *invocation_name = strdup(gettext(cmd->invocation_name));
-       }
+       else
+               *invocation_name = NULL;
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "[Get invocation name][%p] invocation_name(%s)", vc_command, *invocation_name);
-       return 0;
+       return VC_ERROR_NONE;
 }
+//LCOV_EXCL_STOP
 
 int vc_cmd_set_type(vc_cmd_h vc_command, int type)
 {
@@ -1120,6 +1117,11 @@ int vc_cmd_set_type(vc_cmd_h vc_command, int type)
                return VC_ERROR_INVALID_PARAMETER;
        }
 
+       if (VC_COMMAND_TYPE_NONE >= type || VC_COMMAND_TYPE_EXCLUSIVE < type) {
+               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid type(%d)", type);
+               return VC_ERROR_INVALID_PARAMETER;
+       }
+
        vc_cmd_s* cmd = NULL;
        cmd = (vc_cmd_s*)vc_command;
 
@@ -1127,7 +1129,7 @@ int vc_cmd_set_type(vc_cmd_h vc_command, int type)
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "[Set type][%p] type(%d)", vc_command, cmd->type);
 
-       return 0;
+       return VC_ERROR_NONE;
 }
 
 int vc_cmd_get_type(vc_cmd_h vc_command, int* type)
@@ -1151,7 +1153,7 @@ int vc_cmd_get_type(vc_cmd_h vc_command, int* type)
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "[Get type][%p] type(%d)", vc_command, *type);
 
-       return 0;
+       return VC_ERROR_NONE;
 }
 
 int vc_cmd_set_format(vc_cmd_h vc_command, int format)
@@ -1165,6 +1167,11 @@ int vc_cmd_set_format(vc_cmd_h vc_command, int format)
                return VC_ERROR_INVALID_PARAMETER;
        }
 
+       if (VC_COMMAND_FORMAT_FIXED > format || VC_COMMAND_FORMAT_NONFIXED_AND_FIXED < format) {
+               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid format(%d)", format);
+               return VC_ERROR_INVALID_PARAMETER;
+       }
+
        vc_cmd_s* cmd = NULL;
        cmd = (vc_cmd_s*)vc_command;
 
@@ -1172,7 +1179,7 @@ int vc_cmd_set_format(vc_cmd_h vc_command, int format)
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "[Set format][%p] format(%d)", vc_command, format);
 
-       return 0;
+       return VC_ERROR_NONE;
 }
 
 int vc_cmd_get_format(vc_cmd_h vc_command, int* format)
@@ -1193,7 +1200,7 @@ int vc_cmd_get_format(vc_cmd_h vc_command, int* format)
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "[Get format][%p] format(%d)", vc_command, *format);
 
-       return 0;
+       return VC_ERROR_NONE;
 }
 
 int vc_cmd_set_pid(vc_cmd_h vc_command, int pid)
@@ -1210,6 +1217,11 @@ int vc_cmd_set_pid(vc_cmd_h vc_command, int pid)
                return VC_ERROR_INVALID_PARAMETER;
        }
 
+       if (0 > pid) {
+               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid pid (%d)", pid);
+               return VC_ERROR_INVALID_PARAMETER;
+       }
+
        vc_cmd_s* cmd = NULL;
        cmd = (vc_cmd_s*)vc_command;
 
@@ -1217,7 +1229,7 @@ int vc_cmd_set_pid(vc_cmd_h vc_command, int pid)
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "[Set pid][%p] pid(%d)", vc_command, cmd->pid);
 
-       return 0;
+       return VC_ERROR_NONE;
 }
 
 int vc_cmd_get_pid(vc_cmd_h vc_command, int* pid)
@@ -1241,7 +1253,7 @@ int vc_cmd_get_pid(vc_cmd_h vc_command, int* pid)
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "[Get pid][%p] pid(%d)", vc_command, *pid);
 
-       return 0;
+       return VC_ERROR_NONE;
 }
 
 int vc_cmd_set_domain(vc_cmd_h vc_command, int domain)
@@ -1265,7 +1277,7 @@ int vc_cmd_set_domain(vc_cmd_h vc_command, int domain)
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "[Set domain] domain : %d", domain);
 
-       return 0;
+       return VC_ERROR_NONE;
 }
 
 int vc_cmd_get_domain(vc_cmd_h vc_command, int* domain)
@@ -1289,9 +1301,10 @@ int vc_cmd_get_domain(vc_cmd_h vc_command, int* domain)
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "[Get domain] domain : %d", *domain);
 
-       return 0;
+       return VC_ERROR_NONE;
 }
 
+//LCOV_EXCL_START
 /**
 * @brief Sets key value of command.
 *
@@ -1324,7 +1337,7 @@ int vc_cmd_set_result_key(vc_cmd_h vc_command, int key, int modifier)
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "@@@");
 
-       return 0;
+       return VC_ERROR_NONE;
 }
 
 /**
@@ -1357,7 +1370,7 @@ int vc_cmd_get_result_key(vc_cmd_h vc_command, int* key, int* modifier)
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "@@@");
 
-       return 0;
+       return VC_ERROR_NONE;
 }
 
 int vc_cmd_print_list(vc_cmd_list_h vc_cmd_list)
@@ -1372,23 +1385,25 @@ int vc_cmd_print_list(vc_cmd_list_h vc_cmd_list)
        SLOG(LOG_DEBUG, TAG_VCCMD, "@ Command List @");
        SLOG(LOG_DEBUG, TAG_VCCMD, "[List][%p]", list);
 
-       int count = g_slist_length(list->list);
-
-       int i;
-       vc_cmd_s *cmd = NULL;
-
-       for (i = 0; i < count ; i++) {
-               cmd = g_slist_nth_data(list->list, i);
-
-               if (NULL != cmd) {
-                       SLOG(LOG_DEBUG, TAG_VCCMD, "  [%d][%p] PID(%d) ID(%d) Type(%d) Format(%d) Command(%s) Param(%s) Appid(%s) Invocation(%s) Fixed(%s)",
-                        i, cmd, cmd->pid, cmd->index, cmd->type, cmd->format, cmd->command, cmd->parameter, cmd->appid, cmd->invocation_name, cmd->fixed);
+       int i = 0;
+       GSList *iter = NULL;
+       iter = g_slist_nth(list->list, 0);
+       while (NULL != iter) {
+               vc_cmd_s *cmd = NULL;
+               cmd = iter->data;
+               if (NULL == cmd) {
+                       SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] No command in list");
+                       return VC_ERROR_OPERATION_FAILED;
                }
+               SLOG(LOG_DEBUG, TAG_VCCMD, "  [%d][%p] PID(%d) ID(%d) Type(%d) Format(%d) Command(%s) Param(%s) Appid(%s) Invocation(%s) Fixed(%s)",
+                        i++, cmd, cmd->pid, cmd->index, cmd->type, cmd->format, cmd->command, cmd->parameter, cmd->appid, cmd->invocation_name, cmd->fixed);
+
+               iter = g_slist_next(iter);
        }
 
        SLOG(LOG_DEBUG, TAG_VCCMD, "@@@");
 
-       return 0;
+       return VC_ERROR_NONE;
 }
 
 int vc_cmd_get_nlu_json(vc_cmd_h vc_cmd, char** json)
@@ -1415,7 +1430,7 @@ int vc_cmd_get_nlu_json(vc_cmd_h vc_cmd, char** json)
                return VC_ERROR_OPERATION_FAILED;
        }
 
-       return 0;
+       return VC_ERROR_NONE;
 }
 
 static void __vc_cmd_regex_deinit(int num_regex)
@@ -1748,8 +1763,6 @@ static int __vc_cmd_trelative_check(const char *str, struct tm *td, int *exist)
        int hour = -1;
        int min = -1;
 
-       char *tempstr = NULL;
-
        *exist = 0;
        ret = regexec(&reg[3], str, 1, pmatch, 0);
        if (0 == ret) {
@@ -1767,7 +1780,7 @@ static int __vc_cmd_trelative_check(const char *str, struct tm *td, int *exist)
                                SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid string length");
                                return VC_ERROR_OPERATION_FAILED;
                        }
-                       tempstr = strndup(str + pmatch[1].rm_so, (size_t)len);
+                       char *tempstr = strndup(str + pmatch[1].rm_so, (size_t)len);
 
                        if (NULL == tempstr) {
                                SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Memory allocation is failed");
@@ -1793,7 +1806,7 @@ static int __vc_cmd_trelative_check(const char *str, struct tm *td, int *exist)
                                SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid string length");
                                return VC_ERROR_OPERATION_FAILED;
                        }
-                       tempstr = strndup(str + pmatch[1].rm_so, (size_t)len);
+                       char *tempstr = strndup(str + pmatch[1].rm_so, (size_t)len);
 
                        if (NULL == tempstr) {
                                SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Memory allocation is failed");
@@ -1846,7 +1859,6 @@ static int __vc_cmd_tabsolute_check(const char *str, struct tm *td, int *exist)
        int min = -1;
        int sidx = -1;
        int eidx = -1;
-       char *tempstr = NULL;
 
        *exist = 0;
        ret = regexec(&reg[0], str, 5, pmatch, 0);
@@ -1867,7 +1879,7 @@ static int __vc_cmd_tabsolute_check(const char *str, struct tm *td, int *exist)
                        SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid string length");
                        return VC_ERROR_OPERATION_FAILED;
                }
-               tempstr = strndup(str + pmatch[1].rm_so, (size_t)len);
+               char *tempstr = strndup(str + pmatch[1].rm_so, (size_t)len);
 
                if (NULL == tempstr) {
                        SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Memory allocation is failed");
@@ -1884,7 +1896,9 @@ static int __vc_cmd_tabsolute_check(const char *str, struct tm *td, int *exist)
                }
 
                if (0 > hour || 24 <= hour || (0 == flag && 12 < hour)) {
-                       SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incomming sentence is weird");
+                       SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incoming sentence is weird");
+                       free(tempstr);
+                       tempstr = NULL;
                        return VC_ERROR_NONE;
                }
 
@@ -1896,7 +1910,7 @@ static int __vc_cmd_tabsolute_check(const char *str, struct tm *td, int *exist)
                if (0 > sidx || pmatch[0].rm_so < sidx) sidx = pmatch[0].rm_so;
                if (0 > eidx || pmatch[0].rm_eo > eidx) eidx = pmatch[0].rm_eo;
        } else if (0 < flag) {
-               SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incomming sentence is weird");
+               SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incoming sentence is weird");
                return VC_ERROR_NONE;
        }
 
@@ -1905,7 +1919,7 @@ static int __vc_cmd_tabsolute_check(const char *str, struct tm *td, int *exist)
                idx = 1;
                len = pmatch[idx].rm_eo - pmatch[idx].rm_so;
                if (0 < len) {
-                       tempstr = strndup(str + pmatch[idx].rm_so, (size_t)len);
+                       char *tempstr = strndup(str + pmatch[idx].rm_so, (size_t)len);
 
                        if (NULL == tempstr) {
                                SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Memory allocation is failed");
@@ -1915,7 +1929,9 @@ static int __vc_cmd_tabsolute_check(const char *str, struct tm *td, int *exist)
                        min = atoi(tempstr);
 
                        if (0 > min || 60 <= min) {
-                               SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incomming sentence is weird");
+                               SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incoming sentence is weird");
+                               free(tempstr);
+                               tempstr = NULL;
                                return VC_ERROR_NONE;
                        }
 
@@ -1952,7 +1968,7 @@ static int __vc_cmd_tabsolute_check(const char *str, struct tm *td, int *exist)
                }
 
                if (!strcmp("en_US", lang)) {
-                       SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incomming sentence is weird");
+                       SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incoming sentence is weird");
                        free(lang);
                        lang = NULL;
                        return VC_ERROR_NONE;
@@ -2076,7 +2092,7 @@ static int __vc_cmd_dabsolute_check(const char *str, struct tm *td, int *exist)
                sidx = pmatch[0].rm_so;
                eidx = pmatch[0].rm_eo;
        } else {
-               SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incomming sentence is weird");
+               SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incoming sentence is weird");
                return VC_ERROR_NONE;
        }
 
@@ -2106,7 +2122,7 @@ static int __vc_cmd_dabsolute_check(const char *str, struct tm *td, int *exist)
                }
 
                if (!strcmp("en_US", lang)) {
-                       SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incomming sentence is weird");
+                       SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incoming sentence is weird");
                        free(lang);
                        lang = NULL;
                        return VC_ERROR_NONE;
@@ -2155,7 +2171,7 @@ static int __vc_cmd_dabsolute_check(const char *str, struct tm *td, int *exist)
                td->tm_min = 0;
                td->tm_sec = 0;
        } else if (2 == g_time_flag) {
-               SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incomming sentence is weird");
+               SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incoming sentence is weird");
                return VC_ERROR_NONE;
        }
 
@@ -2163,7 +2179,7 @@ static int __vc_cmd_dabsolute_check(const char *str, struct tm *td, int *exist)
        if ((0 == (year + 1900) % 4 && 0 != (year + 1900) % 100) || 0 == (year + 1900) % 400) max_day[1] = 29;
 
        if (max_day[mon] < day || 1 > day) {
-               SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incomming sentence is weird");
+               SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incoming sentence is weird");
                return VC_ERROR_NONE;
        }
 
@@ -2201,7 +2217,7 @@ static int __vc_cmd_time_check(const char *str, struct tm *td)
                SLOG(LOG_DEBUG, TAG_VCCMD, "@@@ Time value is exist");
                return ret;
        } else if (VC_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occured > (%d)", ret);
+               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occurred > (%d)", ret);
                return ret;
        }
 
@@ -2212,7 +2228,7 @@ static int __vc_cmd_time_check(const char *str, struct tm *td)
                SLOG(LOG_DEBUG, TAG_VCCMD, "@@@ Time value is exist");
                return ret;
        } else if (VC_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occured > (%d)", ret);
+               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occurred > (%d)", ret);
                return ret;
        }
 
@@ -2223,7 +2239,7 @@ static int __vc_cmd_time_check(const char *str, struct tm *td)
                SLOG(LOG_DEBUG, TAG_VCCMD, "@@@ Time value is exist");
                return ret;
        } else if (VC_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occured > (%d)", ret);
+               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occurred > (%d)", ret);
                return ret;
        }
 
@@ -2245,7 +2261,7 @@ static int __vc_cmd_date_check(const char *str, struct tm *td)
                SLOG(LOG_DEBUG, TAG_VCCMD, "@@@ Date value is exist");
                return ret;
        } else if (VC_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occured > (%d)", ret);
+               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occurred > (%d)", ret);
                return ret;
        }
 
@@ -2256,7 +2272,7 @@ static int __vc_cmd_date_check(const char *str, struct tm *td)
                SLOG(LOG_DEBUG, TAG_VCCMD, "@@@ Date value is exist");
                return ret;
        } else if (VC_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occured > (%d)", ret);
+               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occurred > (%d)", ret);
                return ret;
        }
 
@@ -2298,13 +2314,13 @@ int vc_cmd_get_datetime(const char *text, time_t *result, char **remain)
 
        ret = __vc_cmd_time_check(text, &td);
        if (VC_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occured in the check > (%d)", ret);
+               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occurred in the check > (%d)", ret);
                return ret;
        }
 
        ret = __vc_cmd_date_check(text, &td);
        if (VC_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occured in the check > (%d)", ret);
+               SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occurred in the check > (%d)", ret);
                return ret;
        }
 
@@ -2334,3 +2350,4 @@ int vc_cmd_get_datetime(const char *text, time_t *result, char **remain)
 
        return VC_ERROR_NONE;
 }
+//LCOV_EXCL_STOP