delq
This commit is contained in:
parent
69ff0e3891
commit
a285b14222
1 changed files with 14 additions and 12 deletions
|
|
@ -166,11 +166,12 @@ syntax_append(clicon_handle h,
|
||||||
* Unload all plugins in a group
|
* Unload all plugins in a group
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
syntax_unload(clicon_handle h)
|
cli_syntax_unload(clicon_handle h)
|
||||||
{
|
{
|
||||||
struct cli_plugin *p;
|
cli_syntax_t *stx = cli_syntax(h);
|
||||||
cli_syntax_t *stx = cli_syntax(h);
|
struct cli_plugin *p;
|
||||||
|
cli_syntaxmode_t *m;
|
||||||
|
|
||||||
if (stx == NULL)
|
if (stx == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
@ -178,15 +179,16 @@ syntax_unload(clicon_handle h)
|
||||||
p = stx->stx_plugins;
|
p = stx->stx_plugins;
|
||||||
plugin_unload(h, p->cp_handle);
|
plugin_unload(h, p->cp_handle);
|
||||||
clicon_debug(1, "DEBUG: Plugin '%s' unloaded.", p->cp_name);
|
clicon_debug(1, "DEBUG: Plugin '%s' unloaded.", p->cp_name);
|
||||||
DELQ(stx->stx_plugins, stx->stx_plugins, struct cli_plugin *);
|
DELQ(p, stx->stx_plugins, struct cli_plugin *);
|
||||||
if (stx->stx_plugins)
|
if (p)
|
||||||
free(stx->stx_plugins);
|
free(p);
|
||||||
stx->stx_nplugins--;
|
stx->stx_nplugins--;
|
||||||
}
|
}
|
||||||
while (stx->stx_nmodes > 0) {
|
while (stx->stx_nmodes > 0) {
|
||||||
DELQ(stx->stx_modes, stx->stx_modes, cli_syntaxmode_t *);
|
m = stx->stx_modes;
|
||||||
if (stx->stx_modes)
|
DELQ(m, stx->stx_modes, cli_syntaxmode_t *);
|
||||||
free(stx->stx_modes);
|
if (m)
|
||||||
|
free(m);
|
||||||
stx->stx_nmodes--;
|
stx->stx_nmodes--;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -509,7 +511,7 @@ cli_syntax_load (clicon_handle h)
|
||||||
|
|
||||||
quit:
|
quit:
|
||||||
if (retval != 0) {
|
if (retval != 0) {
|
||||||
syntax_unload(h);
|
cli_syntax_unload(h);
|
||||||
cli_syntax_set(h, NULL);
|
cli_syntax_set(h, NULL);
|
||||||
}
|
}
|
||||||
if (dp)
|
if (dp)
|
||||||
|
|
@ -547,7 +549,7 @@ cli_plugin_start(clicon_handle h, int argc, char **argv)
|
||||||
int
|
int
|
||||||
cli_plugin_finish(clicon_handle h)
|
cli_plugin_finish(clicon_handle h)
|
||||||
{
|
{
|
||||||
syntax_unload(h);
|
cli_syntax_unload(h);
|
||||||
cli_syntax_set(h, NULL);
|
cli_syntax_set(h, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue