summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2019-05-20 11:34:37 +0000
committernicm <nicm@openbsd.org>2019-05-20 11:34:37 +0000
commit3372128a0073a196e870a66d3cb9dc066c0d3a33 (patch)
tree157fd398d13cabbbcc6f17d85bf1d3b88db4ddef /usr.bin/tmux
parentrev 1.219 of the file was a fix to an LMTP issue that was misunderstood. we (diff)
downloadwireguard-openbsd-3372128a0073a196e870a66d3cb9dc066c0d3a33.tar.xz
wireguard-openbsd-3372128a0073a196e870a66d3cb9dc066c0d3a33.zip
Add a helper to allocate a cmd_list.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/cmd-list.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/usr.bin/tmux/cmd-list.c b/usr.bin/tmux/cmd-list.c
index 2571e8a5ff5..9f0b10a80ed 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.16 2016/01/19 15:59:12 nicm Exp $ */
+/* $OpenBSD: cmd-list.c,v 1.17 2019/05/20 11:34:37 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -23,6 +23,17 @@
#include "tmux.h"
+static struct cmd_list *
+cmd_list_new(void)
+{
+ struct cmd_list *cmdlist;
+
+ cmdlist = xcalloc(1, sizeof *cmdlist);
+ cmdlist->references = 1;
+ TAILQ_INIT(&cmdlist->list);
+ return (cmdlist);
+}
+
struct cmd_list *
cmd_list_parse(int argc, char **argv, const char *file, u_int line,
char **cause)
@@ -35,9 +46,7 @@ cmd_list_parse(int argc, char **argv, const char *file, u_int line,
copy_argv = cmd_copy_argv(argc, argv);
- cmdlist = xcalloc(1, sizeof *cmdlist);
- cmdlist->references = 1;
- TAILQ_INIT(&cmdlist->list);
+ cmdlist = cmd_list_new();
lastsplit = 0;
for (i = 0; i < argc; i++) {