mirror of
https://github.com/neovim/neovim.git
synced 2025-09-08 04:18:18 +00:00
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:
@@ -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_flp);
|
||||||
clear_string_option(&buf->b_p_isk);
|
clear_string_option(&buf->b_p_isk);
|
||||||
clear_string_option(&buf->b_p_vsts);
|
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;
|
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;
|
buf->b_p_vsts_array = NULL;
|
||||||
clear_string_option(&buf->b_p_vts);
|
clear_string_option(&buf->b_p_vts);
|
||||||
XFREE_CLEAR(buf->b_p_vts_array);
|
XFREE_CLEAR(buf->b_p_vts_array);
|
||||||
|
@@ -9002,7 +9002,7 @@ static void f_sign_jump(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
|
|
||||||
rettv->vval.v_number = -1;
|
rettv->vval.v_number = -1;
|
||||||
|
|
||||||
// Sign identifer
|
// Sign identifier
|
||||||
sign_id = (int)tv_get_number_chk(&argvars[0], ¬anum);
|
sign_id = (int)tv_get_number_chk(&argvars[0], ¬anum);
|
||||||
if (notanum) {
|
if (notanum) {
|
||||||
return;
|
return;
|
||||||
@@ -9050,7 +9050,7 @@ static void f_sign_place(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
|
|
||||||
rettv->vval.v_number = -1;
|
rettv->vval.v_number = -1;
|
||||||
|
|
||||||
// Sign identifer
|
// Sign identifier
|
||||||
sign_id = (int)tv_get_number_chk(&argvars[0], ¬anum);
|
sign_id = (int)tv_get_number_chk(&argvars[0], ¬anum);
|
||||||
if (notanum) {
|
if (notanum) {
|
||||||
return;
|
return;
|
||||||
|
@@ -165,8 +165,8 @@ enum {
|
|||||||
SHM_WRI = 'w', ///< "[w]" instead of "written".
|
SHM_WRI = 'w', ///< "[w]" instead of "written".
|
||||||
SHM_ABBREVIATIONS = 'a', ///< Use abbreviations from #SHM_ALL_ABBREVIATIONS.
|
SHM_ABBREVIATIONS = 'a', ///< Use abbreviations from #SHM_ALL_ABBREVIATIONS.
|
||||||
SHM_WRITE = 'W', ///< Don't use "written" at all.
|
SHM_WRITE = 'W', ///< Don't use "written" at all.
|
||||||
SHM_TRUNC = 't', ///< Trunctate file messages.
|
SHM_TRUNC = 't', ///< Truncate file messages.
|
||||||
SHM_TRUNCALL = 'T', ///< Trunctate all messages.
|
SHM_TRUNCALL = 'T', ///< Truncate all messages.
|
||||||
SHM_OVER = 'o', ///< Overwrite file messages.
|
SHM_OVER = 'o', ///< Overwrite file messages.
|
||||||
SHM_OVERALL = 'O', ///< Overwrite more messages.
|
SHM_OVERALL = 'O', ///< Overwrite more messages.
|
||||||
SHM_SEARCH = 's', ///< No search hit bottom messages.
|
SHM_SEARCH = 's', ///< No search hit bottom messages.
|
||||||
|
@@ -123,7 +123,7 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file,
|
|||||||
int shell_style = STYLE_ECHO;
|
int shell_style = STYLE_ECHO;
|
||||||
int check_spaces;
|
int check_spaces;
|
||||||
static bool did_find_nul = false;
|
static bool did_find_nul = false;
|
||||||
bool ampersent = false;
|
bool ampersand = false;
|
||||||
// vimglob() function to define for Posix shell
|
// vimglob() function to define for Posix shell
|
||||||
static char *sh_vimglob_func =
|
static char *sh_vimglob_func =
|
||||||
"vimglob() { while [ $# -ge 1 ]; do echo \"$1\"; shift; done }; vimglob >";
|
"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--;
|
p--;
|
||||||
}
|
}
|
||||||
if (*p == '&') { // remove trailing '&'
|
if (*p == '&') { // remove trailing '&'
|
||||||
ampersent = true;
|
ampersand = true;
|
||||||
*p = ' ';
|
*p = ' ';
|
||||||
}
|
}
|
||||||
STRCAT(command, ">");
|
STRCAT(command, ">");
|
||||||
@@ -309,7 +309,7 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file,
|
|||||||
shellopts |= kShellOptHideMess;
|
shellopts |= kShellOptHideMess;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ampersent) {
|
if (ampersand) {
|
||||||
STRCAT(command, "&"); // put the '&' after the redirection
|
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
|
// When running in the background, give it some time to create the temp
|
||||||
// file, but don't wait for it to finish.
|
// file, but don't wait for it to finish.
|
||||||
if (ampersent) {
|
if (ampersand) {
|
||||||
os_delay(10L, true);
|
os_delay(10L, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -398,7 +398,7 @@ void pum_redraw(void)
|
|||||||
char_u *p = NULL;
|
char_u *p = NULL;
|
||||||
int totwidth, width, w;
|
int totwidth, width, w;
|
||||||
int thumb_pos = 0;
|
int thumb_pos = 0;
|
||||||
int thumb_heigth = 1;
|
int thumb_height = 1;
|
||||||
int round;
|
int round;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
@@ -449,11 +449,11 @@ void pum_redraw(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pum_scrollbar) {
|
if (pum_scrollbar) {
|
||||||
thumb_heigth = pum_height * pum_height / pum_size;
|
thumb_height = pum_height * pum_height / pum_size;
|
||||||
if (thumb_heigth == 0) {
|
if (thumb_height == 0) {
|
||||||
thumb_heigth = 1;
|
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) / 2)
|
||||||
/ (pum_size - pum_height);
|
/ (pum_size - pum_height);
|
||||||
}
|
}
|
||||||
@@ -616,11 +616,11 @@ void pum_redraw(void)
|
|||||||
if (pum_scrollbar > 0) {
|
if (pum_scrollbar > 0) {
|
||||||
if (pum_rl) {
|
if (pum_rl) {
|
||||||
grid_putchar(&pum_grid, ' ', row, col_off - pum_width,
|
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);
|
? attr_thumb : attr_scroll);
|
||||||
} else {
|
} else {
|
||||||
grid_putchar(&pum_grid, ' ', row, col_off + pum_width,
|
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);
|
? attr_thumb : attr_scroll);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5895,7 +5895,7 @@ static void regdump(char_u *pattern, bt_regprog_T *r)
|
|||||||
fprintf(f, " count %" PRId64, (int64_t)OPERAND_MIN(s));
|
fprintf(f, " count %" PRId64, (int64_t)OPERAND_MIN(s));
|
||||||
s += 4;
|
s += 4;
|
||||||
} else if (op == RE_LNUM || op == RE_COL || op == RE_VCOL) {
|
} 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));
|
fprintf(f, " count %" PRId64, (int64_t)OPERAND_MIN(s));
|
||||||
s += 5;
|
s += 5;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user