vim-patch:8.2.5070: unnecessary code

Problem:    Unnecessary code.
Solution:   Remove code that isn't needed. (closes vim/vim#10534)
b5f0801b1f
This commit is contained in:
zeertzjq 2022-06-09 21:05:57 +08:00
parent d6247a575c
commit b8742afb6f
2 changed files with 6 additions and 16 deletions

View File

@ -1880,19 +1880,12 @@ void msg_prt_line(char_u *s, int list)
multispace_pos = 0; multispace_pos = 0;
} }
attr = HL_ATTR(HLF_0); attr = HL_ATTR(HLF_0);
} else if (lead != NULL && s <= lead && curwin->w_p_lcs_chars.lead) { } else if (lead != NULL && s <= lead && curwin->w_p_lcs_chars.lead != NUL) {
c = curwin->w_p_lcs_chars.lead; c = curwin->w_p_lcs_chars.lead;
attr = HL_ATTR(HLF_0); attr = HL_ATTR(HLF_0);
} else if (trail != NULL && s > trail) { } else if (trail != NULL && s > trail) {
c = curwin->w_p_lcs_chars.trail; c = curwin->w_p_lcs_chars.trail;
attr = HL_ATTR(HLF_0); attr = HL_ATTR(HLF_0);
} else if (list && lead != NULL && s <= lead && in_multispace
&& curwin->w_p_lcs_chars.leadmultispace != NULL) {
c = curwin->w_p_lcs_chars.leadmultispace[multispace_pos++];
if (curwin->w_p_lcs_chars.leadmultispace[multispace_pos] == NUL) {
multispace_pos = 0;
}
attr = HL_ATTR(HLF_0);
} else if (list && in_multispace } else if (list && in_multispace
&& curwin->w_p_lcs_chars.multispace != NULL) { && curwin->w_p_lcs_chars.multispace != NULL) {
c = curwin->w_p_lcs_chars.multispace[multispace_pos++]; c = curwin->w_p_lcs_chars.multispace[multispace_pos++];

View File

@ -3639,9 +3639,8 @@ static char *set_chars_option(win_T *wp, char_u **varp, bool set)
if (varp == &p_lcs || varp == &wp->w_p_lcs) { if (varp == &p_lcs || varp == &wp->w_p_lcs) {
wp->w_p_lcs_chars.tab1 = NUL; wp->w_p_lcs_chars.tab1 = NUL;
wp->w_p_lcs_chars.tab3 = NUL; wp->w_p_lcs_chars.tab3 = NUL;
if (wp->w_p_lcs_chars.multispace != NULL) {
xfree(wp->w_p_lcs_chars.multispace); xfree(wp->w_p_lcs_chars.multispace);
}
if (multispace_len > 0) { if (multispace_len > 0) {
wp->w_p_lcs_chars.multispace = xmalloc(((size_t)multispace_len + 1) * sizeof(int)); wp->w_p_lcs_chars.multispace = xmalloc(((size_t)multispace_len + 1) * sizeof(int));
wp->w_p_lcs_chars.multispace[multispace_len] = NUL; wp->w_p_lcs_chars.multispace[multispace_len] = NUL;
@ -3649,9 +3648,7 @@ static char *set_chars_option(win_T *wp, char_u **varp, bool set)
wp->w_p_lcs_chars.multispace = NULL; wp->w_p_lcs_chars.multispace = NULL;
} }
if (wp->w_p_lcs_chars.leadmultispace != NULL) { xfree(wp->w_p_lcs_chars.leadmultispace);
xfree(wp->w_p_lcs_chars.leadmultispace);
}
if (lead_multispace_len > 0) { if (lead_multispace_len > 0) {
wp->w_p_lcs_chars.leadmultispace wp->w_p_lcs_chars.leadmultispace
= xmalloc(((size_t)lead_multispace_len + 1) * sizeof(int)); = xmalloc(((size_t)lead_multispace_len + 1) * sizeof(int));
@ -3745,7 +3742,7 @@ static char *set_chars_option(win_T *wp, char_u **varp, bool set)
&& p[len2 + 1] != NUL) { && p[len2 + 1] != NUL) {
s = p + len2 + 1; s = p + len2 + 1;
if (round == 0) { if (round == 0) {
// Get length of lcsmultispace string in first round // get length of lcs-leadmultispace string in first round
last_lmultispace = p; last_lmultispace = p;
lead_multispace_len = 0; lead_multispace_len = 0;
while (*s != NUL && *s != ',') { while (*s != NUL && *s != ',') {
@ -3756,7 +3753,7 @@ static char *set_chars_option(win_T *wp, char_u **varp, bool set)
lead_multispace_len++; lead_multispace_len++;
} }
if (lead_multispace_len == 0) { if (lead_multispace_len == 0) {
// lcsmultispace cannot be an empty string // lcs-leadmultispace cannot be an empty string
return e_invarg; return e_invarg;
} }
p = s; p = s;