Skip to content

Commit 333bd56

Browse files
committed
patch 8.2.2521: some compilers can't handle pointer initialization
Problem: Some compilers can't handle pointer initialization. (John Marriott) Solution: Use a local struct and assign it afterwards.
1 parent 04ea7e9 commit 333bd56

2 files changed

Lines changed: 23 additions & 17 deletions

File tree

src/screen.c

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4768,27 +4768,29 @@ set_chars_option(win_T *wp, char_u **varp)
47684768
{&fill_diff, "diff"},
47694769
{&fill_eob, "eob"},
47704770
};
4771+
static lcs_chars_T lcs_chars;
47714772
struct charstab lcstab[] =
47724773
{
4773-
{&wp->w_lcs_chars.eol, "eol"},
4774-
{&wp->w_lcs_chars.ext, "extends"},
4775-
{&wp->w_lcs_chars.nbsp, "nbsp"},
4776-
{&wp->w_lcs_chars.prec, "precedes"},
4777-
{&wp->w_lcs_chars.space,"space"},
4778-
{&wp->w_lcs_chars.tab2, "tab"},
4779-
{&wp->w_lcs_chars.trail,"trail"},
4780-
{&wp->w_lcs_chars.lead, "lead"},
4774+
{&lcs_chars.eol, "eol"},
4775+
{&lcs_chars.ext, "extends"},
4776+
{&lcs_chars.nbsp, "nbsp"},
4777+
{&lcs_chars.prec, "precedes"},
4778+
{&lcs_chars.space, "space"},
4779+
{&lcs_chars.tab2, "tab"},
4780+
{&lcs_chars.trail, "trail"},
4781+
{&lcs_chars.lead, "lead"},
47814782
#ifdef FEAT_CONCEAL
4782-
{&wp->w_lcs_chars.conceal, "conceal"},
4783+
{&lcs_chars.conceal, "conceal"},
47834784
#else
4784-
{NULL, "conceal"},
4785+
{NULL, "conceal"},
47854786
#endif
47864787
};
47874788
struct charstab *tab;
47884789

47894790
if (varp == &p_lcs || varp == &wp->w_p_lcs)
47904791
{
47914792
tab = lcstab;
4793+
CLEAR_FIELD(lcs_chars);
47924794
entries = sizeof(lcstab) / sizeof(struct charstab);
47934795
if (varp == &wp->w_p_lcs && wp->w_p_lcs[0] == NUL)
47944796
varp = &p_lcs;
@@ -4813,8 +4815,8 @@ set_chars_option(win_T *wp, char_u **varp)
48134815

48144816
if (varp == &p_lcs || varp == &wp->w_p_lcs)
48154817
{
4816-
wp->w_lcs_chars.tab1 = NUL;
4817-
wp->w_lcs_chars.tab3 = NUL;
4818+
lcs_chars.tab1 = NUL;
4819+
lcs_chars.tab3 = NUL;
48184820
}
48194821
else
48204822
{
@@ -4837,7 +4839,7 @@ set_chars_option(win_T *wp, char_u **varp)
48374839
c1 = mb_ptr2char_adv(&s);
48384840
if (mb_char2cells(c1) > 1)
48394841
continue;
4840-
if (tab[i].cp == &wp->w_lcs_chars.tab2)
4842+
if (tab[i].cp == &lcs_chars.tab2)
48414843
{
48424844
if (*s == NUL)
48434845
continue;
@@ -4856,11 +4858,11 @@ set_chars_option(win_T *wp, char_u **varp)
48564858
{
48574859
if (round)
48584860
{
4859-
if (tab[i].cp == &wp->w_lcs_chars.tab2)
4861+
if (tab[i].cp == &lcs_chars.tab2)
48604862
{
4861-
wp->w_lcs_chars.tab1 = c1;
4862-
wp->w_lcs_chars.tab2 = c2;
4863-
wp->w_lcs_chars.tab3 = c3;
4863+
lcs_chars.tab1 = c1;
4864+
lcs_chars.tab2 = c2;
4865+
lcs_chars.tab3 = c3;
48644866
}
48654867
else if (tab[i].cp != NULL)
48664868
*(tab[i].cp) = c1;
@@ -4878,6 +4880,8 @@ set_chars_option(win_T *wp, char_u **varp)
48784880
++p;
48794881
}
48804882
}
4883+
if (tab == lcstab)
4884+
wp->w_lcs_chars = lcs_chars;
48814885

48824886
return NULL; // no error
48834887
}

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2521,
753755
/**/
754756
2520,
755757
/**/

0 commit comments

Comments
 (0)