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)
bdace838c6
This commit is contained in:
Jan Edmund Lazo
2021-03-28 13:54:28 -04:00
parent 3dbcf69888
commit 375f957af6
6 changed files with 18 additions and 22 deletions

View File

@@ -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);
}
buf->b_p_vsts_nopaste = NULL;
if (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);

View File

@@ -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], &notanum);
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], &notanum);
if (notanum) {
return;

View File

@@ -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.

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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;
}