0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

patch 8.1.2388: using old C style comments

Problem:    Using old C style comments.
Solution:   Use // comments where appropriate.
This commit is contained in:
Bram Moolenaar
2019-12-04 21:57:43 +01:00
parent 2ab2e8608f
commit 4ba37b5833
12 changed files with 1926 additions and 1930 deletions

View File

@@ -24,7 +24,7 @@
* There are marks 'A - 'Z (set by user) and '0 to '9 (set when writing
* viminfo).
*/
static xfmark_T namedfm[NMARKS + EXTRA_MARKS]; /* marks with file nr */
static xfmark_T namedfm[NMARKS + EXTRA_MARKS]; // marks with file nr
static void fname2fnum(xfmark_T *fm);
static void fmarks_check_one(xfmark_T *fm, char_u *name, buf_T *buf);
@@ -54,7 +54,7 @@ setmark_pos(int c, pos_T *pos, int fnum)
int i;
buf_T *buf;
/* Check for a special key (may cause islower() to crash). */
// Check for a special key (may cause islower() to crash).
if (c < 0)
return FAIL;
@@ -63,7 +63,7 @@ setmark_pos(int c, pos_T *pos, int fnum)
if (pos == &curwin->w_cursor)
{
setpcmark();
/* keep it even when the cursor doesn't move */
// keep it even when the cursor doesn't move
curwin->w_prev_pcmark = curwin->w_pcmark;
}
else
@@ -81,8 +81,8 @@ setmark_pos(int c, pos_T *pos, int fnum)
return OK;
}
/* Allow setting '[ and '] for an autocommand that simulates reading a
* file. */
// Allow setting '[ and '] for an autocommand that simulates reading a
// file.
if (c == '[')
{
buf->b_op_start = *pos;
@@ -101,7 +101,7 @@ setmark_pos(int c, pos_T *pos, int fnum)
else
buf->b_visual.vi_end = *pos;
if (buf->b_visual.vi_mode == NUL)
/* Visual_mode has not yet been set, use a sane default. */
// Visual_mode has not yet been set, use a sane default.
buf->b_visual.vi_mode = 'v';
return OK;
}
@@ -144,7 +144,7 @@ setpcmark(void)
xfmark_T tempmark;
#endif
/* for :global the mark is set only once */
// for :global the mark is set only once
if (global_busy || listcmd_busy || cmdmod.keepjumps)
return;
@@ -170,7 +170,7 @@ setpcmark(void)
}
# endif
/* If jumplist is full: remove oldest entry */
// If jumplist is full: remove oldest entry
if (++curwin->w_jumplistlen > JUMPLISTSIZE)
{
curwin->w_jumplistlen = JUMPLISTSIZE;
@@ -204,7 +204,7 @@ checkpcmark(void)
|| curwin->w_pcmark.lnum == 0))
{
curwin->w_pcmark = curwin->w_prev_pcmark;
curwin->w_prev_pcmark.lnum = 0; /* Show it has been checked */
curwin->w_prev_pcmark.lnum = 0; // Show it has been checked
}
}
@@ -220,7 +220,7 @@ movemark(int count)
cleanup_jumplist(curwin, TRUE);
if (curwin->w_jumplistlen == 0) /* nothing to jump to */
if (curwin->w_jumplistlen == 0) // nothing to jump to
return (pos_T *)NULL;
for (;;)
@@ -237,7 +237,7 @@ movemark(int count)
if (curwin->w_jumplistidx == curwin->w_jumplistlen)
{
setpcmark();
--curwin->w_jumplistidx; /* skip the new entry */
--curwin->w_jumplistidx; // skip the new entry
if (curwin->w_jumplistidx + count < 0)
return (pos_T *)NULL;
}
@@ -249,16 +249,16 @@ movemark(int count)
fname2fnum(jmp);
if (jmp->fmark.fnum != curbuf->b_fnum)
{
/* jump to other file */
// jump to other file
if (buflist_findnr(jmp->fmark.fnum) == NULL)
{ /* Skip this one .. */
{ // Skip this one ..
count += count < 0 ? -1 : 1;
continue;
}
if (buflist_getfile(jmp->fmark.fnum, jmp->fmark.mark.lnum,
0, FALSE) == FAIL)
return (pos_T *)NULL;
/* Set lnum again, autocommands my have changed it */
// Set lnum again, autocommands my have changed it
curwin->w_cursor = jmp->fmark.mark;
pos = (pos_T *)-1;
}
@@ -276,7 +276,7 @@ movechangelist(int count)
{
int n;
if (curbuf->b_changelistlen == 0) /* nothing to jump to */
if (curbuf->b_changelistlen == 0) // nothing to jump to
return (pos_T *)NULL;
n = curwin->w_changelistidx;
@@ -335,38 +335,38 @@ getmark_buf_fnum(
posp = NULL;
/* Check for special key, can't be a mark name and might cause islower()
* to crash. */
// Check for special key, can't be a mark name and might cause islower()
// to crash.
if (c < 0)
return posp;
#ifndef EBCDIC
if (c > '~') /* check for islower()/isupper() */
if (c > '~') // check for islower()/isupper()
;
else
#endif
if (c == '\'' || c == '`') /* previous context mark */
if (c == '\'' || c == '`') // previous context mark
{
pos_copy = curwin->w_pcmark; /* need to make a copy because */
posp = &pos_copy; /* w_pcmark may be changed soon */
pos_copy = curwin->w_pcmark; // need to make a copy because
posp = &pos_copy; // w_pcmark may be changed soon
}
else if (c == '"') /* to pos when leaving buffer */
else if (c == '"') // to pos when leaving buffer
posp = &(buf->b_last_cursor);
else if (c == '^') /* to where Insert mode stopped */
else if (c == '^') // to where Insert mode stopped
posp = &(buf->b_last_insert);
else if (c == '.') /* to where last change was made */
else if (c == '.') // to where last change was made
posp = &(buf->b_last_change);
else if (c == '[') /* to start of previous operator */
else if (c == '[') // to start of previous operator
posp = &(buf->b_op_start);
else if (c == ']') /* to end of previous operator */
else if (c == ']') // to end of previous operator
posp = &(buf->b_op_end);
else if (c == '{' || c == '}') /* to previous/next paragraph */
else if (c == '{' || c == '}') // to previous/next paragraph
{
pos_T pos;
oparg_T oa;
int slcb = listcmd_busy;
pos = curwin->w_cursor;
listcmd_busy = TRUE; /* avoid that '' is changed */
listcmd_busy = TRUE; // avoid that '' is changed
if (findpar(&oa.inclusive,
c == '}' ? FORWARD : BACKWARD, 1L, NUL, FALSE))
{
@@ -376,13 +376,13 @@ getmark_buf_fnum(
curwin->w_cursor = pos;
listcmd_busy = slcb;
}
else if (c == '(' || c == ')') /* to previous/next sentence */
else if (c == '(' || c == ')') // to previous/next sentence
{
pos_T pos;
int slcb = listcmd_busy;
pos = curwin->w_cursor;
listcmd_busy = TRUE; /* avoid that '' is changed */
listcmd_busy = TRUE; // avoid that '' is changed
if (findsent(c == ')' ? FORWARD : BACKWARD, 1L))
{
pos_copy = curwin->w_cursor;
@@ -391,7 +391,7 @@ getmark_buf_fnum(
curwin->w_cursor = pos;
listcmd_busy = slcb;
}
else if (c == '<' || c == '>') /* start/end of visual area */
else if (c == '<' || c == '>') // start/end of visual area
{
startp = &buf->b_visual.vi_start;
endp = &buf->b_visual.vi_end;
@@ -414,11 +414,11 @@ getmark_buf_fnum(
pos_copy.coladd = 0;
}
}
else if (ASCII_ISLOWER(c)) /* normal named mark */
else if (ASCII_ISLOWER(c)) // normal named mark
{
posp = &(buf->b_namedm[c - 'a']);
}
else if (ASCII_ISUPPER(c) || VIM_ISDIGIT(c)) /* named file mark */
else if (ASCII_ISUPPER(c) || VIM_ISDIGIT(c)) // named file mark
{
if (VIM_ISDIGIT(c))
c = c - '0' + NMARKS;
@@ -433,7 +433,7 @@ getmark_buf_fnum(
*fnum = namedfm[c].fmark.fnum;
else if (namedfm[c].fmark.fnum != buf->b_fnum)
{
/* mark is in another file */
// mark is in another file
posp = &pos_copy;
if (namedfm[c].fmark.mark.lnum != 0
@@ -442,15 +442,15 @@ getmark_buf_fnum(
if (buflist_getfile(namedfm[c].fmark.fnum,
(linenr_T)1, GETF_SETMARK, FALSE) == OK)
{
/* Set the lnum now, autocommands could have changed it */
// Set the lnum now, autocommands could have changed it
curwin->w_cursor = namedfm[c].fmark.mark;
return (pos_T *)-1;
}
pos_copy.lnum = -1; /* can't get file */
pos_copy.lnum = -1; // can't get file
}
else
pos_copy.lnum = 0; /* mark exists, but is not valid in
current buffer */
pos_copy.lnum = 0; // mark exists, but is not valid in
// current buffer
}
}
@@ -464,8 +464,8 @@ getmark_buf_fnum(
*/
pos_T *
getnextmark(
pos_T *startpos, /* where to start */
int dir, /* direction for search */
pos_T *startpos, // where to start
int dir, // direction for search
int begin_line)
{
int i;
@@ -474,10 +474,10 @@ getnextmark(
pos = *startpos;
/* When searching backward and leaving the cursor on the first non-blank,
* position must be in a previous line.
* When searching forward and leaving the cursor on the first non-blank,
* position must be in a next line. */
// When searching backward and leaving the cursor on the first non-blank,
// position must be in a previous line.
// When searching forward and leaving the cursor on the first non-blank,
// position must be in a next line.
if (dir == BACKWARD && begin_line)
pos.col = 0;
else if (dir == FORWARD && begin_line)
@@ -536,11 +536,11 @@ fname2fnum(xfmark_T *fm)
else
vim_strncpy(NameBuff, fm->fname, MAXPATHL - 1);
/* Try to shorten the file name. */
// Try to shorten the file name.
mch_dirname(IObuff, IOSIZE);
p = shorten_fname(NameBuff, IObuff);
/* buflist_new() will call fmarks_check_names() */
// buflist_new() will call fmarks_check_names()
(void)buflist_new(NameBuff, p, (linenr_T)1, 0);
}
}
@@ -606,8 +606,8 @@ check_mark(pos_T *pos)
}
if (pos->lnum <= 0)
{
/* lnum is negative if mark is in another file can can't get that
* file, error message already give then. */
// lnum is negative if mark is in another file can can't get that
// file, error message already give then.
if (pos->lnum == 0)
emsg(_(e_marknotset));
return FAIL;
@@ -630,7 +630,7 @@ clrallmarks(buf_T *buf)
{
static int i = -1;
if (i == -1) /* first call ever: initialize */
if (i == -1) // first call ever: initialize
for (i = 0; i < NMARKS + 1; i++)
{
namedfm[i].fmark.mark.lnum = 0;
@@ -642,13 +642,13 @@ clrallmarks(buf_T *buf)
for (i = 0; i < NMARKS; i++)
buf->b_namedm[i].lnum = 0;
buf->b_op_start.lnum = 0; /* start/end op mark cleared */
buf->b_op_start.lnum = 0; // start/end op mark cleared
buf->b_op_end.lnum = 0;
buf->b_last_cursor.lnum = 1; /* '" mark cleared */
buf->b_last_cursor.lnum = 1; // '" mark cleared
buf->b_last_cursor.col = 0;
buf->b_last_cursor.coladd = 0;
buf->b_last_insert.lnum = 0; /* '^ mark cleared */
buf->b_last_change.lnum = 0; /* '. mark cleared */
buf->b_last_insert.lnum = 0; // '^ mark cleared
buf->b_last_change.lnum = 0; // '. mark cleared
#ifdef FEAT_JUMPLIST
buf->b_changelistlen = 0;
#endif
@@ -662,7 +662,7 @@ clrallmarks(buf_T *buf)
char_u *
fm_getname(fmark_T *fmark, int lead_len)
{
if (fmark->fnum == curbuf->b_fnum) /* current buffer */
if (fmark->fnum == curbuf->b_fnum) // current buffer
return mark_line(&(fmark->mark), lead_len);
return buflist_nr2name(fmark->fnum, FALSE, TRUE);
}
@@ -742,13 +742,13 @@ show_one_mark(
char_u *arg,
pos_T *p,
char_u *name_arg,
int current) /* in current file */
int current) // in current file
{
static int did_title = FALSE;
int mustfree = FALSE;
char_u *name = name_arg;
if (c == -1) /* finish up */
if (c == -1) // finish up
{
if (did_title)
did_title = FALSE;
@@ -809,7 +809,7 @@ ex_delmarks(exarg_T *eap)
int n;
if (*eap->arg == NUL && eap->forceit)
/* clear all marks */
// clear all marks
clrallmarks(curbuf);
else if (eap->forceit)
emsg(_(e_invarg));
@@ -817,7 +817,7 @@ ex_delmarks(exarg_T *eap)
emsg(_(e_argreq));
else
{
/* clear specified marks only */
// clear specified marks only
for (p = eap->arg; *p != NUL; ++p)
{
lower = ASCII_ISLOWER(*p);
@@ -826,7 +826,7 @@ ex_delmarks(exarg_T *eap)
{
if (p[1] == '-')
{
/* clear range of marks */
// clear range of marks
from = *p;
to = p[2];
if (!(lower ? ASCII_ISLOWER(p[2])
@@ -840,7 +840,7 @@ ex_delmarks(exarg_T *eap)
p += 2;
}
else
/* clear one lower case mark */
// clear one lower case mark
from = to = *p;
for (i = from; i <= to; ++i)
@@ -891,7 +891,7 @@ ex_jumps(exarg_T *eap UNUSED)
cleanup_jumplist(curwin, TRUE);
/* Highlight title */
// Highlight title
msg_puts_title(_("\n jump line col file/text"));
for (i = 0; i < curwin->w_jumplistlen && !got_int; ++i)
{
@@ -948,7 +948,7 @@ ex_changes(exarg_T *eap UNUSED)
int i;
char_u *name;
/* Highlight title */
// Highlight title
msg_puts_title(_("\nchange line col text"));
for (i = 0; i < curbuf->b_changelistlen && !got_int; ++i)
@@ -993,7 +993,7 @@ ex_changes(exarg_T *eap UNUSED)
*lp += amount_after; \
}
/* don't delete the line, just put at first deleted line */
// don't delete the line, just put at first deleted line
#define one_adjust_nodel(add) \
{ \
lp = add; \
@@ -1054,12 +1054,12 @@ mark_adjust_internal(
tabpage_T *tab;
static pos_T initpos = {1, 0, 0};
if (line2 < line1 && amount_after == 0L) /* nothing to do */
if (line2 < line1 && amount_after == 0L) // nothing to do
return;
if (!cmdmod.lockmarks)
{
/* named marks, lower case and upper case */
// named marks, lower case and upper case
for (i = 0; i < NMARKS; i++)
{
one_adjust(&(curbuf->b_namedm[i].lnum));
@@ -1072,31 +1072,31 @@ mark_adjust_internal(
one_adjust_nodel(&(namedfm[i].fmark.mark.lnum));
}
/* last Insert position */
// last Insert position
one_adjust(&(curbuf->b_last_insert.lnum));
/* last change position */
// last change position
one_adjust(&(curbuf->b_last_change.lnum));
/* last cursor position, if it was set */
// last cursor position, if it was set
if (!EQUAL_POS(curbuf->b_last_cursor, initpos))
one_adjust(&(curbuf->b_last_cursor.lnum));
#ifdef FEAT_JUMPLIST
/* list of change positions */
// list of change positions
for (i = 0; i < curbuf->b_changelistlen; ++i)
one_adjust_nodel(&(curbuf->b_changelist[i].lnum));
#endif
/* Visual area */
// Visual area
one_adjust_nodel(&(curbuf->b_visual.vi_start.lnum));
one_adjust_nodel(&(curbuf->b_visual.vi_end.lnum));
#ifdef FEAT_QUICKFIX
/* quickfix marks */
// quickfix marks
qf_mark_adjust(NULL, line1, line2, amount, amount_after);
/* location lists */
// location lists
FOR_ALL_TAB_WINDOWS(tab, win)
qf_mark_adjust(win, line1, line2, amount, amount_after);
#endif
@@ -1106,13 +1106,13 @@ mark_adjust_internal(
#endif
}
/* previous context mark */
// previous context mark
one_adjust(&(curwin->w_pcmark.lnum));
/* previous pcmark */
// previous pcmark
one_adjust(&(curwin->w_prev_pcmark.lnum));
/* saved cursor for formatting */
// saved cursor for formatting
if (saved_cursor.lnum != 0)
one_adjust_nodel(&(saved_cursor.lnum));
@@ -1123,8 +1123,8 @@ mark_adjust_internal(
{
#ifdef FEAT_JUMPLIST
if (!cmdmod.lockmarks)
/* Marks in the jumplist. When deleting lines, this may create
* duplicate marks in the jumplist, they will be removed later. */
// Marks in the jumplist. When deleting lines, this may create
// duplicate marks in the jumplist, they will be removed later.
for (i = 0; i < win->w_jumplistlen; ++i)
if (win->w_jumplist[i].fmark.fnum == fnum)
one_adjust_nodel(&(win->w_jumplist[i].fmark.mark.lnum));
@@ -1133,32 +1133,32 @@ mark_adjust_internal(
if (win->w_buffer == curbuf)
{
if (!cmdmod.lockmarks)
/* marks in the tag stack */
// marks in the tag stack
for (i = 0; i < win->w_tagstacklen; i++)
if (win->w_tagstack[i].fmark.fnum == fnum)
one_adjust_nodel(&(win->w_tagstack[i].fmark.mark.lnum));
/* the displayed Visual area */
// the displayed Visual area
if (win->w_old_cursor_lnum != 0)
{
one_adjust_nodel(&(win->w_old_cursor_lnum));
one_adjust_nodel(&(win->w_old_visual_lnum));
}
/* topline and cursor position for windows with the same buffer
* other than the current window */
// topline and cursor position for windows with the same buffer
// other than the current window
if (win != curwin)
{
if (win->w_topline >= line1 && win->w_topline <= line2)
{
if (amount == MAXLNUM) /* topline is deleted */
if (amount == MAXLNUM) // topline is deleted
{
if (line1 <= 1)
win->w_topline = 1;
else
win->w_topline = line1 - 1;
}
else /* keep topline on the same line */
else // keep topline on the same line
win->w_topline += amount;
#ifdef FEAT_DIFF
win->w_topfill = 0;
@@ -1173,7 +1173,7 @@ mark_adjust_internal(
}
if (win->w_cursor.lnum >= line1 && win->w_cursor.lnum <= line2)
{
if (amount == MAXLNUM) /* line with cursor is deleted */
if (amount == MAXLNUM) // line with cursor is deleted
{
if (line1 <= 1)
win->w_cursor.lnum = 1;
@@ -1181,7 +1181,7 @@ mark_adjust_internal(
win->w_cursor.lnum = line1 - 1;
win->w_cursor.col = 0;
}
else /* keep cursor on the same line */
else // keep cursor on the same line
win->w_cursor.lnum += amount;
}
else if (amount_after && win->w_cursor.lnum > line2)
@@ -1189,7 +1189,7 @@ mark_adjust_internal(
}
#ifdef FEAT_FOLDING
/* adjust folds */
// adjust folds
if (adjust_folds)
foldMarkAdjust(win, line1, line2, amount, amount_after);
#endif
@@ -1197,12 +1197,12 @@ mark_adjust_internal(
}
#ifdef FEAT_DIFF
/* adjust diffs */
// adjust diffs
diff_mark_adjust(line1, line2, amount, amount_after);
#endif
}
/* This code is used often, needs to be fast. */
// This code is used often, needs to be fast.
#define col_adjust(pp) \
{ \
posp = pp; \
@@ -1239,9 +1239,9 @@ mark_col_adjust(
pos_T *posp;
if ((col_amount == 0L && lnum_amount == 0L) || cmdmod.lockmarks)
return; /* nothing to do */
return; // nothing to do
/* named marks, lower case and upper case */
// named marks, lower case and upper case
for (i = 0; i < NMARKS; i++)
{
col_adjust(&(curbuf->b_namedm[i]));
@@ -1254,29 +1254,29 @@ mark_col_adjust(
col_adjust(&(namedfm[i].fmark.mark));
}
/* last Insert position */
// last Insert position
col_adjust(&(curbuf->b_last_insert));
/* last change position */
// last change position
col_adjust(&(curbuf->b_last_change));
#ifdef FEAT_JUMPLIST
/* list of change positions */
// list of change positions
for (i = 0; i < curbuf->b_changelistlen; ++i)
col_adjust(&(curbuf->b_changelist[i]));
#endif
/* Visual area */
// Visual area
col_adjust(&(curbuf->b_visual.vi_start));
col_adjust(&(curbuf->b_visual.vi_end));
/* previous context mark */
// previous context mark
col_adjust(&(curwin->w_pcmark));
/* previous pcmark */
// previous pcmark
col_adjust(&(curwin->w_prev_pcmark));
/* saved cursor for formatting */
// saved cursor for formatting
col_adjust(&saved_cursor);
/*
@@ -1285,7 +1285,7 @@ mark_col_adjust(
FOR_ALL_WINDOWS(win)
{
#ifdef FEAT_JUMPLIST
/* marks in the jumplist */
// marks in the jumplist
for (i = 0; i < win->w_jumplistlen; ++i)
if (win->w_jumplist[i].fmark.fnum == fnum)
col_adjust(&(win->w_jumplist[i].fmark.mark));
@@ -1293,12 +1293,12 @@ mark_col_adjust(
if (win->w_buffer == curbuf)
{
/* marks in the tag stack */
// marks in the tag stack
for (i = 0; i < win->w_tagstacklen; i++)
if (win->w_tagstack[i].fmark.fnum == fnum)
col_adjust(&(win->w_tagstack[i].fmark.mark));
/* cursor position for other windows with the same buffer */
// cursor position for other windows with the same buffer
if (win != curwin)
col_adjust(&win->w_cursor);
}
@@ -1320,9 +1320,9 @@ cleanup_jumplist(win_T *wp, int loadfiles)
if (loadfiles)
{
/* If specified, load all the files from the jump list. This is
* needed to properly clean up duplicate entries, but will take some
* time. */
// If specified, load all the files from the jump list. This is
// needed to properly clean up duplicate entries, but will take some
// time.
for (i = 0; i < wp->w_jumplistlen; ++i)
{
if ((wp->w_jumplist[i].fmark.fnum == 0) &&
@@ -1343,7 +1343,7 @@ cleanup_jumplist(win_T *wp, int loadfiles)
&& wp->w_jumplist[i].fmark.mark.lnum
== wp->w_jumplist[from].fmark.mark.lnum)
break;
if (i >= wp->w_jumplistlen) /* no duplicate */
if (i >= wp->w_jumplistlen) // no duplicate
wp->w_jumplist[to++] = wp->w_jumplist[from];
else
vim_free(wp->w_jumplist[from].fname);
@@ -1382,7 +1382,7 @@ free_jumplist(win_T *wp)
for (i = 0; i < wp->w_jumplistlen; ++i)
vim_free(wp->w_jumplist[i].fname);
}
#endif /* FEAT_JUMPLIST */
#endif // FEAT_JUMPLIST
void
set_last_cursor(win_T *win)