vim-patch:8.1.0114: confusing variable name

Problem:    Confusing variable name.
Solution:   Rename new_ts to new_vts_array.  Change zero to NULL.
0119a59ffd
This commit is contained in:
VVKot
2021-02-13 19:51:49 +00:00
parent 6752ac4968
commit 3e55811acf
2 changed files with 18 additions and 19 deletions

View File

@@ -718,7 +718,7 @@ void ex_retab(exarg_T *eap)
char_u *ptr;
char_u *new_line = (char_u *)1; // init to non-NULL
int did_undo; // called u_save for current line
long *new_ts = 0;
long *new_vts_array = NULL;
char_u *new_ts_str; // string value of tab argument
int save_list;
@@ -729,17 +729,18 @@ void ex_retab(exarg_T *eap)
curwin->w_p_list = 0; /* don't want list mode here */
new_ts_str = eap->arg;
if (!tabstop_set(eap->arg, &new_ts)) {
if (!tabstop_set(eap->arg, &new_vts_array)) {
return;
}
while (ascii_isdigit(*(eap->arg)) || *(eap->arg) == ',') {
(eap->arg)++;
}
// This ensures that either new_ts and new_ts_str are freshly allocated,
// or new_ts points to an existing array and new_ts_str is null.
if (new_ts == 0) {
new_ts = curbuf->b_p_vts_array;
// This ensures that either new_vts_array and new_ts_str are freshly
// allocated, or new_vts_array points to an existing array and new_ts_str
// is null.
if (new_vts_array == NULL) {
new_vts_array = curbuf->b_p_vts_array;
new_ts_str = NULL;
} else {
new_ts_str = vim_strnsave(new_ts_str, eap->arg - new_ts_str);
@@ -771,9 +772,7 @@ void ex_retab(exarg_T *eap)
int t, s;
tabstop_fromto(start_vcol, vcol,
tabstop_count(new_ts) ? 0 : curbuf->b_p_ts,
new_ts,
&t, &s);
curbuf->b_p_ts, new_vts_array, &t, &s);
num_tabs = t;
num_spaces = s;
}
@@ -831,11 +830,11 @@ void ex_retab(exarg_T *eap)
// If a single value was given then it can be considered equal to
// either the value of 'tabstop' or the value of 'vartabstop'.
if (tabstop_count(curbuf->b_p_vts_array) == 0
&& tabstop_count(new_ts) == 1
&& curbuf->b_p_ts == tabstop_first(new_ts)) {
&& tabstop_count(new_vts_array) == 1
&& curbuf->b_p_ts == tabstop_first(new_vts_array)) {
// not changed
} else if (tabstop_count(curbuf->b_p_vts_array) > 0
&& tabstop_eq(curbuf->b_p_vts_array, new_ts)) {
&& tabstop_eq(curbuf->b_p_vts_array, new_vts_array)) {
// not changed
} else {
redraw_curbuf_later(NOT_VALID);
@@ -851,17 +850,17 @@ void ex_retab(exarg_T *eap)
// than one tabstop then update 'vartabstop'.
long *old_vts_ary = curbuf->b_p_vts_array;
if (tabstop_count(old_vts_ary) > 0 || tabstop_count(new_ts) > 1) {
if (tabstop_count(old_vts_ary) > 0 || tabstop_count(new_vts_array) > 1) {
set_string_option_direct("vts", -1, new_ts_str,
OPT_FREE | OPT_LOCAL, 0);
xfree(new_ts_str);
curbuf->b_p_vts_array = new_ts;
curbuf->b_p_vts_array = new_vts_array;
xfree(old_vts_ary);
} else {
// 'vartabstop' wasn't in use and a single value was given to
// retab then update 'tabstop'.
curbuf->b_p_ts = tabstop_first(new_ts);
xfree(new_ts);
curbuf->b_p_ts = tabstop_first(new_vts_array);
xfree(new_vts_array);
}
}
coladvance(curwin->w_curswant);