summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2014-01-09 13:51:58 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2014-01-09 13:51:58 +0000
commit50c36851672bd22490420e9c36e043b67c809fb1 (patch)
treef88f6381621142898e72ad6b2d4de9058ec130e1 /usr.bin/tmux
parentc58966f67573caef6e464232ab84f277a9ab0a3a (diff)
Simplify args_set, from Tiago Cunha.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/arguments.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/usr.bin/tmux/arguments.c b/usr.bin/tmux/arguments.c
index 37c23dee824..46c012f3450 100644
--- a/usr.bin/tmux/arguments.c
+++ b/usr.bin/tmux/arguments.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arguments.c,v 1.6 2013/11/17 20:19:36 okan Exp $ */
+/* $OpenBSD: arguments.c,v 1.7 2014/01/09 13:51:57 nicm Exp $ */
/*
* Copyright (c) 2010 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -205,19 +205,15 @@ args_set(struct args *args, u_char ch, const char *value)
/* Replace existing argument. */
if ((entry = args_find(args, ch)) != NULL) {
free(entry->value);
- if (value != NULL)
- entry->value = xstrdup(value);
- else
- entry->value = NULL;
- return;
+ entry->value = NULL;
+ } else {
+ entry = xcalloc(1, sizeof *entry);
+ entry->flag = ch;
+ RB_INSERT(args_tree, &args->tree, entry);
}
- entry = xcalloc(1, sizeof *entry);
- entry->flag = ch;
if (value != NULL)
entry->value = xstrdup(value);
-
- RB_INSERT(args_tree, &args->tree, entry);
}
/* Get argument value. Will be NULL if it isn't present. */