comparison src/screen.c @ 23958:41cf615ab57f v8.2.2521

patch 8.2.2521: some compilers can't handle pointer initialization Commit: https://github.com/vim/vim/commit/333bd56422d840961c6df51d4450c884f8500994 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 16 22:22:13 2021 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Tue, 16 Feb 2021 22:30:03 +0100
parents 44be09b25619
children 17697c4e5d48
comparison
equal deleted inserted replaced
23957:dcac28f688ab 23958:41cf615ab57f
4766 {&fill_vert, "vert"}, 4766 {&fill_vert, "vert"},
4767 {&fill_fold, "fold"}, 4767 {&fill_fold, "fold"},
4768 {&fill_diff, "diff"}, 4768 {&fill_diff, "diff"},
4769 {&fill_eob, "eob"}, 4769 {&fill_eob, "eob"},
4770 }; 4770 };
4771 static lcs_chars_T lcs_chars;
4771 struct charstab lcstab[] = 4772 struct charstab lcstab[] =
4772 { 4773 {
4773 {&wp->w_lcs_chars.eol, "eol"}, 4774 {&lcs_chars.eol, "eol"},
4774 {&wp->w_lcs_chars.ext, "extends"}, 4775 {&lcs_chars.ext, "extends"},
4775 {&wp->w_lcs_chars.nbsp, "nbsp"}, 4776 {&lcs_chars.nbsp, "nbsp"},
4776 {&wp->w_lcs_chars.prec, "precedes"}, 4777 {&lcs_chars.prec, "precedes"},
4777 {&wp->w_lcs_chars.space,"space"}, 4778 {&lcs_chars.space, "space"},
4778 {&wp->w_lcs_chars.tab2, "tab"}, 4779 {&lcs_chars.tab2, "tab"},
4779 {&wp->w_lcs_chars.trail,"trail"}, 4780 {&lcs_chars.trail, "trail"},
4780 {&wp->w_lcs_chars.lead, "lead"}, 4781 {&lcs_chars.lead, "lead"},
4781 #ifdef FEAT_CONCEAL 4782 #ifdef FEAT_CONCEAL
4782 {&wp->w_lcs_chars.conceal, "conceal"}, 4783 {&lcs_chars.conceal, "conceal"},
4783 #else 4784 #else
4784 {NULL, "conceal"}, 4785 {NULL, "conceal"},
4785 #endif 4786 #endif
4786 }; 4787 };
4787 struct charstab *tab; 4788 struct charstab *tab;
4788 4789
4789 if (varp == &p_lcs || varp == &wp->w_p_lcs) 4790 if (varp == &p_lcs || varp == &wp->w_p_lcs)
4790 { 4791 {
4791 tab = lcstab; 4792 tab = lcstab;
4793 CLEAR_FIELD(lcs_chars);
4792 entries = sizeof(lcstab) / sizeof(struct charstab); 4794 entries = sizeof(lcstab) / sizeof(struct charstab);
4793 if (varp == &wp->w_p_lcs && wp->w_p_lcs[0] == NUL) 4795 if (varp == &wp->w_p_lcs && wp->w_p_lcs[0] == NUL)
4794 varp = &p_lcs; 4796 varp = &p_lcs;
4795 } 4797 }
4796 else 4798 else
4811 *(tab[i].cp) = 4813 *(tab[i].cp) =
4812 ((varp == &p_lcs || varp == &wp->w_p_lcs) ? NUL : ' '); 4814 ((varp == &p_lcs || varp == &wp->w_p_lcs) ? NUL : ' ');
4813 4815
4814 if (varp == &p_lcs || varp == &wp->w_p_lcs) 4816 if (varp == &p_lcs || varp == &wp->w_p_lcs)
4815 { 4817 {
4816 wp->w_lcs_chars.tab1 = NUL; 4818 lcs_chars.tab1 = NUL;
4817 wp->w_lcs_chars.tab3 = NUL; 4819 lcs_chars.tab3 = NUL;
4818 } 4820 }
4819 else 4821 else
4820 { 4822 {
4821 fill_diff = '-'; 4823 fill_diff = '-';
4822 fill_eob = '~'; 4824 fill_eob = '~';
4835 c2 = c3 = 0; 4837 c2 = c3 = 0;
4836 s = p + len + 1; 4838 s = p + len + 1;
4837 c1 = mb_ptr2char_adv(&s); 4839 c1 = mb_ptr2char_adv(&s);
4838 if (mb_char2cells(c1) > 1) 4840 if (mb_char2cells(c1) > 1)
4839 continue; 4841 continue;
4840 if (tab[i].cp == &wp->w_lcs_chars.tab2) 4842 if (tab[i].cp == &lcs_chars.tab2)
4841 { 4843 {
4842 if (*s == NUL) 4844 if (*s == NUL)
4843 continue; 4845 continue;
4844 c2 = mb_ptr2char_adv(&s); 4846 c2 = mb_ptr2char_adv(&s);
4845 if (mb_char2cells(c2) > 1) 4847 if (mb_char2cells(c2) > 1)
4854 4856
4855 if (*s == ',' || *s == NUL) 4857 if (*s == ',' || *s == NUL)
4856 { 4858 {
4857 if (round) 4859 if (round)
4858 { 4860 {
4859 if (tab[i].cp == &wp->w_lcs_chars.tab2) 4861 if (tab[i].cp == &lcs_chars.tab2)
4860 { 4862 {
4861 wp->w_lcs_chars.tab1 = c1; 4863 lcs_chars.tab1 = c1;
4862 wp->w_lcs_chars.tab2 = c2; 4864 lcs_chars.tab2 = c2;
4863 wp->w_lcs_chars.tab3 = c3; 4865 lcs_chars.tab3 = c3;
4864 } 4866 }
4865 else if (tab[i].cp != NULL) 4867 else if (tab[i].cp != NULL)
4866 *(tab[i].cp) = c1; 4868 *(tab[i].cp) = c1;
4867 4869
4868 } 4870 }
4876 return e_invarg; 4878 return e_invarg;
4877 if (*p == ',') 4879 if (*p == ',')
4878 ++p; 4880 ++p;
4879 } 4881 }
4880 } 4882 }
4883 if (tab == lcstab)
4884 wp->w_lcs_chars = lcs_chars;
4881 4885
4882 return NULL; // no error 4886 return NULL; // no error
4883 } 4887 }
4884 4888