aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r--src/nvim/option.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 308e2a28ee..6e82c45edf 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -1214,17 +1214,10 @@ do_set (
errmsg = e_invarg;
goto skip;
}
- }
- /* allow negative numbers (for 'undolevels') */
- else if (*arg == '-' || ascii_isdigit(*arg)) {
- i = 0;
- if (*arg == '-')
- i = 1;
- value = strtol((char *)arg, NULL, 0);
- if (arg[i] == '0' && TOLOWER_ASC(arg[i + 1]) == 'x')
- i += 2;
- while (ascii_isdigit(arg[i]))
- ++i;
+ } else if (*arg == '-' || ascii_isdigit(*arg)) {
+ // Allow negative (for 'undolevels'), octal and
+ // hex numbers.
+ vim_str2nr(arg, NULL, &i, true, true, &value, NULL);
if (arg[i] != NUL && !ascii_iswhite(arg[i])) {
errmsg = e_invarg;
goto skip;