comparison src/highlight.c @ 17494:c8df7f8ccdf8 v8.1.1745

patch 8.1.1745: compiler warning for unused argument commit https://github.com/vim/vim/commit/1f164b19685d8ad709b11f3f1933685469251e30 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jul 24 19:00:36 2019 +0200 patch 8.1.1745: compiler warning for unused argument Problem: Compiler warning for unused argument. Solution: Add UNUSED. Change comments to new style.
author Bram Moolenaar <Bram@vim.org>
date Wed, 24 Jul 2019 19:15:04 +0200
parents 367ef00c6258
children 04245f071792
comparison
equal deleted inserted replaced
17493:7f993d962a1d 17494:c8df7f8ccdf8
155 "default link QuickFixLine Search", 155 "default link QuickFixLine Search",
156 CENT("Normal cterm=NONE", "Normal gui=NONE"), 156 CENT("Normal cterm=NONE", "Normal gui=NONE"),
157 NULL 157 NULL
158 }; 158 };
159 159
160 /* Default colors only used with a light background. */ 160 // Default colors only used with a light background.
161 static char *(highlight_init_light[]) = { 161 static char *(highlight_init_light[]) = {
162 CENT("Directory term=bold ctermfg=DarkBlue", 162 CENT("Directory term=bold ctermfg=DarkBlue",
163 "Directory term=bold ctermfg=DarkBlue guifg=Blue"), 163 "Directory term=bold ctermfg=DarkBlue guifg=Blue"),
164 CENT("LineNr term=underline ctermfg=Brown", 164 CENT("LineNr term=underline ctermfg=Brown",
165 "LineNr term=underline ctermfg=Brown guifg=Brown"), 165 "LineNr term=underline ctermfg=Brown guifg=Brown"),
248 "ToolbarButton cterm=bold ctermfg=White ctermbg=DarkGrey gui=bold guifg=White guibg=Grey40"), 248 "ToolbarButton cterm=bold ctermfg=White ctermbg=DarkGrey gui=bold guifg=White guibg=Grey40"),
249 #endif 249 #endif
250 NULL 250 NULL
251 }; 251 };
252 252
253 /* Default colors only used with a dark background. */ 253 // Default colors only used with a dark background.
254 static char *(highlight_init_dark[]) = { 254 static char *(highlight_init_dark[]) = {
255 CENT("Directory term=bold ctermfg=LightCyan", 255 CENT("Directory term=bold ctermfg=LightCyan",
256 "Directory term=bold ctermfg=LightCyan guifg=Cyan"), 256 "Directory term=bold ctermfg=LightCyan guifg=Cyan"),
257 CENT("LineNr term=underline ctermfg=Yellow", 257 CENT("LineNr term=underline ctermfg=Yellow",
258 "LineNr term=underline ctermfg=Yellow guifg=Yellow"), 258 "LineNr term=underline ctermfg=Yellow guifg=Yellow"),
3673 char_u *grp, 3673 char_u *grp,
3674 char_u *pat, 3674 char_u *pat,
3675 int prio, 3675 int prio,
3676 int id, 3676 int id,
3677 list_T *pos_list, 3677 list_T *pos_list,
3678 char_u *conceal_char UNUSED) /* pointer to conceal replacement char */ 3678 char_u *conceal_char UNUSED) // pointer to conceal replacement char
3679 { 3679 {
3680 matchitem_T *cur; 3680 matchitem_T *cur;
3681 matchitem_T *prev; 3681 matchitem_T *prev;
3682 matchitem_T *m; 3682 matchitem_T *m;
3683 int hlg_id; 3683 int hlg_id;
3713 { 3713 {
3714 semsg(_(e_invarg2), pat); 3714 semsg(_(e_invarg2), pat);
3715 return -1; 3715 return -1;
3716 } 3716 }
3717 3717
3718 /* Find available match ID. */ 3718 // Find available match ID.
3719 while (id == -1) 3719 while (id == -1)
3720 { 3720 {
3721 cur = wp->w_match_head; 3721 cur = wp->w_match_head;
3722 while (cur != NULL && cur->id != wp->w_next_match_id) 3722 while (cur != NULL && cur->id != wp->w_next_match_id)
3723 cur = cur->next; 3723 cur = cur->next;
3724 if (cur == NULL) 3724 if (cur == NULL)
3725 id = wp->w_next_match_id; 3725 id = wp->w_next_match_id;
3726 wp->w_next_match_id++; 3726 wp->w_next_match_id++;
3727 } 3727 }
3728 3728
3729 /* Build new match. */ 3729 // Build new match.
3730 m = ALLOC_CLEAR_ONE(matchitem_T); 3730 m = ALLOC_CLEAR_ONE(matchitem_T);
3731 m->id = id; 3731 m->id = id;
3732 m->priority = prio; 3732 m->priority = prio;
3733 m->pattern = pat == NULL ? NULL : vim_strsave(pat); 3733 m->pattern = pat == NULL ? NULL : vim_strsave(pat);
3734 m->hlg_id = hlg_id; 3734 m->hlg_id = hlg_id;
3739 m->conceal_char = 0; 3739 m->conceal_char = 0;
3740 if (conceal_char != NULL) 3740 if (conceal_char != NULL)
3741 m->conceal_char = (*mb_ptr2char)(conceal_char); 3741 m->conceal_char = (*mb_ptr2char)(conceal_char);
3742 # endif 3742 # endif
3743 3743
3744 /* Set up position matches */ 3744 // Set up position matches
3745 if (pos_list != NULL) 3745 if (pos_list != NULL)
3746 { 3746 {
3747 linenr_T toplnum = 0; 3747 linenr_T toplnum = 0;
3748 linenr_T botlnum = 0; 3748 linenr_T botlnum = 0;
3749 listitem_T *li; 3749 listitem_T *li;
3813 toplnum = lnum; 3813 toplnum = lnum;
3814 if (botlnum == 0 || lnum >= botlnum) 3814 if (botlnum == 0 || lnum >= botlnum)
3815 botlnum = lnum + 1; 3815 botlnum = lnum + 1;
3816 } 3816 }
3817 3817
3818 /* Calculate top and bottom lines for redrawing area */ 3818 // Calculate top and bottom lines for redrawing area
3819 if (toplnum != 0) 3819 if (toplnum != 0)
3820 { 3820 {
3821 if (wp->w_buffer->b_mod_set) 3821 if (wp->w_buffer->b_mod_set)
3822 { 3822 {
3823 if (wp->w_buffer->b_mod_top > toplnum) 3823 if (wp->w_buffer->b_mod_top > toplnum)
3836 m->pos.botlnum = botlnum; 3836 m->pos.botlnum = botlnum;
3837 rtype = VALID; 3837 rtype = VALID;
3838 } 3838 }
3839 } 3839 }
3840 3840
3841 /* Insert new match. The match list is in ascending order with regard to 3841 // Insert new match. The match list is in ascending order with regard to
3842 * the match priorities. */ 3842 // the match priorities.
3843 cur = wp->w_match_head; 3843 cur = wp->w_match_head;
3844 prev = cur; 3844 prev = cur;
3845 while (cur != NULL && prio >= cur->priority) 3845 while (cur != NULL && prio >= cur->priority)
3846 { 3846 {
3847 prev = cur; 3847 prev = cur;
3958 void 3958 void
3959 init_search_hl(win_T *wp, match_T *search_hl) 3959 init_search_hl(win_T *wp, match_T *search_hl)
3960 { 3960 {
3961 matchitem_T *cur; 3961 matchitem_T *cur;
3962 3962
3963 /* Setup for match and 'hlsearch' highlighting. Disable any previous 3963 // Setup for match and 'hlsearch' highlighting. Disable any previous
3964 * match */ 3964 // match
3965 cur = wp->w_match_head; 3965 cur = wp->w_match_head;
3966 while (cur != NULL) 3966 while (cur != NULL)
3967 { 3967 {
3968 cur->hl.rm = cur->match; 3968 cur->hl.rm = cur->match;
3969 if (cur->hlg_id == 0) 3969 if (cur->hlg_id == 0)
3972 cur->hl.attr = syn_id2attr(cur->hlg_id); 3972 cur->hl.attr = syn_id2attr(cur->hlg_id);
3973 cur->hl.buf = wp->w_buffer; 3973 cur->hl.buf = wp->w_buffer;
3974 cur->hl.lnum = 0; 3974 cur->hl.lnum = 0;
3975 cur->hl.first_lnum = 0; 3975 cur->hl.first_lnum = 0;
3976 # ifdef FEAT_RELTIME 3976 # ifdef FEAT_RELTIME
3977 /* Set the time limit to 'redrawtime'. */ 3977 // Set the time limit to 'redrawtime'.
3978 profile_setlimit(p_rdt, &(cur->hl.tm)); 3978 profile_setlimit(p_rdt, &(cur->hl.tm));
3979 # endif 3979 # endif
3980 cur = cur->next; 3980 cur = cur->next;
3981 } 3981 }
3982 search_hl->buf = wp->w_buffer; 3982 search_hl->buf = wp->w_buffer;
3983 search_hl->lnum = 0; 3983 search_hl->lnum = 0;
3984 search_hl->first_lnum = 0; 3984 search_hl->first_lnum = 0;
3985 /* time limit is set at the toplevel, for all windows */ 3985 // time limit is set at the toplevel, for all windows
3986 } 3986 }
3987 3987
3988 /* 3988 /*
3989 * If there is a match fill "shl" and return one. 3989 * If there is a match fill "shl" and return one.
3990 * Return zero otherwise. 3990 * Return zero otherwise.
3991 */ 3991 */
3992 static int 3992 static int
3993 next_search_hl_pos( 3993 next_search_hl_pos(
3994 match_T *shl, /* points to a match */ 3994 match_T *shl, // points to a match
3995 linenr_T lnum, 3995 linenr_T lnum,
3996 posmatch_T *posmatch, /* match positions */ 3996 posmatch_T *posmatch, // match positions
3997 colnr_T mincol) /* minimal column for a match */ 3997 colnr_T mincol) // minimal column for a match
3998 { 3998 {
3999 int i; 3999 int i;
4000 int found = -1; 4000 int found = -1;
4001 4001
4002 for (i = posmatch->cur; i < MAXPOSMATCH; i++) 4002 for (i = posmatch->cur; i < MAXPOSMATCH; i++)
4009 continue; 4009 continue;
4010 if (pos->lnum == lnum) 4010 if (pos->lnum == lnum)
4011 { 4011 {
4012 if (found >= 0) 4012 if (found >= 0)
4013 { 4013 {
4014 /* if this match comes before the one at "found" then swap 4014 // if this match comes before the one at "found" then swap
4015 * them */ 4015 // them
4016 if (pos->col < posmatch->pos[found].col) 4016 if (pos->col < posmatch->pos[found].col)
4017 { 4017 {
4018 llpos_T tmp = *pos; 4018 llpos_T tmp = *pos;
4019 4019
4020 *pos = posmatch->pos[found]; 4020 *pos = posmatch->pos[found];
4074 return; 4074 return;
4075 } 4075 }
4076 4076
4077 if (shl->lnum != 0) 4077 if (shl->lnum != 0)
4078 { 4078 {
4079 /* Check for three situations: 4079 // Check for three situations:
4080 * 1. If the "lnum" is below a previous match, start a new search. 4080 // 1. If the "lnum" is below a previous match, start a new search.
4081 * 2. If the previous match includes "mincol", use it. 4081 // 2. If the previous match includes "mincol", use it.
4082 * 3. Continue after the previous match. 4082 // 3. Continue after the previous match.
4083 */
4084 l = shl->lnum + shl->rm.endpos[0].lnum - shl->rm.startpos[0].lnum; 4083 l = shl->lnum + shl->rm.endpos[0].lnum - shl->rm.startpos[0].lnum;
4085 if (lnum > l) 4084 if (lnum > l)
4086 shl->lnum = 0; 4085 shl->lnum = 0;
4087 else if (lnum < l || shl->rm.endpos[0].col > mincol) 4086 else if (lnum < l || shl->rm.endpos[0].col > mincol)
4088 return; 4087 return;
4094 */ 4093 */
4095 called_emsg = FALSE; 4094 called_emsg = FALSE;
4096 for (;;) 4095 for (;;)
4097 { 4096 {
4098 # ifdef FEAT_RELTIME 4097 # ifdef FEAT_RELTIME
4099 /* Stop searching after passing the time limit. */ 4098 // Stop searching after passing the time limit.
4100 if (profile_passed_limit(&(shl->tm))) 4099 if (profile_passed_limit(&(shl->tm)))
4101 { 4100 {
4102 shl->lnum = 0; /* no match found in time */ 4101 shl->lnum = 0; // no match found in time
4103 break; 4102 break;
4104 } 4103 }
4105 # endif 4104 # endif
4106 /* Three situations: 4105 // Three situations:
4107 * 1. No useful previous match: search from start of line. 4106 // 1. No useful previous match: search from start of line.
4108 * 2. Not Vi compatible or empty match: continue at next character. 4107 // 2. Not Vi compatible or empty match: continue at next character.
4109 * Break the loop if this is beyond the end of the line. 4108 // Break the loop if this is beyond the end of the line.
4110 * 3. Vi compatible searching: continue at end of previous match. 4109 // 3. Vi compatible searching: continue at end of previous match.
4111 */
4112 if (shl->lnum == 0) 4110 if (shl->lnum == 0)
4113 matchcol = 0; 4111 matchcol = 0;
4114 else if (vim_strchr(p_cpo, CPO_SEARCH) == NULL 4112 else if (vim_strchr(p_cpo, CPO_SEARCH) == NULL
4115 || (shl->rm.endpos[0].lnum == 0 4113 || (shl->rm.endpos[0].lnum == 0
4116 && shl->rm.endpos[0].col <= shl->rm.startpos[0].col)) 4114 && shl->rm.endpos[0].col <= shl->rm.startpos[0].col))
4134 matchcol = shl->rm.endpos[0].col; 4132 matchcol = shl->rm.endpos[0].col;
4135 4133
4136 shl->lnum = lnum; 4134 shl->lnum = lnum;
4137 if (shl->rm.regprog != NULL) 4135 if (shl->rm.regprog != NULL)
4138 { 4136 {
4139 /* Remember whether shl->rm is using a copy of the regprog in 4137 // Remember whether shl->rm is using a copy of the regprog in
4140 * cur->match. */ 4138 // cur->match.
4141 int regprog_is_copy = (shl != search_hl && cur != NULL 4139 int regprog_is_copy = (shl != search_hl && cur != NULL
4142 && shl == &cur->hl 4140 && shl == &cur->hl
4143 && cur->match.regprog == cur->hl.rm.regprog); 4141 && cur->match.regprog == cur->hl.rm.regprog);
4144 int timed_out = FALSE; 4142 int timed_out = FALSE;
4145 4143
4149 &(shl->tm), &timed_out 4147 &(shl->tm), &timed_out
4150 #else 4148 #else
4151 NULL, NULL 4149 NULL, NULL
4152 #endif 4150 #endif
4153 ); 4151 );
4154 /* Copy the regprog, in case it got freed and recompiled. */ 4152 // Copy the regprog, in case it got freed and recompiled.
4155 if (regprog_is_copy) 4153 if (regprog_is_copy)
4156 cur->match.regprog = cur->hl.rm.regprog; 4154 cur->match.regprog = cur->hl.rm.regprog;
4157 4155
4158 if (called_emsg || got_int || timed_out) 4156 if (called_emsg || got_int || timed_out)
4159 { 4157 {
4160 /* Error while handling regexp: stop using this regexp. */ 4158 // Error while handling regexp: stop using this regexp.
4161 if (shl == search_hl) 4159 if (shl == search_hl)
4162 { 4160 {
4163 /* don't free regprog in the match list, it's a copy */ 4161 // don't free regprog in the match list, it's a copy
4164 vim_regfree(shl->rm.regprog); 4162 vim_regfree(shl->rm.regprog);
4165 set_no_hlsearch(TRUE); 4163 set_no_hlsearch(TRUE);
4166 } 4164 }
4167 shl->rm.regprog = NULL; 4165 shl->rm.regprog = NULL;
4168 shl->lnum = 0; 4166 shl->lnum = 0;
4169 got_int = FALSE; /* avoid the "Type :quit to exit Vim" 4167 got_int = FALSE; // avoid the "Type :quit to exit Vim" message
4170 message */
4171 break; 4168 break;
4172 } 4169 }
4173 } 4170 }
4174 else if (cur != NULL) 4171 else if (cur != NULL)
4175 nmatched = next_search_hl_pos(shl, lnum, &(cur->pos), matchcol); 4172 nmatched = next_search_hl_pos(shl, lnum, &(cur->pos), matchcol);
4176 else 4173 else
4177 nmatched = 0; 4174 nmatched = 0;
4178 if (nmatched == 0) 4175 if (nmatched == 0)
4179 { 4176 {
4180 shl->lnum = 0; /* no match found */ 4177 shl->lnum = 0; // no match found
4181 break; 4178 break;
4182 } 4179 }
4183 if (shl->rm.startpos[0].lnum > 0 4180 if (shl->rm.startpos[0].lnum > 0
4184 || shl->rm.startpos[0].col >= mincol 4181 || shl->rm.startpos[0].col >= mincol
4185 || nmatched > 1 4182 || nmatched > 1
4186 || shl->rm.endpos[0].col > mincol) 4183 || shl->rm.endpos[0].col > mincol)
4187 { 4184 {
4188 shl->lnum += shl->rm.startpos[0].lnum; 4185 shl->lnum += shl->rm.startpos[0].lnum;
4189 break; /* useful match found */ 4186 break; // useful match found
4190 } 4187 }
4191 } 4188 }
4192 4189
4193 // Restore called_emsg for assert_fails(). 4190 // Restore called_emsg for assert_fails().
4194 called_emsg = save_called_emsg; 4191 called_emsg = save_called_emsg;
4198 * Advance to the match in window "wp" line "lnum" or past it. 4195 * Advance to the match in window "wp" line "lnum" or past it.
4199 */ 4196 */
4200 void 4197 void
4201 prepare_search_hl(win_T *wp, match_T *search_hl, linenr_T lnum) 4198 prepare_search_hl(win_T *wp, match_T *search_hl, linenr_T lnum)
4202 { 4199 {
4203 matchitem_T *cur; /* points to the match list */ 4200 matchitem_T *cur; // points to the match list
4204 match_T *shl; /* points to search_hl or a match */ 4201 match_T *shl; // points to search_hl or a match
4205 int shl_flag; /* flag to indicate whether search_hl 4202 int shl_flag; // flag to indicate whether search_hl
4206 has been processed or not */ 4203 // has been processed or not
4207 int pos_inprogress; /* marks that position match search is 4204 int pos_inprogress; // marks that position match search is
4208 in progress */ 4205 // in progress
4209 int n; 4206 int n;
4210 4207
4211 /* 4208 // When using a multi-line pattern, start searching at the top
4212 * When using a multi-line pattern, start searching at the top 4209 // of the window or just after a closed fold.
4213 * of the window or just after a closed fold. 4210 // Do this both for search_hl and the match list.
4214 * Do this both for search_hl and the match list.
4215 */
4216 cur = wp->w_match_head; 4211 cur = wp->w_match_head;
4217 shl_flag = WIN_IS_POPUP(wp); // skip search_hl in a popup window 4212 shl_flag = WIN_IS_POPUP(wp); // skip search_hl in a popup window
4218 while (cur != NULL || shl_flag == FALSE) 4213 while (cur != NULL || shl_flag == FALSE)
4219 { 4214 {
4220 if (shl_flag == FALSE) 4215 if (shl_flag == FALSE)
4336 if (has_mbyte && (*line)[shl->endcol] != NUL) 4331 if (has_mbyte && (*line)[shl->endcol] != NUL)
4337 shl->endcol += (*mb_ptr2len)((*line) + shl->endcol); 4332 shl->endcol += (*mb_ptr2len)((*line) + shl->endcol);
4338 else 4333 else
4339 ++shl->endcol; 4334 ++shl->endcol;
4340 } 4335 }
4341 if ((long)shl->startcol < mincol) /* match at leftcol */ 4336 if ((long)shl->startcol < mincol) // match at leftcol
4342 { 4337 {
4343 shl->attr_cur = shl->attr; 4338 shl->attr_cur = shl->attr;
4344 *search_attr = shl->attr; 4339 *search_attr = shl->attr;
4345 } 4340 }
4346 area_highlighting = TRUE; 4341 area_highlighting = TRUE;
4364 win_T *wp, 4359 win_T *wp,
4365 linenr_T lnum, 4360 linenr_T lnum,
4366 colnr_T col, 4361 colnr_T col,
4367 char_u **line, 4362 char_u **line,
4368 match_T *search_hl, 4363 match_T *search_hl,
4369 int *has_match_conc, 4364 int *has_match_conc UNUSED,
4370 int *match_conc, 4365 int *match_conc UNUSED,
4371 int did_line_attr, 4366 int did_line_attr,
4372 int lcs_eol_one) 4367 int lcs_eol_one)
4373 { 4368 {
4374 matchitem_T *cur; // points to the match list 4369 matchitem_T *cur; // points to the match list
4375 match_T *shl; // points to search_hl or a match 4370 match_T *shl; // points to search_hl or a match
4442 else 4437 else
4443 shl->endcol = MAXCOL; 4438 shl->endcol = MAXCOL;
4444 4439
4445 if (shl->startcol == shl->endcol) 4440 if (shl->startcol == shl->endcol)
4446 { 4441 {
4447 /* highlight empty match, try again after 4442 // highlight empty match, try again after
4448 * it */ 4443 // it
4449 if (has_mbyte) 4444 if (has_mbyte)
4450 shl->endcol += (*mb_ptr2len)(*line + shl->endcol); 4445 shl->endcol += (*mb_ptr2len)(*line + shl->endcol);
4451 else 4446 else
4452 ++shl->endcol; 4447 ++shl->endcol;
4453 } 4448 }
4454 4449
4455 /* Loop to check if the match starts at the 4450 // Loop to check if the match starts at the
4456 * current position */ 4451 // current position
4457 continue; 4452 continue;
4458 } 4453 }
4459 } 4454 }
4460 break; 4455 break;
4461 } 4456 }
4482 if (shl->attr_cur != 0) 4477 if (shl->attr_cur != 0)
4483 search_attr = shl->attr_cur; 4478 search_attr = shl->attr_cur;
4484 if (shl != search_hl && cur != NULL) 4479 if (shl != search_hl && cur != NULL)
4485 cur = cur->next; 4480 cur = cur->next;
4486 } 4481 }
4487 /* Only highlight one character after the last column. */ 4482 // Only highlight one character after the last column.
4488 if (*(*line + col) == NUL && (did_line_attr >= 1 4483 if (*(*line + col) == NUL && (did_line_attr >= 1
4489 || (wp->w_p_list && lcs_eol_one == -1))) 4484 || (wp->w_p_list && lcs_eol_one == -1)))
4490 search_attr = 0; 4485 search_attr = 0;
4491 return search_attr; 4486 return search_attr;
4492 } 4487 }
4622 dict = dict_alloc(); 4617 dict = dict_alloc();
4623 if (dict == NULL) 4618 if (dict == NULL)
4624 return; 4619 return;
4625 if (cur->match.regprog == NULL) 4620 if (cur->match.regprog == NULL)
4626 { 4621 {
4627 /* match added with matchaddpos() */ 4622 // match added with matchaddpos()
4628 for (i = 0; i < MAXPOSMATCH; ++i) 4623 for (i = 0; i < MAXPOSMATCH; ++i)
4629 { 4624 {
4630 llpos_T *llpos; 4625 llpos_T *llpos;
4631 char buf[30]; // use 30 to avoid compiler warning 4626 char buf[30]; // use 30 to avoid compiler warning
4632 list_T *l; 4627 list_T *l;
4691 if (win == NULL) 4686 if (win == NULL)
4692 return; 4687 return;
4693 4688
4694 if ((l = argvars[0].vval.v_list) != NULL) 4689 if ((l = argvars[0].vval.v_list) != NULL)
4695 { 4690 {
4696 /* To some extent make sure that we are dealing with a list from 4691 // To some extent make sure that we are dealing with a list from
4697 * "getmatches()". */ 4692 // "getmatches()".
4698 li = l->lv_first; 4693 li = l->lv_first;
4699 while (li != NULL) 4694 while (li != NULL)
4700 { 4695 {
4701 if (li->li_tv.v_type != VAR_DICT 4696 if (li->li_tv.v_type != VAR_DICT
4702 || (d = li->li_tv.vval.v_dict) == NULL) 4697 || (d = li->li_tv.vval.v_dict) == NULL)
4736 s = list_alloc(); 4731 s = list_alloc();
4737 if (s == NULL) 4732 if (s == NULL)
4738 return; 4733 return;
4739 } 4734 }
4740 4735
4741 /* match from matchaddpos() */ 4736 // match from matchaddpos()
4742 for (i = 1; i < 9; i++) 4737 for (i = 1; i < 9; i++)
4743 { 4738 {
4744 sprintf((char *)buf, (char *)"pos%d", i); 4739 sprintf((char *)buf, (char *)"pos%d", i);
4745 if ((di = dict_find(d, (char_u *)buf, -1)) != NULL) 4740 if ((di = dict_find(d, (char_u *)buf, -1)) != NULL)
4746 { 4741 {
4789 void 4784 void
4790 f_matchadd(typval_T *argvars UNUSED, typval_T *rettv UNUSED) 4785 f_matchadd(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
4791 { 4786 {
4792 # ifdef FEAT_SEARCH_EXTRA 4787 # ifdef FEAT_SEARCH_EXTRA
4793 char_u buf[NUMBUFLEN]; 4788 char_u buf[NUMBUFLEN];
4794 char_u *grp = tv_get_string_buf_chk(&argvars[0], buf); /* group */ 4789 char_u *grp = tv_get_string_buf_chk(&argvars[0], buf); // group
4795 char_u *pat = tv_get_string_buf_chk(&argvars[1], buf); /* pattern */ 4790 char_u *pat = tv_get_string_buf_chk(&argvars[1], buf); // pattern
4796 int prio = 10; /* default priority */ 4791 int prio = 10; // default priority
4797 int id = -1; 4792 int id = -1;
4798 int error = FALSE; 4793 int error = FALSE;
4799 char_u *conceal_char = NULL; 4794 char_u *conceal_char = NULL;
4800 win_T *win = curwin; 4795 win_T *win = curwin;
4801 4796
4871 } 4866 }
4872 } 4867 }
4873 if (error == TRUE) 4868 if (error == TRUE)
4874 return; 4869 return;
4875 4870
4876 /* id == 3 is ok because matchaddpos() is supposed to substitute :3match */ 4871 // id == 3 is ok because matchaddpos() is supposed to substitute :3match
4877 if (id == 1 || id == 2) 4872 if (id == 1 || id == 2)
4878 { 4873 {
4879 semsg(_("E798: ID is reserved for \":match\": %d"), id); 4874 semsg(_("E798: ID is reserved for \":match\": %d"), id);
4880 return; 4875 return;
4881 } 4876 }
4954 { 4949 {
4955 emsg(_(e_invcmd)); 4950 emsg(_(e_invcmd));
4956 return; 4951 return;
4957 } 4952 }
4958 4953
4959 /* First clear any old pattern. */ 4954 // First clear any old pattern.
4960 if (!eap->skip) 4955 if (!eap->skip)
4961 match_delete(curwin, id, FALSE); 4956 match_delete(curwin, id, FALSE);
4962 4957
4963 if (ends_excmd(*eap->arg)) 4958 if (ends_excmd(*eap->arg))
4964 end = eap->arg; 4959 end = eap->arg;
4971 if (!eap->skip) 4966 if (!eap->skip)
4972 g = vim_strnsave(eap->arg, (int)(p - eap->arg)); 4967 g = vim_strnsave(eap->arg, (int)(p - eap->arg));
4973 p = skipwhite(p); 4968 p = skipwhite(p);
4974 if (*p == NUL) 4969 if (*p == NUL)
4975 { 4970 {
4976 /* There must be two arguments. */ 4971 // There must be two arguments.
4977 vim_free(g); 4972 vim_free(g);
4978 semsg(_(e_invarg2), eap->arg); 4973 semsg(_(e_invarg2), eap->arg);
4979 return; 4974 return;
4980 } 4975 }
4981 end = skip_regexp(p + 1, *p, TRUE, NULL); 4976 end = skip_regexp(p + 1, *p, TRUE, NULL);