diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2013-02-18 23:20:21 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2013-02-18 23:20:21 +0000 |
commit | 293e331d69def60110bdc49b6453af905e0509b3 (patch) | |
tree | 3dbb4230607dc6bb0a40d3a1e9b71d0f56774c7a /cmd-command-prompt.c | |
parent | 2a91025581ddaa934ffa471f5b27a33d19e4ea2d (diff) | |
download | rtmux-293e331d69def60110bdc49b6453af905e0509b3.tar.gz rtmux-293e331d69def60110bdc49b6453af905e0509b3.tar.bz2 rtmux-293e331d69def60110bdc49b6453af905e0509b3.zip |
Add functions to allocate and free command contexts rather than doing it all on
the stack.
Diffstat (limited to 'cmd-command-prompt.c')
-rw-r--r-- | cmd-command-prompt.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/cmd-command-prompt.c b/cmd-command-prompt.c index ea380353..2a0e1aa7 100644 --- a/cmd-command-prompt.c +++ b/cmd-command-prompt.c @@ -150,7 +150,7 @@ cmd_command_prompt_callback(void *data, const char *s) struct cmd_command_prompt_cdata *cdata = data; struct client *c = cdata->c; struct cmd_list *cmdlist; - struct cmd_ctx ctx; + struct cmd_ctx *ctx; char *cause, *new_template, *prompt, *ptr; char *input = NULL; @@ -184,17 +184,18 @@ cmd_command_prompt_callback(void *data, const char *s) return (0); } - ctx.msgdata = NULL; - ctx.curclient = c; + ctx = cmd_get_ctx(); + ctx->msgdata = NULL; + ctx->curclient = c; + ctx->cmdclient = NULL; - ctx.error = key_bindings_error; - ctx.print = key_bindings_print; - ctx.info = key_bindings_info; + ctx->error = key_bindings_error; + ctx->print = key_bindings_print; + ctx->info = key_bindings_info; - ctx.cmdclient = NULL; - - cmd_list_exec(cmdlist, &ctx); + cmd_list_exec(cmdlist, ctx); cmd_list_free(cmdlist); + cmd_free_ctx(ctx); if (c->prompt_callbackfn != (void *) &cmd_command_prompt_callback) return (1); |