summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/arguments.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2021-08-20 18:59:54 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2021-08-20 18:59:54 +0000
commitc8b4b5f08ad924172f819d4e05271006e6447746 (patch)
tree4ce088a611f538a498f30175003784ce200fa995 /usr.bin/tmux/arguments.c
parent7945ba1cb9346b88267a4022df6945ee52e11e44 (diff)
Expose args_value struct (will be needed soon) and add some missing frees.
Diffstat (limited to 'usr.bin/tmux/arguments.c')
-rw-r--r--usr.bin/tmux/arguments.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/usr.bin/tmux/arguments.c b/usr.bin/tmux/arguments.c
index 53649afe1ac..aac6acb9ce4 100644
--- a/usr.bin/tmux/arguments.c
+++ b/usr.bin/tmux/arguments.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arguments.c,v 1.36 2021/08/20 17:53:54 nicm Exp $ */
+/* $OpenBSD: arguments.c,v 1.37 2021/08/20 18:59:53 nicm Exp $ */
/*
* Copyright (c) 2010 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -29,10 +29,6 @@
* Manipulate command arguments.
*/
-struct args_value {
- char *value;
- TAILQ_ENTRY(args_value) entry;
-};
TAILQ_HEAD(args_values, args_value);
struct args_entry {
@@ -335,30 +331,21 @@ args_next(struct args_entry **entry)
}
/* Get first value in argument. */
-const char *
-args_first_value(struct args *args, u_char flag, struct args_value **value)
+struct args_value *
+args_first_value(struct args *args, u_char flag)
{
struct args_entry *entry;
if ((entry = args_find(args, flag)) == NULL)
return (NULL);
-
- *value = TAILQ_FIRST(&entry->values);
- if (*value == NULL)
- return (NULL);
- return ((*value)->value);
+ return (TAILQ_FIRST(&entry->values));
}
/* Get next value in argument. */
-const char *
-args_next_value(struct args_value **value)
+struct args_value *
+args_next_value(struct args_value *value)
{
- if (*value == NULL)
- return (NULL);
- *value = TAILQ_NEXT(*value, entry);
- if (*value == NULL)
- return (NULL);
- return ((*value)->value);
+ return (TAILQ_NEXT(value, entry));
}
/* Convert an argument value to a number. */