diff options
author | 2013-03-22 15:49:55 +0000 | |
---|---|---|
committer | 2013-03-22 15:49:55 +0000 | |
commit | de9a15de72aa0757cd1a1bfd8aaeafe306453bdc (patch) | |
tree | b3a7edbdb60e25f3fca5f750c86f1ef8165cf3b6 /usr.bin/tmux/cmd-list.c | |
parent | sync (diff) | |
download | wireguard-openbsd-de9a15de72aa0757cd1a1bfd8aaeafe306453bdc.tar.xz wireguard-openbsd-de9a15de72aa0757cd1a1bfd8aaeafe306453bdc.zip |
Add functions to allocate and free command contexts rather than doing it
all on the stack.
Diffstat (limited to 'usr.bin/tmux/cmd-list.c')
-rw-r--r-- | usr.bin/tmux/cmd-list.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd-list.c b/usr.bin/tmux/cmd-list.c index 4629702c29b..ba2b3916a8e 100644 --- a/usr.bin/tmux/cmd-list.c +++ b/usr.bin/tmux/cmd-list.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list.c,v 1.10 2012/07/13 06:27:41 nicm Exp $ */ +/* $OpenBSD: cmd-list.c,v 1.11 2013/03/22 15:49:55 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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); } |