aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2023-01-25 15:41:55 +0000
committerLewis Russell <lewis6991@gmail.com>2023-01-26 10:02:00 +0000
commit334f5382677b3bcf91e74bb8502d38c7d2bd4281 (patch)
tree696ce999ffa7f7f8e8bc77b820c7def3cbb2e447
parentef85238fde4560ae931dc98ac052a2b5564327fd (diff)
downloadrneovim-334f5382677b3bcf91e74bb8502d38c7d2bd4281.tar.gz
rneovim-334f5382677b3bcf91e74bb8502d38c7d2bd4281.tar.bz2
rneovim-334f5382677b3bcf91e74bb8502d38c7d2bd4281.zip
refactor(option.c): change nextchar to uint8_t
-rw-r--r--src/nvim/option.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index ecec421e90..ac889f2451 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -1242,7 +1242,7 @@ static void do_set_option(int opt_flags, char **argp, bool *did_show, char *errb
len++;
}
}
- char_u nextchar = (uint8_t)arg[len]; // next non-white char after option name
+ uint8_t nextchar = (uint8_t)arg[len]; // next non-white char after option name
if (opt_idx == -1 && key == 0) { // found a mismatch: skip
*errmsg = e_unknown_option;
@@ -1256,7 +1256,7 @@ static void do_set_option(int opt_flags, char **argp, bool *did_show, char *errb
if (options[opt_idx].var == NULL) { // hidden option: skip
// Only give an error message when requesting the value of
// a hidden option, ignore setting it.
- if (vim_strchr("=:!&<", (uint8_t)nextchar) == NULL
+ if (vim_strchr("=:!&<", nextchar) == NULL
&& (!(options[opt_idx].flags & P_BOOL)
|| nextchar == '?')) {
*errmsg = e_unsupportedoption;
@@ -1310,7 +1310,7 @@ static void do_set_option(int opt_flags, char **argp, bool *did_show, char *errb
return;
}
- if (vim_strchr("?=:!&<", (uint8_t)nextchar) != NULL) {
+ if (vim_strchr("?=:!&<", nextchar) != NULL) {
*argp += len;
if (nextchar == '&' && (*argp)[1] == 'v' && (*argp)[2] == 'i') {
if ((*argp)[3] == 'm') { // "opt&vim": set to Vim default
@@ -1319,7 +1319,7 @@ static void do_set_option(int opt_flags, char **argp, bool *did_show, char *errb
*argp += 2;
}
}
- if (vim_strchr("?!&<", (uint8_t)nextchar) != NULL
+ if (vim_strchr("?!&<", nextchar) != NULL
&& (*argp)[1] != NUL && !ascii_iswhite((*argp)[1])) {
*errmsg = e_trailing;
return;
@@ -1332,7 +1332,7 @@ static void do_set_option(int opt_flags, char **argp, bool *did_show, char *errb
//
if (nextchar == '?'
|| (prefix == 1
- && vim_strchr("=:&<", (uint8_t)nextchar) == NULL
+ && vim_strchr("=:&<", nextchar) == NULL
&& !(flags & P_BOOL))) {
// print value
if (*did_show) {
@@ -1365,8 +1365,7 @@ static void do_set_option(int opt_flags, char **argp, bool *did_show, char *errb
if (flags & P_BOOL) { // boolean
do_set_bool(opt_idx, opt_flags, prefix, nextchar, afterchar, varp, errmsg);
} else { // Numeric or string.
- if (vim_strchr("=:&<", (uint8_t)nextchar) == NULL
- || prefix != 1) {
+ if (vim_strchr("=:&<", nextchar) == NULL || prefix != 1) {
*errmsg = e_invarg;
return;
}