diff options
author | Lewis Russell <lewis6991@gmail.com> | 2023-07-13 10:22:18 +0100 |
---|---|---|
committer | Lewis Russell <lewis6991@gmail.com> | 2023-08-31 15:07:05 +0100 |
commit | 95c880ce310a6ab3e5b68d4b1d81d81da6786f00 (patch) | |
tree | 57dad767347045b1f2efce6496ac4e081c3f1e61 | |
parent | 354a1154423fc381dfcd7b045963e8076288e777 (diff) | |
download | rneovim-95c880ce310a6ab3e5b68d4b1d81d81da6786f00.tar.gz rneovim-95c880ce310a6ab3e5b68d4b1d81d81da6786f00.tar.bz2 rneovim-95c880ce310a6ab3e5b68d4b1d81d81da6786f00.zip |
refactor(option): change some int to bool
-rw-r--r-- | src/nvim/option.c | 6 | ||||
-rw-r--r-- | src/nvim/option_defs.h | 4 | ||||
-rw-r--r-- | src/nvim/optionstr.c | 5 |
3 files changed, 8 insertions, 7 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index e433dc5639..f108b4d8d9 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -1098,7 +1098,7 @@ static char *stropt_get_newval(int nextchar, int opt_idx, char **argp, void *var /// Part of do_set() for string options. static void do_set_option_string(int opt_idx, int opt_flags, char **argp, int nextchar, set_op_T op_arg, uint32_t flags, void *varp_arg, char *errbuf, - size_t errbuflen, int *value_checked, const char **errmsg) + size_t errbuflen, bool *value_checked, const char **errmsg) { char *arg = *argp; set_op_T op = op_arg; @@ -1337,7 +1337,7 @@ static void do_set_option_value(int opt_idx, int opt_flags, char **argp, int pre set_op_T op, uint32_t flags, void *varp, char *errbuf, size_t errbuflen, const char **errmsg) { - int value_checked = false; + bool value_checked = false; if (flags & P_BOOL) { // boolean do_set_bool(opt_idx, opt_flags, prefix, nextchar, varp, errmsg); } else if (flags & P_NUM) { // numeric @@ -3793,7 +3793,7 @@ const char *set_option_value(const char *const name, const OptVal value, int opt goto end; } - int value_checked = false; + bool value_checked = false; switch (v.type) { case kOptValTypeNil: diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 35687a19b7..313d282cef 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -1009,9 +1009,9 @@ typedef struct { // Option value was checked to be safe, no need to set P_INSECURE // Used for the 'keymap', 'filetype' and 'syntax' options. - int os_value_checked; + bool os_value_checked; // Option value changed. Used for the 'filetype' and 'syntax' options. - int os_value_changed; + bool os_value_changed; // Used by the 'isident', 'iskeyword', 'isprint' and 'isfname' options. // Set to true if the character table is modified when processing the diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c index d5ab47cc84..f82919d77a 100644 --- a/src/nvim/optionstr.c +++ b/src/nvim/optionstr.c @@ -428,7 +428,7 @@ void set_string_option_direct_in_buf(buf_T *buf, const char *name, int opt_idx, /// /// @return NULL on success, an untranslated error message on error. const char *set_string_option(const int opt_idx, const char *const value, const int opt_flags, - int *value_checked, char *const errbuf, const size_t errbuflen) + bool *value_checked, char *const errbuf, const size_t errbuflen) FUNC_ATTR_NONNULL_ARG(2) FUNC_ATTR_WARN_UNUSED_RESULT { vimoption_T *opt = get_option(opt_idx); @@ -2061,7 +2061,8 @@ static void do_spelllang_source(win_T *win) /// /// @return NULL for success, or an untranslated error message for an error const char *did_set_string_option(buf_T *buf, win_T *win, int opt_idx, char **varp, char *oldval, - char *errbuf, size_t errbuflen, int opt_flags, int *value_checked) + char *errbuf, size_t errbuflen, int opt_flags, + bool *value_checked) { const char *errmsg = NULL; int restore_chartab = false; |