summaryrefslogtreecommitdiffstats
path: root/cmd-set-option.c
diff options
context:
space:
mode:
authornicm <nicm>2019-03-18 11:58:40 +0000
committernicm <nicm>2019-03-18 11:58:40 +0000
commitce6be7afd4d10b542f9cce8634d6bdd81754f775 (patch)
tree01a13843f212816c057069a13d02b46743ed8fd0 /cmd-set-option.c
parentd2d43987d0f35af2bc012f1260fdb81c851fe390 (diff)
Make array options a sparse tree instead of an array of char * and
remove the size limit.
Diffstat (limited to 'cmd-set-option.c')
-rw-r--r--cmd-set-option.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/cmd-set-option.c b/cmd-set-option.c
index a55472ca..ddbfc334 100644
--- a/cmd-set-option.c
+++ b/cmd-set-option.c
@@ -163,11 +163,9 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item)
parent = options_get(oo, name);
/* Check that array options and indexes match up. */
- if (idx != -1) {
- if (*name == '@' || options_array_size(parent, NULL) == -1) {
- cmdq_error(item, "not an array: %s", argument);
- goto fail;
- }
+ if (idx != -1 && (*name == '@' || !options_isarray(parent))) {
+ cmdq_error(item, "not an array: %s", argument);
+ goto fail;
}
/* With -o, check this option is not already set. */
@@ -209,7 +207,7 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item)
goto fail;
}
options_set_string(oo, name, append, "%s", value);
- } else if (idx == -1 && options_array_size(parent, NULL) == -1) {
+ } else if (idx == -1 && !options_isarray(parent)) {
error = cmd_set_option_set(self, item, oo, parent, value);
if (error != 0)
goto fail;