diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-03-28 13:54:28 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-03-29 18:29:25 -0400 |
commit | 375f957af65509bcf80c073362fae1d95bb32380 (patch) | |
tree | 9052916efcbf0efe9a3040b17091142ccff0aa6f /src | |
parent | 3dbcf69888b0f44c06b9ede3928fcd9d68f65739 (diff) | |
download | rneovim-375f957af65509bcf80c073362fae1d95bb32380.tar.gz rneovim-375f957af65509bcf80c073362fae1d95bb32380.tar.bz2 rneovim-375f957af65509bcf80c073362fae1d95bb32380.zip |
vim-patch:8.1.0989: various small code ugliness
Problem: Various small code ugliness.
Solution: Remove pointless NULL checks. Fix function calls. Fix typos.
(Dominique Pelle, closes vim/vim#4060)
https://github.com/vim/vim/commit/bdace838c67c1bd94e55e34270a8325933891466
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/buffer.c | 8 | ||||
-rw-r--r-- | src/nvim/eval/funcs.c | 4 | ||||
-rw-r--r-- | src/nvim/option_defs.h | 4 | ||||
-rw-r--r-- | src/nvim/os/shell.c | 8 | ||||
-rw-r--r-- | src/nvim/popupmnu.c | 14 | ||||
-rw-r--r-- | src/nvim/regexp.c | 2 |
6 files changed, 18 insertions, 22 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index cc9f130bfc..c7ec3a456c 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -1947,13 +1947,9 @@ void free_buf_options(buf_T *buf, int free_p_ff) clear_string_option(&buf->b_p_flp); clear_string_option(&buf->b_p_isk); clear_string_option(&buf->b_p_vsts); - if (buf->b_p_vsts_nopaste) { - xfree(buf->b_p_vsts_nopaste); - } + xfree(buf->b_p_vsts_nopaste); buf->b_p_vsts_nopaste = NULL; - if (buf->b_p_vsts_array) { - xfree(buf->b_p_vsts_array); - } + xfree(buf->b_p_vsts_array); buf->b_p_vsts_array = NULL; clear_string_option(&buf->b_p_vts); XFREE_CLEAR(buf->b_p_vts_array); diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 0f2e904b1b..deeda28571 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -9002,7 +9002,7 @@ static void f_sign_jump(typval_T *argvars, typval_T *rettv, FunPtr fptr) rettv->vval.v_number = -1; - // Sign identifer + // Sign identifier sign_id = (int)tv_get_number_chk(&argvars[0], ¬anum); if (notanum) { return; @@ -9050,7 +9050,7 @@ static void f_sign_place(typval_T *argvars, typval_T *rettv, FunPtr fptr) rettv->vval.v_number = -1; - // Sign identifer + // Sign identifier sign_id = (int)tv_get_number_chk(&argvars[0], ¬anum); if (notanum) { return; diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 47f0eec0b8..16749ba86b 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -165,8 +165,8 @@ enum { SHM_WRI = 'w', ///< "[w]" instead of "written". SHM_ABBREVIATIONS = 'a', ///< Use abbreviations from #SHM_ALL_ABBREVIATIONS. SHM_WRITE = 'W', ///< Don't use "written" at all. - SHM_TRUNC = 't', ///< Trunctate file messages. - SHM_TRUNCALL = 'T', ///< Trunctate all messages. + SHM_TRUNC = 't', ///< Truncate file messages. + SHM_TRUNCALL = 'T', ///< Truncate all messages. SHM_OVER = 'o', ///< Overwrite file messages. SHM_OVERALL = 'O', ///< Overwrite more messages. SHM_SEARCH = 's', ///< No search hit bottom messages. diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c index b5d890bf52..2974245857 100644 --- a/src/nvim/os/shell.c +++ b/src/nvim/os/shell.c @@ -123,7 +123,7 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file, int shell_style = STYLE_ECHO; int check_spaces; static bool did_find_nul = false; - bool ampersent = false; + bool ampersand = false; // vimglob() function to define for Posix shell static char *sh_vimglob_func = "vimglob() { while [ $# -ge 1 ]; do echo \"$1\"; shift; done }; vimglob >"; @@ -245,7 +245,7 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file, p--; } if (*p == '&') { // remove trailing '&' - ampersent = true; + ampersand = true; *p = ' '; } STRCAT(command, ">"); @@ -309,7 +309,7 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file, shellopts |= kShellOptHideMess; } - if (ampersent) { + if (ampersand) { STRCAT(command, "&"); // put the '&' after the redirection } @@ -331,7 +331,7 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file, // When running in the background, give it some time to create the temp // file, but don't wait for it to finish. - if (ampersent) { + if (ampersand) { os_delay(10L, true); } diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c index 68abf57413..32c9750628 100644 --- a/src/nvim/popupmnu.c +++ b/src/nvim/popupmnu.c @@ -398,7 +398,7 @@ void pum_redraw(void) char_u *p = NULL; int totwidth, width, w; int thumb_pos = 0; - int thumb_heigth = 1; + int thumb_height = 1; int round; int n; @@ -449,11 +449,11 @@ void pum_redraw(void) } if (pum_scrollbar) { - thumb_heigth = pum_height * pum_height / pum_size; - if (thumb_heigth == 0) { - thumb_heigth = 1; + thumb_height = pum_height * pum_height / pum_size; + if (thumb_height == 0) { + thumb_height = 1; } - thumb_pos = (pum_first * (pum_height - thumb_heigth) + thumb_pos = (pum_first * (pum_height - thumb_height) + (pum_size - pum_height) / 2) / (pum_size - pum_height); } @@ -616,11 +616,11 @@ void pum_redraw(void) if (pum_scrollbar > 0) { if (pum_rl) { grid_putchar(&pum_grid, ' ', row, col_off - pum_width, - i >= thumb_pos && i < thumb_pos + thumb_heigth + i >= thumb_pos && i < thumb_pos + thumb_height ? attr_thumb : attr_scroll); } else { grid_putchar(&pum_grid, ' ', row, col_off + pum_width, - i >= thumb_pos && i < thumb_pos + thumb_heigth + i >= thumb_pos && i < thumb_pos + thumb_height ? attr_thumb : attr_scroll); } } diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index a2589ac431..8556757ddb 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -5895,7 +5895,7 @@ static void regdump(char_u *pattern, bt_regprog_T *r) fprintf(f, " count %" PRId64, (int64_t)OPERAND_MIN(s)); s += 4; } else if (op == RE_LNUM || op == RE_COL || op == RE_VCOL) { - /* one int plus comperator */ + // one int plus comparator fprintf(f, " count %" PRId64, (int64_t)OPERAND_MIN(s)); s += 5; } |