aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/deprecated.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/api/deprecated.c')
-rw-r--r--src/nvim/api/deprecated.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c
index a7e5b32d49..83c33db5d3 100644
--- a/src/nvim/api/deprecated.c
+++ b/src/nvim/api/deprecated.c
@@ -709,14 +709,13 @@ static void set_option_to(uint64_t channel_id, void *to, int type, String name,
}
}
- long numval = 0;
- char *stringval = NULL;
+ OptVal optval = NIL_OPTVAL;
if (flags & SOPT_BOOL) {
VALIDATE(value.type == kObjectTypeBoolean, "Option '%s' value must be Boolean", name.data, {
return;
});
- numval = value.data.boolean;
+ optval = BOOLEAN_OPTVAL(value.data.boolean);
} else if (flags & SOPT_NUM) {
VALIDATE(value.type == kObjectTypeInteger, "Option '%s' value must be Integer", name.data, {
return;
@@ -725,12 +724,12 @@ static void set_option_to(uint64_t channel_id, void *to, int type, String name,
"Option '%s' value is out of range", name.data, {
return;
});
- numval = (int)value.data.integer;
+ optval = NUMBER_OPTVAL(value.data.integer);
} else {
VALIDATE(value.type == kObjectTypeString, "Option '%s' value must be String", name.data, {
return;
});
- stringval = value.data.string.data;
+ optval = STRING_OPTVAL(value.data.string);
}
// For global-win-local options -> setlocal
@@ -739,6 +738,6 @@ static void set_option_to(uint64_t channel_id, void *to, int type, String name,
(type == SREQ_GLOBAL) ? OPT_GLOBAL : OPT_LOCAL;
WITH_SCRIPT_CONTEXT(channel_id, {
- access_option_value_for(name.data, &numval, &stringval, opt_flags, type, to, false, err);
+ set_option_value_for(name.data, optval, opt_flags, type, to, err);
});
}