vim-patch:8.1.2394: using old C style comments

Problem:    Using old C style comments.
Solution:   Use // comments where appropriate.
63d9e730f7
This commit is contained in:
Dundar Göc 2021-10-06 11:42:33 +02:00
parent e8f87f15d7
commit 41d3b98deb
4 changed files with 92 additions and 94 deletions

View File

@ -3003,8 +3003,8 @@ static void ungetchr(void)
at_start = prev_at_start; at_start = prev_at_start;
prev_at_start = false; prev_at_start = false;
/* Backup regparse, so that it's at the same position as before the // Backup regparse, so that it's at the same position as before the
* getchr(). */ // getchr().
regparse -= prevchr_len; regparse -= prevchr_len;
} }
@ -6412,8 +6412,8 @@ static int cstrncmp(char_u *s1, char_u *s2, int *n)
int c1, c2, c11, c12; int c1, c2, c11, c12;
int junk; int junk;
/* we have to handle the strcmp ourselves, since it is necessary to // we have to handle the strcmp ourselves, since it is necessary to
* deal with the composing characters by ignoring them: */ // deal with the composing characters by ignoring them:
str1 = s1; str1 = s1;
str2 = s2; str2 = s2;
c1 = c2 = 0; c1 = c2 = 0;
@ -7184,8 +7184,8 @@ static regengine_T nfa_regengine =
(char_u *)"" (char_u *)""
}; };
/* Which regexp engine to use? Needed for vim_regcomp(). // Which regexp engine to use? Needed for vim_regcomp().
* Must match with 'regexpengine'. */ // Must match with 'regexpengine'.
static int regexp_engine = 0; static int regexp_engine = 0;
#ifdef REGEXP_DEBUG #ifdef REGEXP_DEBUG

View File

@ -372,8 +372,8 @@ nfa_regcomp_start (
/* A reasonable estimation for maximum size */ /* A reasonable estimation for maximum size */
nstate_max = (STRLEN(expr) + 1) * 25; nstate_max = (STRLEN(expr) + 1) * 25;
/* Some items blow up in size, such as [A-z]. Add more space for that. // Some items blow up in size, such as [A-z]. Add more space for that.
* When it is still not enough realloc_post_list() will be used. */ // When it is still not enough realloc_post_list() will be used.
nstate_max += 1000; nstate_max += 1000;
/* Size for postfix representation of expr. */ /* Size for postfix representation of expr. */
@ -1424,8 +1424,8 @@ static int nfa_regatom(void)
} }
break; break;
/* Catch \%^ and \%$ regardless of where they appear in the // Catch \%^ and \%$ regardless of where they appear in the
* pattern -- regardless of whether or not it makes sense. */ // pattern -- regardless of whether or not it makes sense.
case '^': case '^':
EMIT(NFA_BOF); EMIT(NFA_BOF);
break; break;
@ -1466,13 +1466,13 @@ static int nfa_regatom(void)
EMIT(NFA_OPT_CHARS); EMIT(NFA_OPT_CHARS);
EMIT(n); EMIT(n);
/* Emit as "\%(\%[abc]\)" to be able to handle // Emit as "\%(\%[abc]\)" to be able to handle
* "\%[abc]*" which would cause the empty string to be // "\%[abc]*" which would cause the empty string to be
* matched an unlimited number of times. NFA_NOPEN is // matched an unlimited number of times. NFA_NOPEN is
* added only once at a position, while NFA_SPLIT is // added only once at a position, while NFA_SPLIT is
* added multiple times. This is more efficient than // added multiple times. This is more efficient than
* not allowing NFA_SPLIT multiple times, it is used // not allowing NFA_SPLIT multiple times, it is used
* a lot. */ // a lot.
EMIT(NFA_NOPEN); EMIT(NFA_NOPEN);
break; break;
} }
@ -1882,8 +1882,8 @@ static int nfa_regpiece(void)
int my_post_start; int my_post_start;
int quest; int quest;
/* Save the current parse state, so that we can use it if <atom>{m,n} is // Save the current parse state, so that we can use it if <atom>{m,n} is
* next. */ // next.
save_parse_state(&old_state); save_parse_state(&old_state);
/* store current pos in the postfix form, for \{m,n} involving 0s */ /* store current pos in the postfix form, for \{m,n} involving 0s */
@ -1967,12 +1967,11 @@ static int nfa_regpiece(void)
break; break;
case Magic('{'): case Magic('{'):
/* a{2,5} will expand to 'aaa?a?a?' // a{2,5} will expand to 'aaa?a?a?'
* a{-1,3} will expand to 'aa??a??', where ?? is the nongreedy // a{-1,3} will expand to 'aa??a??', where ?? is the nongreedy
* version of '?' // version of '?'
* \v(ab){2,3} will expand to '(ab)(ab)(ab)?', where all the // \v(ab){2,3} will expand to '(ab)(ab)(ab)?', where all the
* parenthesis have the same id // parenthesis have the same id
*/
greedy = true; greedy = true;
c2 = peekchr(); c2 = peekchr();
@ -1983,8 +1982,8 @@ static int nfa_regpiece(void)
if (!read_limits(&minval, &maxval)) if (!read_limits(&minval, &maxval))
EMSG_RET_FAIL(_("E870: (NFA regexp) Error reading repetition limits")); EMSG_RET_FAIL(_("E870: (NFA regexp) Error reading repetition limits"));
/* <atom>{0,inf}, <atom>{0,} and <atom>{} are equivalent to // <atom>{0,inf}, <atom>{0,} and <atom>{} are equivalent to
* <atom>* */ // <atom>*
if (minval == 0 && maxval == MAX_LIMIT) { if (minval == 0 && maxval == MAX_LIMIT) {
if (greedy) if (greedy)
/* \{}, \{0,} */ /* \{}, \{0,} */
@ -3327,10 +3326,10 @@ static nfa_state_T *post2nfa(int *postfix, int *end, int nfa_calc_size)
break; break;
} }
/* Allow "NFA_MOPEN" as a valid postfix representation for // Allow "NFA_MOPEN" as a valid postfix representation for
* the empty regexp "". In this case, the NFA will be // the empty regexp "". In this case, the NFA will be
* NFA_MOPEN -> NFA_MCLOSE. Note that this also allows // NFA_MOPEN -> NFA_MCLOSE. Note that this also allows
* empty groups of parenthesis, and empty mbyte chars */ // empty groups of parenthesis, and empty mbyte chars
if (stackp == stack) { if (stackp == stack) {
s = alloc_state(mopen, NULL, NULL); s = alloc_state(mopen, NULL, NULL);
if (s == NULL) if (s == NULL)
@ -3343,8 +3342,8 @@ static nfa_state_T *post2nfa(int *postfix, int *end, int nfa_calc_size)
break; break;
} }
/* At least one node was emitted before NFA_MOPEN, so // At least one node was emitted before NFA_MOPEN, so
* at least one node will be between NFA_MOPEN and NFA_MCLOSE */ // at least one node will be between NFA_MOPEN and NFA_MCLOSE
e = POP(); e = POP();
s = alloc_state(mopen, e.start, NULL); /* `(' */ s = alloc_state(mopen, e.start, NULL); /* `(' */
if (s == NULL) if (s == NULL)
@ -3501,14 +3500,14 @@ static void nfa_postprocess(nfa_regprog_T *prog)
int ch_invisible = failure_chance(prog->state[i].out, 0); int ch_invisible = failure_chance(prog->state[i].out, 0);
int ch_follows = failure_chance(prog->state[i].out1->out, 0); int ch_follows = failure_chance(prog->state[i].out1->out, 0);
/* Postpone when the invisible match is expensive or has a // Postpone when the invisible match is expensive or has a
* lower chance of failing. */ // lower chance of failing.
if (c == NFA_START_INVISIBLE_BEFORE if (c == NFA_START_INVISIBLE_BEFORE
|| c == NFA_START_INVISIBLE_BEFORE_NEG) { || c == NFA_START_INVISIBLE_BEFORE_NEG) {
/* "before" matches are very expensive when // "before" matches are very expensive when
* unbounded, always prefer what follows then, // unbounded, always prefer what follows then,
* unless what follows will always match. // unless what follows will always match.
* Otherwise strongly prefer what follows. */ // Otherwise strongly prefer what follows.
if (prog->state[i].val <= 0 && ch_follows > 0) { if (prog->state[i].val <= 0 && ch_follows > 0) {
directly = false; directly = false;
} else { } else {
@ -3527,9 +3526,9 @@ static void nfa_postprocess(nfa_regprog_T *prog)
} }
} }
/**************************************************************** /////////////////////////////////////////////////////////////////
* NFA execution code. // NFA execution code.
****************************************************************/ /////////////////////////////////////////////////////////////////
/* Values for done in nfa_pim_T. */ /* Values for done in nfa_pim_T. */
#define NFA_PIM_UNUSED 0 /* pim not used */ #define NFA_PIM_UNUSED 0 /* pim not used */
@ -4195,8 +4194,8 @@ skip_add:
save_ptr = NULL; save_ptr = NULL;
memset(&save_multipos, 0, sizeof(save_multipos)); memset(&save_multipos, 0, sizeof(save_multipos));
/* Set the position (with "off" added) in the subexpression. Save // Set the position (with "off" added) in the subexpression. Save
* and restore it when it was in use. Otherwise fill any gap. */ // and restore it when it was in use. Otherwise fill any gap.
if (REG_MULTI) { if (REG_MULTI) {
if (subidx < sub->in_use) { if (subidx < sub->in_use) {
save_multipos = sub->list.multi[subidx]; save_multipos = sub->list.multi[subidx];
@ -4295,8 +4294,8 @@ skip_add:
sub = &subs->norm; sub = &subs->norm;
} }
/* We don't fill in gaps here, there must have been an MOPEN that // We don't fill in gaps here, there must have been an MOPEN that
* has done that. */ // has done that.
save_in_use = sub->in_use; save_in_use = sub->in_use;
if (sub->in_use <= subidx) if (sub->in_use <= subidx)
sub->in_use = subidx + 1; sub->in_use = subidx + 1;

View File

@ -5164,8 +5164,8 @@ void win_redr_status_matches(expand_T *xp, int num_matches, char_u **matches, in
if (row >= 0) { if (row >= 0) {
if (wild_menu_showing == 0 || wild_menu_showing == WM_LIST) { if (wild_menu_showing == 0 || wild_menu_showing == WM_LIST) {
if (msg_scrolled > 0) { if (msg_scrolled > 0) {
/* Put the wildmenu just above the command line. If there is // Put the wildmenu just above the command line. If there is
* no room, scroll the screen one line up. */ // no room, scroll the screen one line up.
if (cmdline_row == Rows - 1) { if (cmdline_row == Rows - 1) {
msg_scroll_up(false); msg_scroll_up(false);
msg_scrolled++; msg_scrolled++;
@ -7032,8 +7032,8 @@ int showmode(void)
if (VIsual_active) { if (VIsual_active) {
char *p; char *p;
/* Don't concatenate separate words to avoid translation // Don't concatenate separate words to avoid translation
* problems. */ // problems.
switch ((VIsual_select ? 4 : 0) switch ((VIsual_select ? 4 : 0)
+ (VIsual_mode == Ctrl_V) * 2 + (VIsual_mode == Ctrl_V) * 2
+ (VIsual_mode == 'V')) { + (VIsual_mode == 'V')) {

View File

@ -839,14 +839,14 @@ int searchit(win_T *win, buf_T *buf, pos_T *pos, pos_T *end_pos, Direction dir,
} }
} }
/* With the SEARCH_END option move to the last character // With the SEARCH_END option move to the last character
* of the match. Don't do it for an empty match, end // of the match. Don't do it for an empty match, end
* should be same as start then. */ // should be same as start then.
if ((options & SEARCH_END) && !(options & SEARCH_NOOF) if ((options & SEARCH_END) && !(options & SEARCH_NOOF)
&& !(matchpos.lnum == endpos.lnum && !(matchpos.lnum == endpos.lnum
&& matchpos.col == endpos.col)) { && matchpos.col == endpos.col)) {
/* For a match in the first column, set the position // For a match in the first column, set the position
* on the NUL in the previous line. */ // on the NUL in the previous line.
pos->lnum = lnum + endpos.lnum; pos->lnum = lnum + endpos.lnum;
pos->col = endpos.col; pos->col = endpos.col;
if (endpos.col == 0) { if (endpos.col == 0) {
@ -1498,8 +1498,8 @@ int search_for_exact_line(buf_T *buf, pos_T *pos, Direction dir, char_u *pat)
p = skipwhite(ptr); p = skipwhite(ptr);
pos->col = (colnr_T)(p - ptr); pos->col = (colnr_T)(p - ptr);
/* when adding lines the matching line may be empty but it is not // when adding lines the matching line may be empty but it is not
* ignored because we are interested in the next line -- Acevedo */ // ignored because we are interested in the next line -- Acevedo
if ((compl_cont_status & CONT_ADDING) if ((compl_cont_status & CONT_ADDING)
&& !(compl_cont_status & CONT_SOL)) { && !(compl_cont_status & CONT_SOL)) {
if (mb_strcmp_ic((bool)p_ic, (const char *)p, (const char *)pat) == 0) { if (mb_strcmp_ic((bool)p_ic, (const char *)p, (const char *)pat) == 0) {
@ -1566,9 +1566,9 @@ int searchc(cmdarg_T *cap, int t_cmd)
c = *lastc; c = *lastc;
// For multi-byte re-use last lastc_bytes[] and lastc_bytelen. // For multi-byte re-use last lastc_bytes[] and lastc_bytelen.
/* Force a move of at least one char, so ";" and "," will move the // Force a move of at least one char, so ";" and "," will move the
* cursor, even if the cursor is right in front of char we are looking // cursor, even if the cursor is right in front of char we are looking
* at. */ // at.
if (vim_strchr(p_cpo, CPO_SCOLON) == NULL && count == 1 && t_cmd) { if (vim_strchr(p_cpo, CPO_SCOLON) == NULL && count == 1 && t_cmd) {
stop = false; stop = false;
} }
@ -2084,10 +2084,10 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
if (linep[pos.col - 1] == 'R' if (linep[pos.col - 1] == 'R'
&& linep[pos.col] == '"' && linep[pos.col] == '"'
&& vim_strchr(linep + pos.col + 1, '(') != NULL) { && vim_strchr(linep + pos.col + 1, '(') != NULL) {
/* Possible start of raw string. Now that we have the // Possible start of raw string. Now that we have the
* delimiter we can check if it ends before where we // delimiter we can check if it ends before where we
* started searching, or before the previously found // started searching, or before the previously found
* raw string start. */ // raw string start.
if (!find_rawstring_end(linep, &pos, if (!find_rawstring_end(linep, &pos,
count > 0 ? &match_pos : &curwin->w_cursor)) { count > 0 ? &match_pos : &curwin->w_cursor)) {
count++; count++;
@ -2208,8 +2208,8 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
break; break;
case '"': case '"':
/* a quote that is preceded with an odd number of backslashes is // a quote that is preceded with an odd number of backslashes is
* ignored */ // ignored
if (do_quotes) { if (do_quotes) {
int col; int col;
@ -2282,8 +2282,8 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
bslcnt++; bslcnt++;
} }
} }
/* Only accept a match when 'M' is in 'cpo' or when escaping // Only accept a match when 'M' is in 'cpo' or when escaping
* is what we expect. */ // is what we expect.
if (cpo_bsl || (bslcnt & 1) == match_escaped) { if (cpo_bsl || (bslcnt & 1) == match_escaped) {
if (c == initc) { if (c == initc) {
count++; count++;
@ -3505,8 +3505,8 @@ int current_block(oparg_T *oap, long count, int include, int what, int other)
// Include the character under the cursor. // Include the character under the cursor.
oap->inclusive = true; oap->inclusive = true;
} else { } else {
/* End is before the start (no text in between <>, [], etc.): don't // End is before the start (no text in between <>, [], etc.): don't
* operate on any text. */ // operate on any text.
curwin->w_cursor = start_pos; curwin->w_cursor = start_pos;
} }
} }
@ -4044,8 +4044,8 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar)
} }
if (!vis_empty) { if (!vis_empty) {
/* Check if the existing selection exactly spans the text inside // Check if the existing selection exactly spans the text inside
* quotes. */ // quotes.
if (vis_bef_curs) { if (vis_bef_curs) {
inside_quotes = VIsual.col > 0 inside_quotes = VIsual.col > 0
&& line[VIsual.col - 1] == quotechar && line[VIsual.col - 1] == quotechar
@ -4072,11 +4072,11 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar)
} }
if (!vis_empty && line[col_start] == quotechar) { if (!vis_empty && line[col_start] == quotechar) {
/* Already selecting something and on a quote character. Find the // Already selecting something and on a quote character. Find the
* next quoted string. */ // next quoted string.
if (vis_bef_curs) { if (vis_bef_curs) {
/* Assume we are on a closing quote: move to after the next // Assume we are on a closing quote: move to after the next
* opening quote. */ // opening quote.
col_start = find_next_quote(line, col_start + 1, quotechar, NULL); col_start = find_next_quote(line, col_start + 1, quotechar, NULL);
if (col_start < 0) { if (col_start < 0) {
goto abort_search; goto abort_search;
@ -4800,8 +4800,8 @@ void find_pattern_in_path(char_u *ptr, Direction dir, size_t len, bool whole, bo
file_line = xmalloc(LSIZE); file_line = xmalloc(LSIZE);
if (type != CHECK_PATH && type != FIND_DEFINE if (type != CHECK_PATH && type != FIND_DEFINE
/* when CONT_SOL is set compare "ptr" with the beginning of the line // when CONT_SOL is set compare "ptr" with the beginning of the line
* is faster than quote_meta/regcomp/regexec "ptr" -- Acevedo */ // is faster than quote_meta/regcomp/regexec "ptr" -- Acevedo
&& !(compl_cont_status & CONT_SOL)) { && !(compl_cont_status & CONT_SOL)) {
pat = xmalloc(len + 5); pat = xmalloc(len + 5);
assert(len <= INT_MAX); assert(len <= INT_MAX);
@ -4946,10 +4946,9 @@ void find_pattern_in_path(char_u *ptr, Direction dir, size_t len, bool whole, bo
// Nothing found, use the rest of the line. // Nothing found, use the rest of the line.
p = incl_regmatch.endp[0]; p = incl_regmatch.endp[0];
i = (int)STRLEN(p); i = (int)STRLEN(p);
} } else if (p > line) {
/* Avoid checking before the start of the line, can // Avoid checking before the start of the line, can
* happen if \zs appears in the regexp. */ // happen if \zs appears in the regexp.
else if (p > line) {
if (p[-1] == '"' || p[-1] == '<') { if (p[-1] == '"' || p[-1] == '<') {
--p; --p;
++i; ++i;
@ -5129,9 +5128,9 @@ search_line:
// IOSIZE > compl_length, so the STRNCPY works // IOSIZE > compl_length, so the STRNCPY works
STRNCPY(IObuff, aux, i); STRNCPY(IObuff, aux, i);
/* Get the next line: when "depth" < 0 from the current // Get the next line: when "depth" < 0 from the current
* buffer, otherwise from the included file. Jump to // buffer, otherwise from the included file. Jump to
* exit_matched when past the last line. */ // exit_matched when past the last line.
if (depth < 0) { if (depth < 0) {
if (lnum >= end_lnum) { if (lnum >= end_lnum) {
goto exit_matched; goto exit_matched;
@ -5142,9 +5141,9 @@ search_line:
goto exit_matched; goto exit_matched;
} }
/* we read a line, set "already" to check this "line" later // we read a line, set "already" to check this "line" later
* if depth >= 0 we'll increase files[depth].lnum far // if depth >= 0 we'll increase files[depth].lnum far
* bellow -- Acevedo */ // bellow -- Acevedo
already = aux = p = skipwhite(line); already = aux = p = skipwhite(line);
p = find_word_start(p); p = find_word_start(p);
p = find_word_end(p); p = find_word_end(p);
@ -5195,8 +5194,8 @@ search_line:
if (did_show) { if (did_show) {
msg_putchar('\n'); // cursor below last one msg_putchar('\n'); // cursor below last one
} }
if (!got_int) { /* don't display if 'q' typed if (!got_int) { // don't display if 'q' typed
at "--more--" message */ // at "--more--" message
msg_home_replace_hl(curr_fname); msg_home_replace_hl(curr_fname);
} }
prev_fname = curr_fname; prev_fname = curr_fname;
@ -5209,10 +5208,10 @@ search_line:
match_count++); match_count++);
} }
/* Set matched flag for this file and all the ones that // Set matched flag for this file and all the ones that
* include it */ // include it
for (i = 0; i <= depth; ++i) { for (i = 0; i <= depth; i++) {
files[i].matched = TRUE; files[i].matched = true;
} }
} else if (--count <= 0) { } else if (--count <= 0) {
found = true; found = true;