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;
if (startofline) {
/* Check for a match carried over from a previous line with a
* contained region. The match ends as soon as the region ends. */
for (int i = 0; i < current_state.ga_len; ++i) {
// Check for a match carried over from a previous line with a
// contained region. The match ends as soon as the region ends.
for (int i = 0; i < current_state.ga_len; i++) {
cur_si = &CUR_STATE(i);
if (cur_si->si_idx >= 0
&& (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) {
sp = NULL;
} else {
/* Take the first item from the free list and put it in the used
* list, after *sp */
// Take the first item from the free list and put it in the used
// list, after *sp
p = syn_block->b_sst_firstfree;
syn_block->b_sst_firstfree = p->sst_next;
--syn_block->b_sst_freecount;
@ -1359,8 +1359,8 @@ static synstate_T *store_current_state(void)
clear_syn_state(sp);
sp->sst_stacksize = current_state.ga_len;
if (current_state.ga_len > SST_FIX_STATES) {
/* Need to clear it, might be something remaining from when the
* length was less than SST_FIX_STATES. */
// Need to clear it, might be something remaining from when the
// length was less than SST_FIX_STATES.
ga_init(&sp->sst_union.sst_ga, (int)sizeof(bufstate_T), 1);
ga_grow(&sp->sst_union.sst_ga, 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) {
continue;
}
/* When the extmatch pointers are different, the strings in
* them can still be the same. Check if the extmatch
* references are equal. */
// When the extmatch pointers are different, the strings in
// them can still be the same. Check if the extmatch
// references are equal.
bsx = bp[i].bs_extmatch;
six = CUR_STATE(i).si_extmatch;
/* If one of the extmatch pointers is NULL the states are
* different. */
// If one of the extmatch pointers is NULL the states are
// different.
if (bsx == NULL || six == NULL) {
break;
}
int j;
for (j = 0; j < NSUBEXP; ++j) {
/* Check each referenced match string. They must all be
* equal. */
for (j = 0; j < NSUBEXP; j++) {
// Check each referenced match string. They must all be
// equal.
if (bsx->matches[j] != six->matches[j]) {
/* If the pointer is different it can still be the
* same text. Compare the strings, ignore case when
* the start item has the sp_ic flag set. */
// If the pointer is different it can still be the
// same text. Compare the strings, ignore case when
// the start item has the sp_ic flag set.
if (bsx->matches[j] == NULL || six->matches[j] == NULL) {
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_ic.ht_used > 0);
/* Init the list of zero-width matches with a nextlist. This is used to
* avoid matching the same item in the same position twice. */
// Init the list of zero-width matches with a nextlist. This is used to
// avoid matching the same item in the same position twice.
ga_init(&zero_width_next_ga, (int)sizeof(int), 10);
// 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,
cur_si->si_cont_list, &spp->sp_syn,
spp->sp_flags & HL_CONTAINED)))) {
/* If we already tried matching in this line, and
* there isn't a match before next_match_col, skip
* this item. */
// If we already tried matching in this line, and
// there isn't a match before next_match_col, skip
// this item.
if (spp->sp_line_id == current_line_id
&& spp->sp_startcol >= next_match_col) {
continue;
@ -2037,9 +2037,9 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
keep_next_list = true;
zero_width_next_list = true;
/* Add the index to a list, so that we can check
* later that we don't match it again (and cause an
* endless loop). */
// Add the index to a list, so that we can check
// later that we don't match it again (and cause an
// endless loop).
GA_APPEND(int, &zero_width_next_ga, next_match_idx);
next_match_idx = -1;
} 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);
}
} else {
/* The @Spell cluster is defined: Do spelling in items with
* the @Spell cluster. But not when @NoSpell is also there.
* At the toplevel only spell check when ":syn spell toplevel"
* was used. */
// The @Spell cluster is defined: Do spelling in items with
// the @Spell cluster. But not when @NoSpell is also there.
// At the toplevel only spell check when ":syn spell toplevel"
// was used.
if (current_trans_id == 0) {
*can_spell = (syn_block->b_syn_spell == SYNSPL_TOP);
} 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
* stack, and can only be matched once anyway. */
// Zero-width matches with a nextgroup argument are not put on the syntax
// stack, and can only be matched once anyway.
for (int i = gap->ga_len; --i >= 0; ) {
if (((int *)(gap->ga_data))[i] == idx) {
return true;
@ -2353,8 +2353,8 @@ static void check_state_ends(void)
next_match_col = MAXCOL;
break;
} else {
/* handle next_list, unless at end of line and no "skipnl" or
* "skipempty" */
// handle next_list, unless at end of line and no "skipnl" or
// "skipempty"
current_next_list = cur_si->si_next_list;
current_next_flags = cur_si->si_flags;
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;
goto end_do_tag;
}
/* We weren't at the bottom of the stack, so jump all the
* way to the bottom now.
*/
// We weren't at the bottom of the stack, so jump all the
// way to the bottom now.
tagstackidx = 0;
} else if (tagstackidx >= tagstacklen) { // count == 0?
EMSG(_(topmsg));
goto end_do_tag;
}
/* Make a copy of the fmark, autocommands may invalidate the
* tagstack before it's used. */
// Make a copy of the fmark, autocommands may invalidate the
// tagstack before it's used.
saved_fmark = tagstack[tagstackidx].fmark;
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
goto end_do_tag;
}
/* A BufReadPost autocommand may jump to the '" mark, but
* we don't what that here. */
// A BufReadPost autocommand may jump to the '" mark, but
// we don't what that here.
curwin->w_cursor.lnum = saved_fmark.mark.lnum;
} else {
setpcmark();
@ -488,9 +487,9 @@ int do_tag(char_u *tag, int type, int count, int forceit, int verbose)
// found: all matches found.
}
/* If there already were some matches for the same name, move them
* to the start. Avoids that the order changes when using
* ":tnext" and jumping to another file. */
// If there already were some matches for the same name, move them
// to the start. Avoids that the order changes when using
// ":tnext" and jumping to another file.
if (!new_tag && !other_name) {
int j, k;
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) {
/* Avoid giving this error when a file wasn't found and we're
* looking for a match in another file, which wasn't found.
* There will be an EMSG("file doesn't exist") below then. */
// Avoid giving this error when a file wasn't found and we're
// looking for a match in another file, which wasn't found.
// There will be an EMSG("file doesn't exist") below then.
if ((type == DT_NEXT || type == DT_FIRST)
&& nofile_fname == NULL) {
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);
} else {
/* We may have jumped to another window, check that
* tagstackidx is still valid. */
// We may have jumped to another window, check that
// tagstackidx is still valid.
if (use_tagstack && tagstackidx > curwin->w_tagstacklen) {
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
* for other languages. */
// When searching for a specific language skip tags files
// for other languages.
if (help_lang_find != NULL
&& STRICMP(help_lang, help_lang_find) != 0) {
continue;
}
/* For CTRL-] in a help file prefer a match with the same
* language. */
// For CTRL-] in a help file prefer a match with the same
// language.
if ((flags & TAG_KEEP_LANG)
&& help_lang_find == NULL
&& curbuf->b_fname != NULL
@ -2234,8 +2233,8 @@ parse_line:
tagname_free(&tn);
}
/* stop searching when already did a linear search, or when TAG_NOIC
* used, and 'ignorecase' not set or already did case-ignore search */
// stop searching when already did a linear search, or when TAG_NOIC
// used, and 'ignorecase' not set or already did case-ignore search
if (stop_searching || linear || (!p_ic && noic) || orgpat.regmatch.rm_ic) {
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) {
/* Not found in 'runtimepath', use 'helpfile', if it exists and
* wasn't used yet, replacing "help.txt" with "tags". */
// Not found in 'runtimepath', use 'helpfile', if it exists and
// wasn't used yet, replacing "help.txt" with "tags".
if (tnp->tn_hf_idx > tag_fnames.ga_len || *p_hf == NUL) {
return FAIL;
}
@ -2393,8 +2392,8 @@ int get_tagfname(tagname_T *tnp, int first, char_u *buf)
}
if (first) {
/* Init. We make a copy of 'tags', because autocommands may change
* the value without notifying us. */
// Init. We make a copy of 'tags', because autocommands may change
// the value without notifying us.
tnp->tn_tags = vim_strsave((*curbuf->b_p_tags != NUL)
? curbuf->b_p_tags : p_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, " ,");
r_ptr = vim_findfile_stopdir(buf);
/* move the filename one char forward and truncate the
* filepath with a NUL */
// move the filename one char forward and truncate the
// filepath with a NUL
filename = path_tail(buf);
STRMOVE(filename + 1, filename);
*filename++ = NUL;
@ -2790,8 +2789,8 @@ static int jumpto_tag(const char_u *lbuf_arg, int forceit, int keep_help)
}
if (keep_help) {
/* 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. */
// 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.
if (l_g_do_tagpreview != 0) {
keep_help_flag = curwin_save->w_buffer->b_help;
} 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_scs = save_p_scs;
/* A search command may have positioned the cursor beyond the end
* of the line. May need to correct that here. */
// A search command may have positioned the cursor beyond the end
// of the line. May need to correct that here.
check_cursor();
} else {
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);
}
if (ret == OK && !tagnames) {
/* Reorganize the tags for display and matching as strings of:
* "<tagname>\0<kind>\0<filename>\0"
*/
// Reorganize the tags for display and matching as strings of:
// "<tagname>\0<kind>\0<filename>\0"
for (i = 0; i < *num_file; i++) {
size_t len;
@ -3260,8 +3258,8 @@ int get_tags(list_T *list, char_u *pat, char_u *buf_fname)
char_u *s, *n;
int len;
/* Add extra field as a dict entry. Fields are
* separated by Tabs. */
// Add extra field as a dict entry. Fields are
// separated by Tabs.
n = p;
while (*p != NUL && *p >= ' ' && *p < 127 && *p != ':') {
++p;