vim-patch:8.1.2395: using old C style comments

Problem:    Using old C style comments.
Solution:   Use // comments where appropriate.
0d6f5d9740
This commit is contained in:
Dundar Göc 2021-10-21 10:50:43 +02:00
parent daf670dde6
commit 8000f6d566
2 changed files with 68 additions and 70 deletions

View File

@ -929,9 +929,9 @@ static void syn_update_ends(bool startofline)
stateitem_T *cur_si; stateitem_T *cur_si;
if (startofline) { if (startofline) {
/* Check for a match carried over from a previous line with a // Check for a match carried over from a previous line with a
* contained region. The match ends as soon as the region ends. */ // contained region. The match ends as soon as the region ends.
for (int i = 0; i < current_state.ga_len; ++i) { for (int i = 0; i < current_state.ga_len; i++) {
cur_si = &CUR_STATE(i); cur_si = &CUR_STATE(i);
if (cur_si->si_idx >= 0 if (cur_si->si_idx >= 0
&& (SYN_ITEMS(syn_block)[cur_si->si_idx]).sp_type && (SYN_ITEMS(syn_block)[cur_si->si_idx]).sp_type
@ -1335,8 +1335,8 @@ static synstate_T *store_current_state(void)
if (syn_block->b_sst_freecount == 0) { if (syn_block->b_sst_freecount == 0) {
sp = NULL; sp = NULL;
} else { } else {
/* Take the first item from the free list and put it in the used // Take the first item from the free list and put it in the used
* list, after *sp */ // list, after *sp
p = syn_block->b_sst_firstfree; p = syn_block->b_sst_firstfree;
syn_block->b_sst_firstfree = p->sst_next; syn_block->b_sst_firstfree = p->sst_next;
--syn_block->b_sst_freecount; --syn_block->b_sst_freecount;
@ -1359,8 +1359,8 @@ static synstate_T *store_current_state(void)
clear_syn_state(sp); clear_syn_state(sp);
sp->sst_stacksize = current_state.ga_len; sp->sst_stacksize = current_state.ga_len;
if (current_state.ga_len > SST_FIX_STATES) { if (current_state.ga_len > SST_FIX_STATES) {
/* Need to clear it, might be something remaining from when the // Need to clear it, might be something remaining from when the
* length was less than SST_FIX_STATES. */ // length was less than SST_FIX_STATES.
ga_init(&sp->sst_union.sst_ga, (int)sizeof(bufstate_T), 1); ga_init(&sp->sst_union.sst_ga, (int)sizeof(bufstate_T), 1);
ga_grow(&sp->sst_union.sst_ga, current_state.ga_len); ga_grow(&sp->sst_union.sst_ga, current_state.ga_len);
sp->sst_union.sst_ga.ga_len = current_state.ga_len; sp->sst_union.sst_ga.ga_len = current_state.ga_len;
@ -1458,24 +1458,24 @@ static bool syn_stack_equal(synstate_T *sp)
if (bp[i].bs_extmatch == CUR_STATE(i).si_extmatch) { if (bp[i].bs_extmatch == CUR_STATE(i).si_extmatch) {
continue; continue;
} }
/* When the extmatch pointers are different, the strings in // When the extmatch pointers are different, the strings in
* them can still be the same. Check if the extmatch // them can still be the same. Check if the extmatch
* references are equal. */ // references are equal.
bsx = bp[i].bs_extmatch; bsx = bp[i].bs_extmatch;
six = CUR_STATE(i).si_extmatch; six = CUR_STATE(i).si_extmatch;
/* If one of the extmatch pointers is NULL the states are // If one of the extmatch pointers is NULL the states are
* different. */ // different.
if (bsx == NULL || six == NULL) { if (bsx == NULL || six == NULL) {
break; break;
} }
int j; int j;
for (j = 0; j < NSUBEXP; ++j) { for (j = 0; j < NSUBEXP; j++) {
/* Check each referenced match string. They must all be // Check each referenced match string. They must all be
* equal. */ // equal.
if (bsx->matches[j] != six->matches[j]) { if (bsx->matches[j] != six->matches[j]) {
/* If the pointer is different it can still be the // If the pointer is different it can still be the
* same text. Compare the strings, ignore case when // same text. Compare the strings, ignore case when
* the start item has the sp_ic flag set. */ // the start item has the sp_ic flag set.
if (bsx->matches[j] == NULL || six->matches[j] == NULL) { if (bsx->matches[j] == NULL || six->matches[j] == NULL) {
break; break;
} }
@ -1749,8 +1749,8 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
&& (syn_block->b_keywtab.ht_used > 0 && (syn_block->b_keywtab.ht_used > 0
|| syn_block->b_keywtab_ic.ht_used > 0); || syn_block->b_keywtab_ic.ht_used > 0);
/* Init the list of zero-width matches with a nextlist. This is used to // Init the list of zero-width matches with a nextlist. This is used to
* avoid matching the same item in the same position twice. */ // avoid matching the same item in the same position twice.
ga_init(&zero_width_next_ga, (int)sizeof(int), 10); ga_init(&zero_width_next_ga, (int)sizeof(int), 10);
// use syntax iskeyword option // use syntax iskeyword option
@ -1867,9 +1867,9 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
: in_id_list(cur_si, : in_id_list(cur_si,
cur_si->si_cont_list, &spp->sp_syn, cur_si->si_cont_list, &spp->sp_syn,
spp->sp_flags & HL_CONTAINED)))) { spp->sp_flags & HL_CONTAINED)))) {
/* If we already tried matching in this line, and // If we already tried matching in this line, and
* there isn't a match before next_match_col, skip // there isn't a match before next_match_col, skip
* this item. */ // this item.
if (spp->sp_line_id == current_line_id if (spp->sp_line_id == current_line_id
&& spp->sp_startcol >= next_match_col) { && spp->sp_startcol >= next_match_col) {
continue; continue;
@ -2037,9 +2037,9 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
keep_next_list = true; keep_next_list = true;
zero_width_next_list = true; zero_width_next_list = true;
/* Add the index to a list, so that we can check // Add the index to a list, so that we can check
* later that we don't match it again (and cause an // later that we don't match it again (and cause an
* endless loop). */ // endless loop).
GA_APPEND(int, &zero_width_next_ga, next_match_idx); GA_APPEND(int, &zero_width_next_ga, next_match_idx);
next_match_idx = -1; next_match_idx = -1;
} else { } else {
@ -2136,10 +2136,10 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
*can_spell = !in_id_list(sip, sip->si_cont_list, &sps, 0); *can_spell = !in_id_list(sip, sip->si_cont_list, &sps, 0);
} }
} else { } else {
/* The @Spell cluster is defined: Do spelling in items with // The @Spell cluster is defined: Do spelling in items with
* the @Spell cluster. But not when @NoSpell is also there. // the @Spell cluster. But not when @NoSpell is also there.
* At the toplevel only spell check when ":syn spell toplevel" // At the toplevel only spell check when ":syn spell toplevel"
* was used. */ // was used.
if (current_trans_id == 0) { if (current_trans_id == 0) {
*can_spell = (syn_block->b_syn_spell == SYNSPL_TOP); *can_spell = (syn_block->b_syn_spell == SYNSPL_TOP);
} else { } else {
@ -2216,8 +2216,8 @@ static bool did_match_already(int idx, garray_T *gap)
} }
} }
/* Zero-width matches with a nextgroup argument are not put on the syntax // Zero-width matches with a nextgroup argument are not put on the syntax
* stack, and can only be matched once anyway. */ // stack, and can only be matched once anyway.
for (int i = gap->ga_len; --i >= 0; ) { for (int i = gap->ga_len; --i >= 0; ) {
if (((int *)(gap->ga_data))[i] == idx) { if (((int *)(gap->ga_data))[i] == idx) {
return true; return true;
@ -2353,8 +2353,8 @@ static void check_state_ends(void)
next_match_col = MAXCOL; next_match_col = MAXCOL;
break; break;
} else { } else {
/* handle next_list, unless at end of line and no "skipnl" or // handle next_list, unless at end of line and no "skipnl" or
* "skipempty" */ // "skipempty"
current_next_list = cur_si->si_next_list; current_next_list = cur_si->si_next_list;
current_next_flags = cur_si->si_flags; current_next_flags = cur_si->si_flags;
if (!(current_next_flags & (HL_SKIPNL | HL_SKIPEMPTY)) if (!(current_next_flags & (HL_SKIPNL | HL_SKIPEMPTY))

View File

@ -284,17 +284,16 @@ int do_tag(char_u *tag, int type, int count, int forceit, int verbose)
tagstackidx = 0; tagstackidx = 0;
goto end_do_tag; goto end_do_tag;
} }
/* We weren't at the bottom of the stack, so jump all the // We weren't at the bottom of the stack, so jump all the
* way to the bottom now. // way to the bottom now.
*/
tagstackidx = 0; tagstackidx = 0;
} else if (tagstackidx >= tagstacklen) { // count == 0? } else if (tagstackidx >= tagstacklen) { // count == 0?
EMSG(_(topmsg)); EMSG(_(topmsg));
goto end_do_tag; goto end_do_tag;
} }
/* Make a copy of the fmark, autocommands may invalidate the // Make a copy of the fmark, autocommands may invalidate the
* tagstack before it's used. */ // tagstack before it's used.
saved_fmark = tagstack[tagstackidx].fmark; saved_fmark = tagstack[tagstackidx].fmark;
if (saved_fmark.fnum != curbuf->b_fnum) { if (saved_fmark.fnum != curbuf->b_fnum) {
/* /*
@ -306,8 +305,8 @@ int do_tag(char_u *tag, int type, int count, int forceit, int verbose)
tagstackidx = oldtagstackidx; // back to old posn tagstackidx = oldtagstackidx; // back to old posn
goto end_do_tag; goto end_do_tag;
} }
/* A BufReadPost autocommand may jump to the '" mark, but // A BufReadPost autocommand may jump to the '" mark, but
* we don't what that here. */ // we don't what that here.
curwin->w_cursor.lnum = saved_fmark.mark.lnum; curwin->w_cursor.lnum = saved_fmark.mark.lnum;
} else { } else {
setpcmark(); setpcmark();
@ -488,9 +487,9 @@ int do_tag(char_u *tag, int type, int count, int forceit, int verbose)
// found: all matches found. // found: all matches found.
} }
/* If there already were some matches for the same name, move them // If there already were some matches for the same name, move them
* to the start. Avoids that the order changes when using // to the start. Avoids that the order changes when using
* ":tnext" and jumping to another file. */ // ":tnext" and jumping to another file.
if (!new_tag && !other_name) { if (!new_tag && !other_name) {
int j, k; int j, k;
int idx = 0; int idx = 0;
@ -561,9 +560,9 @@ int do_tag(char_u *tag, int type, int count, int forceit, int verbose)
} }
if (cur_match >= num_matches) { if (cur_match >= num_matches) {
/* Avoid giving this error when a file wasn't found and we're // Avoid giving this error when a file wasn't found and we're
* looking for a match in another file, which wasn't found. // looking for a match in another file, which wasn't found.
* There will be an EMSG("file doesn't exist") below then. */ // There will be an EMSG("file doesn't exist") below then.
if ((type == DT_NEXT || type == DT_FIRST) if ((type == DT_NEXT || type == DT_FIRST)
&& nofile_fname == NULL) { && nofile_fname == NULL) {
if (num_matches == 1) { if (num_matches == 1) {
@ -666,8 +665,8 @@ int do_tag(char_u *tag, int type, int count, int forceit, int verbose)
} }
EMSG2(_("E429: File \"%s\" does not exist"), nofile_fname); EMSG2(_("E429: File \"%s\" does not exist"), nofile_fname);
} else { } else {
/* We may have jumped to another window, check that // We may have jumped to another window, check that
* tagstackidx is still valid. */ // tagstackidx is still valid.
if (use_tagstack && tagstackidx > curwin->w_tagstacklen) { if (use_tagstack && tagstackidx > curwin->w_tagstacklen) {
tagstackidx = curwin->w_tagstackidx; tagstackidx = curwin->w_tagstackidx;
} }
@ -1584,15 +1583,15 @@ int find_tags(char_u *pat, int *num_matches, char_u ***matchesp, int flags, int
} }
} }
/* When searching for a specific language skip tags files // When searching for a specific language skip tags files
* for other languages. */ // for other languages.
if (help_lang_find != NULL if (help_lang_find != NULL
&& STRICMP(help_lang, help_lang_find) != 0) { && STRICMP(help_lang, help_lang_find) != 0) {
continue; continue;
} }
/* For CTRL-] in a help file prefer a match with the same // For CTRL-] in a help file prefer a match with the same
* language. */ // language.
if ((flags & TAG_KEEP_LANG) if ((flags & TAG_KEEP_LANG)
&& help_lang_find == NULL && help_lang_find == NULL
&& curbuf->b_fname != NULL && curbuf->b_fname != NULL
@ -2234,8 +2233,8 @@ parse_line:
tagname_free(&tn); tagname_free(&tn);
} }
/* stop searching when already did a linear search, or when TAG_NOIC // stop searching when already did a linear search, or when TAG_NOIC
* used, and 'ignorecase' not set or already did case-ignore search */ // used, and 'ignorecase' not set or already did case-ignore search
if (stop_searching || linear || (!p_ic && noic) || orgpat.regmatch.rm_ic) { if (stop_searching || linear || (!p_ic && noic) || orgpat.regmatch.rm_ic) {
break; break;
} }
@ -2367,8 +2366,8 @@ int get_tagfname(tagname_T *tnp, int first, char_u *buf)
} }
if (tnp->tn_hf_idx >= tag_fnames.ga_len) { if (tnp->tn_hf_idx >= tag_fnames.ga_len) {
/* Not found in 'runtimepath', use 'helpfile', if it exists and // Not found in 'runtimepath', use 'helpfile', if it exists and
* wasn't used yet, replacing "help.txt" with "tags". */ // wasn't used yet, replacing "help.txt" with "tags".
if (tnp->tn_hf_idx > tag_fnames.ga_len || *p_hf == NUL) { if (tnp->tn_hf_idx > tag_fnames.ga_len || *p_hf == NUL) {
return FAIL; return FAIL;
} }
@ -2393,8 +2392,8 @@ int get_tagfname(tagname_T *tnp, int first, char_u *buf)
} }
if (first) { if (first) {
/* Init. We make a copy of 'tags', because autocommands may change // Init. We make a copy of 'tags', because autocommands may change
* the value without notifying us. */ // the value without notifying us.
tnp->tn_tags = vim_strsave((*curbuf->b_p_tags != NUL) tnp->tn_tags = vim_strsave((*curbuf->b_p_tags != NUL)
? curbuf->b_p_tags : p_tags); ? curbuf->b_p_tags : p_tags);
tnp->tn_np = tnp->tn_tags; tnp->tn_np = tnp->tn_tags;
@ -2431,8 +2430,8 @@ int get_tagfname(tagname_T *tnp, int first, char_u *buf)
(void)copy_option_part(&tnp->tn_np, buf, MAXPATHL - 1, " ,"); (void)copy_option_part(&tnp->tn_np, buf, MAXPATHL - 1, " ,");
r_ptr = vim_findfile_stopdir(buf); r_ptr = vim_findfile_stopdir(buf);
/* move the filename one char forward and truncate the // move the filename one char forward and truncate the
* filepath with a NUL */ // filepath with a NUL
filename = path_tail(buf); filename = path_tail(buf);
STRMOVE(filename + 1, filename); STRMOVE(filename + 1, filename);
*filename++ = NUL; *filename++ = NUL;
@ -2790,8 +2789,8 @@ static int jumpto_tag(const char_u *lbuf_arg, int forceit, int keep_help)
} }
if (keep_help) { if (keep_help) {
/* A :ta from a help file will keep the b_help flag set. For ":ptag" // A :ta from a help file will keep the b_help flag set. For ":ptag"
* we need to use the flag from the window where we came from. */ // we need to use the flag from the window where we came from.
if (l_g_do_tagpreview != 0) { if (l_g_do_tagpreview != 0) {
keep_help_flag = curwin_save->w_buffer->b_help; keep_help_flag = curwin_save->w_buffer->b_help;
} else { } else {
@ -2905,8 +2904,8 @@ static int jumpto_tag(const char_u *lbuf_arg, int forceit, int keep_help)
p_ic = save_p_ic; // -V519 p_ic = save_p_ic; // -V519
p_scs = save_p_scs; p_scs = save_p_scs;
/* A search command may have positioned the cursor beyond the end // A search command may have positioned the cursor beyond the end
* of the line. May need to correct that here. */ // of the line. May need to correct that here.
check_cursor(); check_cursor();
} else { } else {
const int save_secure = secure; const int save_secure = secure;
@ -3128,9 +3127,8 @@ int expand_tags(int tagnames, char_u *pat, int *num_file, char_u ***file)
TAG_MANY, curbuf->b_ffname); TAG_MANY, curbuf->b_ffname);
} }
if (ret == OK && !tagnames) { if (ret == OK && !tagnames) {
/* Reorganize the tags for display and matching as strings of: // Reorganize the tags for display and matching as strings of:
* "<tagname>\0<kind>\0<filename>\0" // "<tagname>\0<kind>\0<filename>\0"
*/
for (i = 0; i < *num_file; i++) { for (i = 0; i < *num_file; i++) {
size_t len; size_t len;
@ -3260,8 +3258,8 @@ int get_tags(list_T *list, char_u *pat, char_u *buf_fname)
char_u *s, *n; char_u *s, *n;
int len; int len;
/* Add extra field as a dict entry. Fields are // Add extra field as a dict entry. Fields are
* separated by Tabs. */ // separated by Tabs.
n = p; n = p;
while (*p != NUL && *p >= ' ' && *p < 127 && *p != ':') { while (*p != NUL && *p >= ' ' && *p < 127 && *p != ':') {
++p; ++p;