summaryrefslogtreecommitdiffstats
path: root/cmd-list.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2013-03-22 15:49:55 +0000
committerNicholas Marriott <nicm@openbsd.org>2013-03-22 15:49:55 +0000
commitd1e6ce26722e3a0774d240e39bbc69b07e93c48b (patch)
tree4ac0c275feab5c23da70c25dbc62a605208a45e5 /cmd-list.c
parent29613f2f31117ed898455fdf75dd7b69d18129f3 (diff)
Add functions to allocate and free command contexts rather than doing it
all on the stack.
Diffstat (limited to 'cmd-list.c')
-rw-r--r--cmd-list.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/cmd-list.c b/cmd-list.c
index 2cf66a80..d1e72e93 100644
--- a/cmd-list.c
+++ b/cmd-list.c
@@ -97,7 +97,7 @@ cmd_list_exec(struct cmd_list *cmdlist, struct cmd_ctx *ctx)
TAILQ_FOREACH(cmd, &cmdlist->list, qentry) {
if (guards)
ctx->print(ctx, "%%begin");
- n = cmd_exec(cmd, ctx);
+ n = cmd->entry->exec(cmd, ctx);
if (guards)
ctx->print(ctx, "%%end");
@@ -146,7 +146,8 @@ cmd_list_free(struct cmd_list *cmdlist)
while (!TAILQ_EMPTY(&cmdlist->list)) {
cmd = TAILQ_FIRST(&cmdlist->list);
TAILQ_REMOVE(&cmdlist->list, cmd, qentry);
- cmd_free(cmd);
+ args_free(cmd->args);
+ free(cmd);
}
free(cmdlist);
}