diff options
author | dundargoc <gocdundar@gmail.com> | 2023-11-12 15:54:54 +0100 |
---|---|---|
committer | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2023-11-13 23:39:56 +0100 |
commit | 28f4f3c48498086307ed825d1761edb5789ca0e8 (patch) | |
tree | 880d2104092261fe0457b17a9ddda8a6e0f7f2ed /src/nvim/charset.c | |
parent | 48bcc7b9710d6db619b05254ea87f4087cdd9764 (diff) | |
download | rneovim-28f4f3c48498086307ed825d1761edb5789ca0e8.tar.gz rneovim-28f4f3c48498086307ed825d1761edb5789ca0e8.tar.bz2 rneovim-28f4f3c48498086307ed825d1761edb5789ca0e8.zip |
refactor: follow style guide
- reduce variable scope
- prefer initialization over declaration and assignment
- use bool to represent boolean values
Diffstat (limited to 'src/nvim/charset.c')
-rw-r--r-- | src/nvim/charset.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c index 2edf9a87cc..0adcc09ec7 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -88,10 +88,6 @@ int init_chartab(void) int buf_init_chartab(buf_T *buf, int global) { int c; - int c2; - int i; - bool tilde; - bool do_isalpha; if (global) { // Set the default size for printable characters: @@ -130,7 +126,7 @@ int buf_init_chartab(buf_T *buf, int global) // Walk through the 'isident', 'iskeyword', 'isfname' and 'isprint' // options Each option is a list of characters, character numbers or // ranges, separated by commas, e.g.: "200-210,x,#-178,-" - for (i = global ? 0 : 3; i <= 3; i++) { + for (int i = global ? 0 : 3; i <= 3; i++) { const char *p; if (i == 0) { // first round: 'isident' @@ -147,8 +143,8 @@ int buf_init_chartab(buf_T *buf, int global) } while (*p) { - tilde = false; - do_isalpha = false; + bool tilde = false; + bool do_isalpha = false; if ((*p == '^') && (p[1] != NUL)) { tilde = true; @@ -160,7 +156,7 @@ int buf_init_chartab(buf_T *buf, int global) } else { c = mb_ptr2char_adv(&p); } - c2 = -1; + int c2 = -1; if ((*p == '-') && (p[1] != NUL)) { p++; @@ -431,7 +427,6 @@ char *str_foldcase(char *str, int orglen, char *buf, int buflen) FUNC_ATTR_NONNULL_RET { garray_T ga; - int i; int len = orglen; #define GA_CHAR(i) ((char *)ga.ga_data)[i] @@ -461,7 +456,7 @@ char *str_foldcase(char *str, int orglen, char *buf, int buflen) } // Make each character lower case. - i = 0; + int i = 0; while (STR_CHAR(i) != NUL) { int c = utf_ptr2char(STR_PTR(i)); int olen = utf_ptr2len(STR_PTR(i)); |