Skip to content

Commit

Permalink
Merge branch 'obsd-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasAdam committed Jul 22, 2024
2 parents 3c2621b + ddd4e57 commit 109d2bd
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions options.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,10 +578,28 @@ char *
options_to_string(struct options_entry *o, int idx, int numeric)
{
struct options_array_item *a;
char *result = NULL;
char *last = NULL;
char *next;

if (OPTIONS_IS_ARRAY(o)) {
if (idx == -1)
return (xstrdup(""));
if (idx == -1) {
RB_FOREACH(a, options_array, &o->value.array) {
next = options_value_to_string(o, &a->value,
numeric);
if (last == NULL)
result = next;
else {
xasprintf(&result, "%s %s", last, next);
free(last);
free(next);
}
last = result;
}
if (result == NULL)
return (xstrdup(""));
return (result);
}
a = options_array_item(o, idx);
if (a == NULL)
return (xstrdup(""));
Expand Down

0 comments on commit 109d2bd

Please sign in to comment.