diff options
author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2023-02-12 18:48:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-12 18:48:49 +0100 |
commit | 5f72ab77bff1f1224be5cbbf9423bdddbc25635c (patch) | |
tree | 433c1cd4aca0b8d8b91a8b219327940957993bdb /src/nvim/getchar.c | |
parent | 2b1c07a1d435b541c295afad13227ebb10def57e (diff) | |
download | rneovim-5f72ab77bff1f1224be5cbbf9423bdddbc25635c.tar.gz rneovim-5f72ab77bff1f1224be5cbbf9423bdddbc25635c.tar.bz2 rneovim-5f72ab77bff1f1224be5cbbf9423bdddbc25635c.zip |
refactor: reduce scope of locals as per the style guide 3 (#22221)
refactor: reduce scope of locals as per the style guide
Diffstat (limited to 'src/nvim/getchar.c')
-rw-r--r-- | src/nvim/getchar.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index b54ecdb6ab..37840f8875 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -661,7 +661,6 @@ static int read_redo(bool init, bool old_redo) int c; int n; char_u buf[MB_MAXBYTES + 1]; - int i; if (init) { bp = old_redo ? old_redobuff.bh_first.b_next : redobuff.bh_first.b_next; @@ -682,7 +681,7 @@ static int read_redo(bool init, bool old_redo) } else { n = 1; } - for (i = 0;; i++) { + for (int i = 0;; i++) { if (c == K_SPECIAL) { // special key or escaped K_SPECIAL c = TO_SPECIAL(p[1], p[2]); p += 2; @@ -857,7 +856,6 @@ int ins_typebuf(char *str, int noremap, int offset, bool nottyped, bool silent) { char_u *s1, *s2; int addlen; - int i; int val; int nrm; @@ -947,7 +945,7 @@ int ins_typebuf(char *str, int noremap, int offset, bool nottyped, bool silent) } else { nrm = noremap; } - for (i = 0; i < addlen; i++) { + for (int i = 0; i < addlen; i++) { typebuf.tb_noremap[typebuf.tb_off + i + offset] = (uint8_t)((--nrm >= 0) ? val : RM_YES); } @@ -1426,7 +1424,6 @@ int vgetc(void) } else { int c2; int n; - int i; // number of characters recorded from the last vgetc() call static size_t last_vgetc_recorded_len = 0; @@ -1552,7 +1549,7 @@ int vgetc(void) if ((n = MB_BYTE2LEN_CHECK(c)) > 1) { no_mapping++; buf[0] = (char_u)c; - for (i = 1; i < n; i++) { + for (int i = 1; i < n; i++) { buf[i] = (char_u)vgetorpeek(true); if (buf[i] == K_SPECIAL) { // Must be a K_SPECIAL - KS_SPECIAL - KE_FILLER sequence, @@ -2904,13 +2901,12 @@ int fix_input_buffer(char *buf, int len) } // Reading from script, need to process special bytes - int i; char_u *p = (char_u *)buf; // Two characters are special: NUL and K_SPECIAL. // Replace NUL by K_SPECIAL KS_ZERO KE_FILLER // Replace K_SPECIAL by K_SPECIAL KS_SPECIAL KE_FILLER - for (i = len; --i >= 0; p++) { + for (int i = len; --i >= 0; p++) { if (p[0] == NUL || (p[0] == K_SPECIAL && (i < 2 || p[1] != KS_EXTRA))) { |