static int g_privilege_allowed = 1; /* Always True */
static cynara *p_cynara = NULL;
+static GList *g_cmdlist_list = NULL;
+
// For getting timestamp using regular expression
static regex_t reg[MAX_NUM_REGEX];
*vc_cmd_list = (vc_cmd_list_h)list;
+ g_cmdlist_list = g_list_append(g_cmdlist_list, list);
+
SLOG(LOG_DEBUG, TAG_VCCMD, "[List] list(%p)", *vc_cmd_list);
return VC_ERROR_NONE;
SLOG(LOG_DEBUG, TAG_VCCMD, "[List] list(%p)", list);
- if (NULL != list) {
- free(list);
- list = NULL;
+ 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);
+
+ free(data);
+ data = NULL;
+
+ SLOG(LOG_DEBUG, TAG_VCCMD, "Client destroy");
+ g_list_free(iter);
+
+ return VC_ERROR_NONE;
+ }
+ /* Next item */
+ iter = g_list_next(iter);
+ }
}
+ SLOG(LOG_ERROR, TAG_VCCMD, "Fail to destroy client : handle is not valid");
- return VC_ERROR_NONE;
+ return VC_ERROR_INVALID_PARAMETER;
}
int vc_cmd_list_get_count(vc_cmd_list_h vc_cmd_list, int* count)