- 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;