vim-patch:8.1.1745: compiler warning for unused argument

Problem:    Compiler warning for unused argument.
Solution:   Add UNUSED.  Change comments to new style.
1f164b1968
This commit is contained in:
Jan Edmund Lazo
2020-03-21 11:04:09 -04:00
parent dfb8dc8b45
commit 22eb3c9e49
3 changed files with 46 additions and 44 deletions

View File

@@ -5648,8 +5648,11 @@ static void f_matchadd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
char grpbuf[NUMBUFLEN];
char patbuf[NUMBUFLEN];
// group
const char *const grp = tv_get_string_buf_chk(&argvars[0], grpbuf);
// pattern
const char *const pat = tv_get_string_buf_chk(&argvars[1], patbuf);
// default priority
int prio = 10;
int id = -1;
bool error = false;

View File

@@ -3160,8 +3160,8 @@ win_line (
shl->endcol += (*mb_ptr2len)(line + shl->endcol);
}
/* Loop to check if the match starts at the
* current position */
// Loop to check if the match starts at the
// current position
continue;
}
}
@@ -5732,12 +5732,11 @@ static void end_search_hl(void)
* Init for calling prepare_search_hl().
*/
static void init_search_hl(win_T *wp)
FUNC_ATTR_NONNULL_ALL
{
matchitem_T *cur;
/* Setup for match and 'hlsearch' highlighting. Disable any previous
* match */
cur = wp->w_match_head;
// Setup for match and 'hlsearch' highlighting. Disable any previous
// match
matchitem_T *cur = wp->w_match_head;
while (cur != NULL) {
cur->hl.rm = cur->match;
if (cur->hlg_id == 0)
@@ -5747,7 +5746,7 @@ static void init_search_hl(win_T *wp)
cur->hl.buf = wp->w_buffer;
cur->hl.lnum = 0;
cur->hl.first_lnum = 0;
/* Set the time limit to 'redrawtime'. */
// Set the time limit to 'redrawtime'.
cur->hl.tm = profile_setlimit(p_rdt);
cur = cur->next;
}
@@ -5763,18 +5762,16 @@ static void init_search_hl(win_T *wp)
* Advance to the match in window "wp" line "lnum" or past it.
*/
static void prepare_search_hl(win_T *wp, linenr_T lnum)
FUNC_ATTR_NONNULL_ALL
{
matchitem_T *cur; /* points to the match list */
match_T *shl; /* points to search_hl or a match */
int shl_flag; /* flag to indicate whether search_hl
has been processed or not */
int n;
matchitem_T *cur; // points to the match list
match_T *shl; // points to search_hl or a match
bool shl_flag; // flag to indicate whether search_hl
// has been processed or not
/*
* When using a multi-line pattern, start searching at the top
* of the window or just after a closed fold.
* Do this both for search_hl and the match list.
*/
// When using a multi-line pattern, start searching at the top
// of the window or just after a closed fold.
// Do this both for search_hl and the match list.
cur = wp->w_match_head;
shl_flag = false;
while (cur != NULL || shl_flag == false) {
@@ -5801,7 +5798,7 @@ static void prepare_search_hl(win_T *wp, linenr_T lnum)
}
bool pos_inprogress = true; // mark that a position match search is
// in progress
n = 0;
int n = 0;
while (shl->first_lnum < lnum && (shl->rm.regprog != NULL
|| (cur != NULL && pos_inprogress))) {
next_search_hl(wp, shl, shl->first_lnum, (colnr_T)n,
@@ -5839,6 +5836,7 @@ next_search_hl (
colnr_T mincol, /* minimal column for a match */
matchitem_T *cur /* to retrieve match positions if any */
)
FUNC_ATTR_NONNULL_ARG(2)
{
linenr_T l;
colnr_T matchcol;
@@ -5846,11 +5844,10 @@ next_search_hl (
int save_called_emsg = called_emsg;
if (shl->lnum != 0) {
/* Check for three situations:
* 1. If the "lnum" is below a previous match, start a new search.
* 2. If the previous match includes "mincol", use it.
* 3. Continue after the previous match.
*/
// Check for three situations:
// 1. If the "lnum" is below a previous match, start a new search.
// 2. If the previous match includes "mincol", use it.
// 3. Continue after the previous match.
l = shl->lnum + shl->rm.endpos[0].lnum - shl->rm.startpos[0].lnum;
if (lnum > l)
shl->lnum = 0;
@@ -5864,22 +5861,21 @@ next_search_hl (
*/
called_emsg = FALSE;
for (;; ) {
/* Stop searching after passing the time limit. */
// Stop searching after passing the time limit.
if (profile_passed_limit(shl->tm)) {
shl->lnum = 0; /* no match found in time */
break;
}
/* Three situations:
* 1. No useful previous match: search from start of line.
* 2. Not Vi compatible or empty match: continue at next character.
* Break the loop if this is beyond the end of the line.
* 3. Vi compatible searching: continue at end of previous match.
*/
if (shl->lnum == 0)
// Three situations:
// 1. No useful previous match: search from start of line.
// 2. Not Vi compatible or empty match: continue at next character.
// Break the loop if this is beyond the end of the line.
// 3. Vi compatible searching: continue at end of previous match.
if (shl->lnum == 0) {
matchcol = 0;
else if (vim_strchr(p_cpo, CPO_SEARCH) == NULL
|| (shl->rm.endpos[0].lnum == 0
&& shl->rm.endpos[0].col <= shl->rm.startpos[0].col)) {
} else if (vim_strchr(p_cpo, CPO_SEARCH) == NULL
|| (shl->rm.endpos[0].lnum == 0
&& shl->rm.endpos[0].col <= shl->rm.startpos[0].col)) {
char_u *ml;
matchcol = shl->rm.startpos[0].col;
@@ -5896,8 +5892,8 @@ next_search_hl (
shl->lnum = lnum;
if (shl->rm.regprog != NULL) {
/* Remember whether shl->rm is using a copy of the regprog in
* cur->match. */
// Remember whether shl->rm is using a copy of the regprog in
// cur->match.
bool regprog_is_copy = (shl != &search_hl
&& cur != NULL
&& shl == &cur->hl
@@ -5926,7 +5922,7 @@ next_search_hl (
nmatched = next_search_hl_pos(shl, lnum, &(cur->pos), matchcol);
}
if (nmatched == 0) {
shl->lnum = 0; /* no match found */
shl->lnum = 0; // no match found
break;
}
if (shl->rm.startpos[0].lnum > 0
@@ -5934,7 +5930,7 @@ next_search_hl (
|| nmatched > 1
|| shl->rm.endpos[0].col > mincol) {
shl->lnum += shl->rm.startpos[0].lnum;
break; /* useful match found */
break; // useful match found
}
// Restore called_emsg for assert_fails().
@@ -5951,6 +5947,7 @@ next_search_hl_pos(
posmatch_T *posmatch, // match positions
colnr_T mincol // minimal column for a match
)
FUNC_ATTR_NONNULL_ALL
{
int i;
int found = -1;

View File

@@ -6544,10 +6544,12 @@ void restore_buffer(bufref_T *save_curbuf)
/// @param[in] id a desired ID 'id' can be specified
/// (greater than or equal to 1). -1 must be specified if no
/// particular ID is desired
/// @param[in] conceal_char pointer to conceal replacement char
/// @return ID of added match, -1 on failure.
int match_add(win_T *wp, const char *const grp, const char *const pat,
int prio, int id, list_T *pos_list,
const char *const conceal_char)
FUNC_ATTR_NONNULL_ARG(1, 2)
{
matchitem_T *cur;
matchitem_T *prev;
@@ -6584,7 +6586,7 @@ int match_add(win_T *wp, const char *const grp, const char *const pat,
return -1;
}
/* Find available match ID. */
// Find available match ID.
while (id == -1) {
cur = wp->w_match_head;
while (cur != NULL && cur->id != wp->w_next_match_id)
@@ -6594,7 +6596,7 @@ int match_add(win_T *wp, const char *const grp, const char *const pat,
wp->w_next_match_id++;
}
/* Build new match. */
// Build new match.
m = xcalloc(1, sizeof(matchitem_T));
m->id = id;
m->priority = prio;
@@ -6703,8 +6705,8 @@ int match_add(win_T *wp, const char *const grp, const char *const pat,
}
}
/* Insert new match. The match list is in ascending order with regard to
* the match priorities. */
// Insert new match. The match list is in ascending order with regard to
// the match priorities.
cur = wp->w_match_head;
prev = cur;
while (cur != NULL && prio >= cur->priority) {