aboutsummaryrefslogtreecommitdiffstats
path: root/tbl_qcmd.c
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2017-03-04 18:10:49 +0000
committerFreeArtMan <dos21h@gmail.com>2017-03-04 18:10:49 +0000
commit5453a41e1bf0555ca391ea37faafd64889069789 (patch)
treea3eb91295aef3566e7ad92a6c2a9b596ed585bce /tbl_qcmd.c
parent65e7a20b5d440b0c224a665fccdb5c9d475fa509 (diff)
downloadagni-5453a41e1bf0555ca391ea37faafd64889069789.tar.gz
agni-5453a41e1bf0555ca391ea37faafd64889069789.zip
Fixed cmd/exec table
Diffstat (limited to 'tbl_qcmd.c')
-rw-r--r--tbl_qcmd.c87
1 files changed, 86 insertions, 1 deletions
diff --git a/tbl_qcmd.c b/tbl_qcmd.c
index 7045af9..6d7360d 100644
--- a/tbl_qcmd.c
+++ b/tbl_qcmd.c
@@ -120,6 +120,52 @@ int tbl_exec_print(tble_exec *tble, int flags)
return 0;
}
+int tbl_exec_tbl_free(tbl_exec *tbl)
+{
+ int i;
+
+ if (tbl == NULL)
+ {
+ return -1;
+ }
+
+ if (tbl->cmd != NULL)
+ {
+ for (i=0;i<tbl->size;i++)
+ {
+ tbl_exec_tel_free(tbl->cmd[i]);
+ }
+ free(tbl->cmd);
+ }
+
+ free(tbl);
+
+ return 0;
+}
+
+
+int tbl_exec_tel_free(tble_exec *tble)
+{
+ int i;
+
+ if (tble == NULL)
+ {
+ return -1;
+ }
+
+ free(tble->name);
+ tble->name = NULL;
+
+ free(tble->cmd);
+ tble->cmd = NULL;
+
+ free(tble);
+ tble = NULL;
+
+ return 0;
+}
+
+
int tbl_exec_print_tbl(tbl_exec *tbl, int flags)
{
int i;
@@ -358,6 +404,7 @@ int tbl_cmd_param_print(tble_cmd_param *param)
if (param == NULL)
return -1;
+ printf("PARAM ");
printf("ID:[%d] ", param->id);
printf("QID:[%d] ", param->qid);
printf("OUT_Q:[%d] ", param->out_q);
@@ -395,7 +442,11 @@ int tbl_cmd_resp_free(tble_cmd_resp *resp)
return -1;
}
+ free(resp->resp);
+ resp->resp = NULL;
+ free(resp);
+ resp = NULL;
return 0;
}
@@ -405,6 +456,7 @@ int tbl_cmd_resp_print(tble_cmd_resp *resp)
if (resp == NULL)
return -1;
+ printf("RESP ");
printf("ID:[%d] ", resp->id);
printf("QID:[%d] ", resp->qid);
printf("TYPE:[%d] ", resp->type);
@@ -499,14 +551,47 @@ int tbl_qcmd_print_tbl(tbl_qcmd *tbl, int flags)
}
-int tbl_qcmd_destroy_cmd(tble_qcmd *tbl)
+int tbl_qcmd_destroy_cmd(tble_qcmd *tble)
{
+ if (tble == NULL )
+ {
+ return -1;
+ }
+
+ free(tble->cmd);
+ tble->cmd = NULL;
+
+ free(tble->param);
+ tble->param = NULL;
+
+ free(tble);
+ tble=NULL;
+
return 0;
}
int tbl_qcmd_destroy_table(tbl_qcmd *tbl)
{
+ int i;
+
+ if (tbl == NULL)
+ {
+ return -1;
+ }
+
+ for (i=0; i<tbl->size;i++)
+ {
+ if (tbl->cmd[i] != NULL)
+ tbl_qcmd_destroy_cmd(tbl->cmd[i]);
+ }
+
+ free(tbl->cmd);
+ tbl->cmd = NULL;
+
+ free(tbl);
+ tbl = NULL;
+
return 0;
}