vim-patch:8.1.2379: using old C style comments

Problem:    Using old C style comments.
Solution:   Use // comments where appropriate.
217e1b8359
This commit is contained in:
Dundar Göc 2021-10-06 10:46:45 +02:00
parent 3b3e2244db
commit 0c7d7fb45d
6 changed files with 310 additions and 313 deletions

View File

@ -361,8 +361,8 @@ static int linelen(int *has_tab)
return len; return len;
} }
/* Buffer for two lines used during sorting. They are allocated to // Buffer for two lines used during sorting. They are allocated to
* contain the longest line being sorted. */ // contain the longest line being sorted.
static char_u *sortbuf1; static char_u *sortbuf1;
static char_u *sortbuf2; static char_u *sortbuf2;
@ -404,9 +404,9 @@ static int sort_compare(const void *s1, const void *s2)
sorti_T l2 = *(sorti_T *)s2; sorti_T l2 = *(sorti_T *)s2;
int result = 0; int result = 0;
/* If the user interrupts, there's no way to stop qsort() immediately, but // If the user interrupts, there's no way to stop qsort() immediately, but
* if we return 0 every time, qsort will assume it's done sorting and // if we return 0 every time, qsort will assume it's done sorting and
* exit. */ // exit.
if (sort_abort) { if (sort_abort) {
return 0; return 0;
} }
@ -1733,8 +1733,8 @@ int rename_buffer(char_u *new_fname)
*/ */
void ex_file(exarg_T *eap) void ex_file(exarg_T *eap)
{ {
/* ":0file" removes the file name. Check for illegal uses ":3file", // ":0file" removes the file name. Check for illegal uses ":3file",
* "0file name", etc. */ // "0file name", etc.
if (eap->addr_count > 0 if (eap->addr_count > 0
&& (*eap->arg != NUL && (*eap->arg != NUL
|| eap->line2 > 0 || eap->line2 > 0
@ -1888,11 +1888,11 @@ int do_write(exarg_T *eap)
retval = FAIL; retval = FAIL;
goto theend; goto theend;
} }
/* Exchange the file names for the current and the alternate // Exchange the file names for the current and the alternate
* buffer. This makes it look like we are now editing the buffer // buffer. This makes it look like we are now editing the buffer
* under the new name. Must be done before buf_write(), because // under the new name. Must be done before buf_write(), because
* if there is no file name and 'cpo' contains 'F', it will set // if there is no file name and 'cpo' contains 'F', it will set
* the file name. */ // the file name.
fname = alt_buf->b_fname; fname = alt_buf->b_fname;
alt_buf->b_fname = curbuf->b_fname; alt_buf->b_fname = curbuf->b_fname;
curbuf->b_fname = fname; curbuf->b_fname = fname;
@ -1923,8 +1923,8 @@ int do_write(exarg_T *eap)
do_modelines(0); do_modelines(0);
} }
/* Autocommands may have changed buffer names, esp. when // Autocommands may have changed buffer names, esp. when
* 'autochdir' is set. */ // 'autochdir' is set.
fname = curbuf->b_sfname; fname = curbuf->b_sfname;
} }
@ -2003,11 +2003,11 @@ int check_overwrite(exarg_T *eap, buf_T *buf, char_u *fname, char_u *ffname, int
char_u *p; char_u *p;
char_u *swapname; char_u *swapname;
/* We only try the first entry in 'directory', without checking if // We only try the first entry in 'directory', without checking if
* it's writable. If the "." directory is not writable the write // it's writable. If the "." directory is not writable the write
* will probably fail anyway. // will probably fail anyway.
* Use 'shortname' of the current buffer, since there is no buffer // Use 'shortname' of the current buffer, since there is no buffer
* for the written file. */ // for the written file.
if (*p_dir == NUL) { if (*p_dir == NUL) {
dir = xmalloc(5); dir = xmalloc(5);
STRCPY(dir, "."); STRCPY(dir, ".");
@ -2466,8 +2466,8 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
} }
} }
/* May jump to last used line number for a loaded buffer or when asked // May jump to last used line number for a loaded buffer or when asked
* for explicitly */ // for explicitly
if ((oldbuf && newlnum == ECMD_LASTL) || newlnum == ECMD_LAST) { if ((oldbuf && newlnum == ECMD_LASTL) || newlnum == ECMD_LAST) {
pos = buflist_findfpos(buf); pos = buflist_findfpos(buf);
newlnum = pos->lnum; newlnum = pos->lnum;
@ -2577,10 +2577,10 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
} }
} }
/* May get the window options from the last time this buffer // May get the window options from the last time this buffer
* was in this window (or another window). If not used // was in this window (or another window). If not used
* before, reset the local window options to the global // before, reset the local window options to the global
* values. Also restores old folding stuff. */ // values. Also restores old folding stuff.
get_winopts(curbuf); get_winopts(curbuf);
did_get_winopts = true; did_get_winopts = true;
} }
@ -2621,10 +2621,10 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
goto theend; goto theend;
} }
/* Since we are starting to edit a file, consider the filetype to be // Since we are starting to edit a file, consider the filetype to be
* unset. Helps for when an autocommand changes files and expects syntax // unset. Helps for when an autocommand changes files and expects syntax
* highlighting to work in the other file. */ // highlighting to work in the other file.
did_filetype = FALSE; did_filetype = false;
/* /*
* other_file oldbuf * other_file oldbuf
@ -2828,8 +2828,8 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
&& !auto_buf) { && !auto_buf) {
int msg_scroll_save = msg_scroll; int msg_scroll_save = msg_scroll;
/* Obey the 'O' flag in 'cpoptions': overwrite any previous file // Obey the 'O' flag in 'cpoptions': overwrite any previous file
* message. */ // message.
if (shortmess(SHM_OVERALL) && !exiting && p_verbose == 0) { if (shortmess(SHM_OVERALL) && !exiting && p_verbose == 0) {
msg_scroll = FALSE; msg_scroll = FALSE;
} }
@ -2953,8 +2953,8 @@ void ex_append(exarg_T *eap)
} }
} }
if (eap->getline == NULL) { if (eap->getline == NULL) {
/* No getline() function, use the lines that follow. This ends // No getline() function, use the lines that follow. This ends
* when there is no more. */ // when there is no more.
if (eap->nextcmd == NULL || *eap->nextcmd == NUL) { if (eap->nextcmd == NULL || *eap->nextcmd == NUL) {
break; break;
} }
@ -3750,8 +3750,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
sub_firstline = vim_strsave(ml_get(sub_firstlnum)); sub_firstline = vim_strsave(ml_get(sub_firstlnum));
} }
/* Save the line number of the last change for the final // Save the line number of the last change for the final
* cursor position (just like Vi). */ // cursor position (just like Vi).
curwin->w_cursor.lnum = lnum; curwin->w_cursor.lnum = lnum;
do_again = FALSE; do_again = FALSE;
@ -3778,8 +3778,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
goto skip; goto skip;
} }
/* Normally we continue searching for a match just after the // Normally we continue searching for a match just after the
* previous match. */ // previous match.
matchcol = regmatch.endpos[0].col; matchcol = regmatch.endpos[0].col;
prev_matchcol = matchcol; prev_matchcol = matchcol;
@ -3818,8 +3818,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
do_check_cursorbind(); do_check_cursorbind();
} }
/* When 'cpoptions' contains "u" don't sync undo when // When 'cpoptions' contains "u" don't sync undo when
* asking for confirmation. */ // asking for confirmation.
if (vim_strchr(p_cpo, CPO_UNDO) != NULL) { if (vim_strchr(p_cpo, CPO_UNDO) != NULL) {
++no_u_sync; ++no_u_sync;
} }
@ -3970,11 +3970,11 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
} }
if (typed == 'n') { if (typed == 'n') {
/* For a multi-line match, put matchcol at the NUL at // For a multi-line match, put matchcol at the NUL at
* the end of the line and set nmatch to one, so that // the end of the line and set nmatch to one, so that
* we continue looking for a match on the next line. // we continue looking for a match on the next line.
* Avoids that ":%s/\nB\@=//gc" and ":%s/\n/,\r/gc" // Avoids that ":%s/\nB\@=//gc" and ":%s/\n/,\r/gc"
* get stuck when pressing 'n'. */ // get stuck when pressing 'n'.
if (nmatch > 1) { if (nmatch > 1) {
matchcol = (colnr_T)STRLEN(sub_firstline); matchcol = (colnr_T)STRLEN(sub_firstline);
skip_match = true; skip_match = true;
@ -3986,8 +3986,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
} }
} }
/* Move the cursor to the start of the match, so that we can // Move the cursor to the start of the match, so that we can
* use "\=col("."). */ // use "\=col(".").
curwin->w_cursor.col = regmatch.startpos[0].col; curwin->w_cursor.col = regmatch.startpos[0].col;
// When the match included the "$" of the last line it may // When the match included the "$" of the last line it may
@ -4178,11 +4178,11 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
// strings, e.g. :s/$/pat/g or :s/[a-z]* /(&)/g. // strings, e.g. :s/$/pat/g or :s/[a-z]* /(&)/g.
// But ":s/\n/#/" is OK. // But ":s/\n/#/" is OK.
skip: skip:
/* We already know that we did the last subst when we are at // We already know that we did the last subst when we are at
* the end of the line, except that a pattern like // the end of the line, except that a pattern like
* "bar\|\nfoo" may match at the NUL. "lnum" can be below // "bar\|\nfoo" may match at the NUL. "lnum" can be below
* "line2" when there is a \zs in the pattern after a line // "line2" when there is a \zs in the pattern after a line
* break. */ // break.
lastone = (skip_match lastone = (skip_match
|| got_int || got_int
|| got_quit || got_quit
@ -4249,8 +4249,8 @@ skip:
nmatch_tl = 0; nmatch_tl = 0;
} }
/* When asking, undo is saved each time, must also set // When asking, undo is saved each time, must also set
* changed flag each time. */ // changed flag each time.
if (subflags.do_ask) { if (subflags.do_ask) {
changed_bytes(lnum, 0); changed_bytes(lnum, 0);
} else { } else {
@ -4278,9 +4278,9 @@ skip:
* 5. break if there isn't another match in this line * 5. break if there isn't another match in this line
*/ */
if (nmatch <= 0) { if (nmatch <= 0) {
/* If the match found didn't start where we were // If the match found didn't start where we were
* searching, do the next search in the line where we // searching, do the next search in the line where we
* found the match. */ // found the match.
if (nmatch == -1) { if (nmatch == -1) {
lnum -= regmatch.startpos[0].lnum; lnum -= regmatch.startpos[0].lnum;
} }
@ -4329,9 +4329,9 @@ skip:
curbuf->deleted_bytes2 = 0; curbuf->deleted_bytes2 = 0;
if (first_line != 0) { if (first_line != 0) {
/* Need to subtract the number of added lines from "last_line" to get // Need to subtract the number of added lines from "last_line" to get
* the line number before the change (same as adding the number of // the line number before the change (same as adding the number of
* deleted lines). */ // deleted lines).
i = curbuf->b_ml.ml_line_count - old_line_count; i = curbuf->b_ml.ml_line_count - old_line_count;
changed_lines(first_line, 0, last_line - i, i, false); changed_lines(first_line, 0, last_line - i, i, false);
@ -4842,9 +4842,9 @@ void ex_help(exarg_T *eap)
} }
fclose(helpfd); fclose(helpfd);
/* Split off help window; put it at far top if no position // Split off help window; put it at far top if no position
* specified, the current window is vertically split and // specified, the current window is vertically split and
* narrow. */ // narrow.
n = WSP_HELP; n = WSP_HELP;
if (cmdmod.split == 0 && curwin->w_width != Columns if (cmdmod.split == 0 && curwin->w_width != Columns
&& curwin->w_width < 80) { && curwin->w_width < 80) {
@ -4884,9 +4884,9 @@ void ex_help(exarg_T *eap)
do_tag(tag, DT_HELP, 1, FALSE, TRUE); do_tag(tag, DT_HELP, 1, FALSE, TRUE);
/* Delete the empty buffer if we're not using it. Careful: autocommands // Delete the empty buffer if we're not using it. Careful: autocommands
* may have jumped to another window, check that the buffer is not in a // may have jumped to another window, check that the buffer is not in a
* window. */ // window.
if (empty_fnum != 0 && curbuf->b_fnum != empty_fnum) { if (empty_fnum != 0 && curbuf->b_fnum != empty_fnum) {
buf = buflist_findnr(empty_fnum); buf = buflist_findnr(empty_fnum);
if (buf != NULL && buf->b_nwindows == 0) { if (buf != NULL && buf->b_nwindows == 0) {
@ -5057,11 +5057,11 @@ int find_help_tags(const char_u *arg, int *num_matches, char_u ***matches, bool
} }
if (i < 0) { // no match in table if (i < 0) { // no match in table
/* Replace "\S" with "/\\S", etc. Otherwise every tag is matched. // Replace "\S" with "/\\S", etc. Otherwise every tag is matched.
* Also replace "\%^" and "\%(", they match every tag too. // Also replace "\%^" and "\%(", they match every tag too.
* Also "\zs", "\z1", etc. // Also "\zs", "\z1", etc.
* Also "\@<", "\@=", "\@<=", etc. // Also "\@<", "\@=", "\@<=", etc.
* And also "\_$" and "\_^". */ // And also "\_$" and "\_^".
if (arg[0] == '\\' if (arg[0] == '\\'
&& ((arg[1] != NUL && arg[2] == NUL) && ((arg[1] != NUL && arg[2] == NUL)
|| (vim_strchr((char_u *)"%_z@", arg[1]) != NULL || (vim_strchr((char_u *)"%_z@", arg[1]) != NULL
@ -5158,8 +5158,8 @@ int find_help_tags(const char_u *arg, int *num_matches, char_u ***matches, bool
*d++ = '\\'; *d++ = '\\';
} }
/* "CTRL-\_" -> "CTRL-\\_" to avoid the special meaning of "\_" in // "CTRL-\_" -> "CTRL-\\_" to avoid the special meaning of "\_" in
* "CTRL-\_CTRL-N" */ // "CTRL-\_CTRL-N"
if (STRNICMP(s, "CTRL-\\_", 7) == 0) { if (STRNICMP(s, "CTRL-\\_", 7) == 0) {
STRCPY(d, "CTRL-\\\\"); STRCPY(d, "CTRL-\\\\");
d += 7; d += 7;
@ -5213,8 +5213,8 @@ int find_help_tags(const char_u *arg, int *num_matches, char_u ***matches, bool
} }
if (find_tags(IObuff, num_matches, matches, flags, MAXCOL, NULL) == OK if (find_tags(IObuff, num_matches, matches, flags, MAXCOL, NULL) == OK
&& *num_matches > 0) { && *num_matches > 0) {
/* Sort the matches found on the heuristic number that is after the // Sort the matches found on the heuristic number that is after the
* tag name. */ // tag name.
qsort((void *)*matches, (size_t)*num_matches, qsort((void *)*matches, (size_t)*num_matches,
sizeof(char_u *), help_compare); sizeof(char_u *), help_compare);
// Delete more than TAG_MANY to reduce the size of the listing. // Delete more than TAG_MANY to reduce the size of the listing.

View File

@ -197,8 +197,8 @@ void do_exmode(void)
exmode_active = true; exmode_active = true;
State = NORMAL; State = NORMAL;
/* When using ":global /pat/ visual" and then "Q" we return to continue // When using ":global /pat/ visual" and then "Q" we return to continue
* the :global command. */ // the :global command.
if (global_busy) { if (global_busy) {
return; return;
} }
@ -231,8 +231,8 @@ void do_exmode(void)
EMSG(_(e_emptybuf)); EMSG(_(e_emptybuf));
} else { } else {
if (ex_pressedreturn) { if (ex_pressedreturn) {
/* go up one line, to overwrite the ":<CR>" line, so the // go up one line, to overwrite the ":<CR>" line, so the
* output doesn't contain empty lines. */ // output doesn't contain empty lines.
msg_row = prev_msg_row; msg_row = prev_msg_row;
if (prev_msg_row == Rows - 1) { if (prev_msg_row == Rows - 1) {
msg_row--; msg_row--;
@ -374,8 +374,8 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
++ex_nesting_level; ++ex_nesting_level;
} }
/* Get the function or script name and the address where the next breakpoint // Get the function or script name and the address where the next breakpoint
* line and the debug tick for a function or script are stored. */ // line and the debug tick for a function or script are stored.
if (getline_is_func) { if (getline_is_func) {
fname = func_name(real_cookie); fname = func_name(real_cookie);
breakpoint = func_breakpoint(real_cookie); breakpoint = func_breakpoint(real_cookie);
@ -500,11 +500,11 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
} }
if (cstack.cs_looplevel > 0) { if (cstack.cs_looplevel > 0) {
/* Inside a while/for loop we need to store the lines and use them // Inside a while/for loop we need to store the lines and use them
* again. Pass a different "fgetline" function to do_one_cmd() // again. Pass a different "fgetline" function to do_one_cmd()
* below, so that it stores lines in or reads them from // below, so that it stores lines in or reads them from
* "lines_ga". Makes it possible to define a function inside a // "lines_ga". Makes it possible to define a function inside a
* while/for loop. */ // while/for loop.
cmd_getline = get_loop_line; cmd_getline = get_loop_line;
cmd_cookie = (void *)&cmd_loop_cookie; cmd_cookie = (void *)&cmd_loop_cookie;
cmd_loop_cookie.lines_gap = &lines_ga; cmd_loop_cookie.lines_gap = &lines_ga;
@ -612,8 +612,8 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
} }
if (cmd_cookie == (void *)&cmd_loop_cookie) { if (cmd_cookie == (void *)&cmd_loop_cookie) {
/* Use "current_line" from "cmd_loop_cookie", it may have been // Use "current_line" from "cmd_loop_cookie", it may have been
* incremented when defining a function. */ // incremented when defining a function.
current_line = cmd_loop_cookie.current_line; current_line = cmd_loop_cookie.current_line;
} }
@ -671,8 +671,8 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
cstack.cs_lflags |= CSL_HAD_LOOP; cstack.cs_lflags |= CSL_HAD_LOOP;
line_breakcheck(); // check if CTRL-C typed line_breakcheck(); // check if CTRL-C typed
/* Check for the next breakpoint at or after the ":while" // Check for the next breakpoint at or after the ":while"
* or ":for". */ // or ":for".
if (breakpoint != NULL) { if (breakpoint != NULL) {
*breakpoint = dbg_find_breakpoint(getline_equal(fgetline, cookie, getsourceline), *breakpoint = dbg_find_breakpoint(getline_equal(fgetline, cookie, getsourceline),
fname, fname,
@ -724,8 +724,8 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
cstack.cs_flags[cstack.cs_idx] |= CSF_ACTIVE | CSF_FINALLY; cstack.cs_flags[cstack.cs_idx] |= CSF_ACTIVE | CSF_FINALLY;
} }
/* Update global "trylevel" for recursive calls to do_cmdline() from // Update global "trylevel" for recursive calls to do_cmdline() from
* within this loop. */ // within this loop.
trylevel = initial_trylevel + cstack.cs_trylevel; trylevel = initial_trylevel + cstack.cs_trylevel;
// If the outermost try conditional (across function calls and sourced // If the outermost try conditional (across function calls and sourced
@ -806,9 +806,9 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
trylevel = initial_trylevel; trylevel = initial_trylevel;
} }
/* If a missing ":endtry", ":endwhile", ":endfor", or ":endif" or a memory // If a missing ":endtry", ":endwhile", ":endfor", or ":endif" or a memory
* lack was reported above and the error message is to be converted to an // lack was reported above and the error message is to be converted to an
* exception, do this now after rewinding the cstack. */ // exception, do this now after rewinding the cstack.
do_errthrow(&cstack, getline_equal(fgetline, cookie, get_func_line) do_errthrow(&cstack, getline_equal(fgetline, cookie, get_func_line)
? (char_u *)"endfunction" : (char_u *)NULL); ? (char_u *)"endfunction" : (char_u *)NULL);
@ -1014,9 +1014,9 @@ int getline_equal(LineGetter fgetline, void *cookie, LineGetter func)
LineGetter gp; LineGetter gp;
struct loop_cookie *cp; struct loop_cookie *cp;
/* When "fgetline" is "get_loop_line()" use the "cookie" to find the // When "fgetline" is "get_loop_line()" use the "cookie" to find the
* function that's originally used to obtain the lines. This may be // function that's originally used to obtain the lines. This may be
* nested several levels. */ // nested several levels.
gp = fgetline; gp = fgetline;
cp = (struct loop_cookie *)cookie; cp = (struct loop_cookie *)cookie;
while (gp == get_loop_line) { while (gp == get_loop_line) {
@ -1035,9 +1035,9 @@ void *getline_cookie(LineGetter fgetline, void *cookie)
LineGetter gp; LineGetter gp;
struct loop_cookie *cp; struct loop_cookie *cp;
/* When "fgetline" is "get_loop_line()" use the "cookie" to find the // When "fgetline" is "get_loop_line()" use the "cookie" to find the
* cookie that's originally used to obtain the lines. This may be nested // cookie that's originally used to obtain the lines. This may be nested
* several levels. */ // several levels.
gp = fgetline; gp = fgetline;
cp = (struct loop_cookie *)cookie; cp = (struct loop_cookie *)cookie;
while (gp == get_loop_line) { while (gp == get_loop_line) {
@ -2625,9 +2625,9 @@ static char_u *find_command(exarg_T *eap, int *full)
} }
len = (int)(p - eap->cmd); len = (int)(p - eap->cmd);
if (*eap->cmd == 'd' && (p[-1] == 'l' || p[-1] == 'p')) { if (*eap->cmd == 'd' && (p[-1] == 'l' || p[-1] == 'p')) {
/* Check for ":dl", ":dell", etc. to ":deletel": that's // Check for ":dl", ":dell", etc. to ":deletel": that's
* :delete with the 'l' flag. Same for 'p'. */ // :delete with the 'l' flag. Same for 'p'.
for (i = 0; i < len; ++i) { for (i = 0; i < len; i++) {
if (eap->cmd[i] != ((char_u *)"delete")[i]) { if (eap->cmd[i] != ((char_u *)"delete")[i]) {
break; break;
} }
@ -4435,8 +4435,8 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp)
continue; continue;
} }
/* Wildcards won't be expanded below, the replacement is taken // Wildcards won't be expanded below, the replacement is taken
* literally. But do expand "~/file", "~user/file" and "$HOME/file". */ // literally. But do expand "~/file", "~user/file" and "$HOME/file".
if (vim_strchr(repl, '$') != NULL || vim_strchr(repl, '~') != NULL) { if (vim_strchr(repl, '$') != NULL || vim_strchr(repl, '~') != NULL) {
char_u *l = repl; char_u *l = repl;
@ -4463,8 +4463,8 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp)
&& !(eap->argt & EX_NOSPC)) { && !(eap->argt & EX_NOSPC)) {
char_u *l; char_u *l;
#ifdef BACKSLASH_IN_FILENAME #ifdef BACKSLASH_IN_FILENAME
/* Don't escape a backslash here, because rem_backslash() doesn't // Don't escape a backslash here, because rem_backslash() doesn't
* remove it later. */ // remove it later.
static char_u *nobslash = (char_u *)" \t\"|"; static char_u *nobslash = (char_u *)" \t\"|";
# define ESCAPE_CHARS nobslash # define ESCAPE_CHARS nobslash
#else #else
@ -7205,8 +7205,8 @@ void ex_splitview(exarg_T *eap)
} }
} else if (win_split(eap->addr_count > 0 ? (int)eap->line2 : 0, } else if (win_split(eap->addr_count > 0 ? (int)eap->line2 : 0,
*eap->cmd == 'v' ? WSP_VERT : 0) != FAIL) { *eap->cmd == 'v' ? WSP_VERT : 0) != FAIL) {
/* Reset 'scrollbind' when editing another file, but keep it when // Reset 'scrollbind' when editing another file, but keep it when
* doing ":split" without arguments. */ // doing ":split" without arguments.
if (*eap->arg != NUL if (*eap->arg != NUL
) { ) {
RESET_BINDING(curwin); RESET_BINDING(curwin);
@ -7402,8 +7402,8 @@ static void ex_find(exarg_T *eap)
fname = find_file_in_path(eap->arg, STRLEN(eap->arg), fname = find_file_in_path(eap->arg, STRLEN(eap->arg),
FNAME_MESS, TRUE, curbuf->b_ffname); FNAME_MESS, TRUE, curbuf->b_ffname);
if (eap->addr_count > 0) { if (eap->addr_count > 0) {
/* Repeat finding the file "count" times. This matters when it // Repeat finding the file "count" times. This matters when it
* appears several times in the path. */ // appears several times in the path.
count = eap->line2; count = eap->line2;
while (fname != NULL && --count > 0) { while (fname != NULL && --count > 0) {
xfree(fname); xfree(fname);
@ -7509,8 +7509,8 @@ void do_exedit(exarg_T *eap, win_T *old_curwin)
if (!need_hide || buf_hide(curbuf)) { if (!need_hide || buf_hide(curbuf)) {
cleanup_T cs; cleanup_T cs;
/* Reset the error/interrupt/exception state here so that // Reset the error/interrupt/exception state here so that
* aborting() returns FALSE when closing a window. */ // aborting() returns FALSE when closing a window.
enter_cleanup(&cs); enter_cleanup(&cs);
win_close(curwin, !need_hide && !buf_hide(curbuf)); win_close(curwin, !need_hide && !buf_hide(curbuf));
@ -7675,8 +7675,8 @@ static void ex_read(exarg_T *eap)
} }
} else { } else {
if (empty && exmode_active) { if (empty && exmode_active) {
/* Delete the empty line that remains. Historically ex does // Delete the empty line that remains. Historically ex does
* this but vi doesn't. */ // this but vi doesn't.
if (eap->line2 == 0) { if (eap->line2 == 0) {
lnum = curbuf->b_ml.ml_line_count; lnum = curbuf->b_ml.ml_line_count;
} else { } else {
@ -8298,8 +8298,8 @@ static void ex_redir(exarg_T *eap)
} }
} }
/* Make sure redirection is not off. Can happen for cmdline completion // Make sure redirection is not off. Can happen for cmdline completion
* that indirectly invokes a command to catch its output. */ // that indirectly invokes a command to catch its output.
if (redir_fd != NULL if (redir_fd != NULL
|| redir_reg || redir_vname) { || redir_reg || redir_vname) {
redir_off = false; redir_off = false;

View File

@ -135,8 +135,8 @@ int should_abort(int retcode)
*/ */
int aborted_in_try(void) int aborted_in_try(void)
{ {
/* This function is only called after an error. In this case, "force_abort" // This function is only called after an error. In this case, "force_abort"
* determines whether searching for finally clauses is necessary. */ // determines whether searching for finally clauses is necessary.
return force_abort; return force_abort;
} }
@ -321,8 +321,8 @@ void do_errthrow(cstack_T *cstack, char_u *cmdname)
force_abort = TRUE; force_abort = TRUE;
} }
/* If no exception is to be thrown or the conversion should be done after // If no exception is to be thrown or the conversion should be done after
* returning to a previous invocation of do_one_cmd(), do nothing. */ // returning to a previous invocation of do_one_cmd(), do nothing.
if (msg_list == NULL || *msg_list == NULL) { if (msg_list == NULL || *msg_list == NULL) {
return; return;
} }
@ -471,8 +471,8 @@ static int throw_exception(void *value, except_type_T type, char_u *cmdname)
excp = xmalloc(sizeof(except_T)); excp = xmalloc(sizeof(except_T));
if (type == ET_ERROR) { if (type == ET_ERROR) {
/* Store the original message and prefix the exception value with // Store the original message and prefix the exception value with
* "Vim:" or, if a command name is given, "Vim(cmdname):". */ // "Vim:" or, if a command name is given, "Vim(cmdname):".
excp->messages = (struct msglist *)value; excp->messages = (struct msglist *)value;
} }
@ -940,11 +940,11 @@ void ex_else(exarg_T *eap)
if (eap->cmdidx == CMD_elseif) { if (eap->cmdidx == CMD_elseif) {
bool error; bool error;
result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip); result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
/* When throwing error exceptions, we want to throw always the first // When throwing error exceptions, we want to throw always the first
* of several errors in a row. This is what actually happens when // of several errors in a row. This is what actually happens when
* a conditional error was detected above and there is another failure // a conditional error was detected above and there is another failure
* when parsing the expression. Since the skip flag is set in this // when parsing the expression. Since the skip flag is set in this
* case, the parsing error will be ignored by emsg(). */ // case, the parsing error will be ignored by emsg().
if (!skip && !error) { if (!skip && !error) {
if (result) { if (result) {
@ -1000,8 +1000,8 @@ void ex_while(exarg_T *eap)
* ":for var in list-expr" * ":for var in list-expr"
*/ */
if ((cstack->cs_lflags & CSL_HAD_LOOP) != 0) { if ((cstack->cs_lflags & CSL_HAD_LOOP) != 0) {
/* Jumping here from a ":continue" or ":endfor": use the // Jumping here from a ":continue" or ":endfor": use the
* previously evaluated list. */ // previously evaluated list.
fi = cstack->cs_forinfo[cstack->cs_idx]; fi = cstack->cs_forinfo[cstack->cs_idx];
error = FALSE; error = FALSE;
} else { } else {
@ -1033,10 +1033,10 @@ void ex_while(exarg_T *eap)
cstack->cs_lflags ^= CSL_HAD_LOOP; cstack->cs_lflags ^= CSL_HAD_LOOP;
} else { } else {
cstack->cs_lflags &= ~CSL_HAD_LOOP; cstack->cs_lflags &= ~CSL_HAD_LOOP;
/* If the ":while" evaluates to FALSE or ":for" is past the end of // If the ":while" evaluates to FALSE or ":for" is past the end of
* the list, show the debug prompt at the ":endwhile"/":endfor" as // the list, show the debug prompt at the ":endwhile"/":endfor" as
* if there was a ":break" in a ":while"/":for" evaluating to // if there was a ":break" in a ":while"/":for" evaluating to
* TRUE. */ // TRUE.
if (!skip && !error) { if (!skip && !error) {
cstack->cs_flags[cstack->cs_idx] |= CSF_TRUE; cstack->cs_flags[cstack->cs_idx] |= CSF_TRUE;
} }
@ -1125,8 +1125,8 @@ void ex_endwhile(exarg_T *eap)
} else { } else {
fl = cstack->cs_flags[cstack->cs_idx]; fl = cstack->cs_flags[cstack->cs_idx];
if (!(fl & csf)) { if (!(fl & csf)) {
/* If we are in a ":while" or ":for" but used the wrong endloop // If we are in a ":while" or ":for" but used the wrong endloop
* command, do not rewind to the next enclosing ":for"/":while". */ // command, do not rewind to the next enclosing ":for"/":while".
if (fl & CSF_WHILE) { if (fl & CSF_WHILE) {
eap->errmsg = (char_u *)_("E732: Using :endfor with :while"); eap->errmsg = (char_u *)_("E732: Using :endfor with :while");
} else if (fl & CSF_FOR) { } else if (fl & CSF_FOR) {
@ -1143,8 +1143,8 @@ void ex_endwhile(exarg_T *eap)
for (idx = cstack->cs_idx; idx > 0; --idx) { for (idx = cstack->cs_idx; idx > 0; --idx) {
fl = cstack->cs_flags[idx]; fl = cstack->cs_flags[idx];
if ((fl & CSF_TRY) && !(fl & CSF_FINALLY)) { if ((fl & CSF_TRY) && !(fl & CSF_FINALLY)) {
/* Give up at a try conditional not in its finally clause. // Give up at a try conditional not in its finally clause.
* Ignore the ":endwhile"/":endfor". */ // Ignore the ":endwhile"/":endfor".
eap->errmsg = err; eap->errmsg = err;
return; return;
} }
@ -1258,9 +1258,9 @@ void do_throw(cstack_T *cstack)
if (cstack->cs_flags[idx] & CSF_ACTIVE) { if (cstack->cs_flags[idx] & CSF_ACTIVE) {
cstack->cs_flags[idx] |= CSF_THROWN; cstack->cs_flags[idx] |= CSF_THROWN;
} else { } else {
/* THROWN may have already been set for a catchable exception // THROWN may have already been set for a catchable exception
* that has been discarded. Ensure it is reset for the new // that has been discarded. Ensure it is reset for the new
* exception. */ // exception.
cstack->cs_flags[idx] &= ~CSF_THROWN; cstack->cs_flags[idx] &= ~CSF_THROWN;
} }
} }
@ -1288,9 +1288,9 @@ void ex_try(exarg_T *eap)
skip = CHECK_SKIP; skip = CHECK_SKIP;
if (!skip) { if (!skip) {
/* Set ACTIVE and TRUE. TRUE means that the corresponding ":catch" // Set ACTIVE and TRUE. TRUE means that the corresponding ":catch"
* commands should check for a match if an exception is thrown and // commands should check for a match if an exception is thrown and
* that the finally clause needs to be executed. */ // that the finally clause needs to be executed.
cstack->cs_flags[cstack->cs_idx] |= CSF_ACTIVE | CSF_TRUE; cstack->cs_flags[cstack->cs_idx] |= CSF_ACTIVE | CSF_TRUE;
/* /*
@ -1343,8 +1343,8 @@ void ex_catch(exarg_T *eap)
give_up = TRUE; give_up = TRUE;
} else { } else {
if (!(cstack->cs_flags[cstack->cs_idx] & CSF_TRY)) { if (!(cstack->cs_flags[cstack->cs_idx] & CSF_TRY)) {
/* Report what's missing if the matching ":try" is not in its // Report what's missing if the matching ":try" is not in its
* finally clause. */ // finally clause.
eap->errmsg = get_end_emsg(cstack); eap->errmsg = get_end_emsg(cstack);
skip = TRUE; skip = TRUE;
} }
@ -1497,9 +1497,9 @@ void ex_finally(exarg_T *eap)
break; break;
} }
} }
/* Make this error pending, so that the commands in the following // Make this error pending, so that the commands in the following
* finally clause can be executed. This overrules also a pending // finally clause can be executed. This overrules also a pending
* ":continue", ":break", ":return", or ":finish". */ // ":continue", ":break", ":return", or ":finish".
pending = CSTP_ERROR; pending = CSTP_ERROR;
} else { } else {
idx = cstack->cs_idx; idx = cstack->cs_idx;
@ -1524,14 +1524,14 @@ void ex_finally(exarg_T *eap)
skip = !(cstack->cs_flags[cstack->cs_idx] & CSF_TRUE); skip = !(cstack->cs_flags[cstack->cs_idx] & CSF_TRUE);
if (!skip) { if (!skip) {
/* When debugging or a breakpoint was encountered, display the // When debugging or a breakpoint was encountered, display the
* debug prompt (if not already done). The user then knows that the // debug prompt (if not already done). The user then knows that the
* finally clause is executed. */ // finally clause is executed.
if (dbg_check_skipped(eap)) { if (dbg_check_skipped(eap)) {
/* Handle a ">quit" debug command as if an interrupt had // Handle a ">quit" debug command as if an interrupt had
* occurred before the ":finally". That is, discard the // occurred before the ":finally". That is, discard the
* original exception and replace it by an interrupt // original exception and replace it by an interrupt
* exception. */ // exception.
(void)do_intthrow(cstack); (void)do_intthrow(cstack);
} }
@ -1732,13 +1732,13 @@ void ex_endtry(exarg_T *eap)
case CSTP_NONE: case CSTP_NONE:
break; break;
/* Reactivate a pending ":continue", ":break", ":return", // Reactivate a pending ":continue", ":break", ":return",
* ":finish" from the try block or a catch clause of this try // ":finish" from the try block or a catch clause of this try
* conditional. This is skipped, if there was an error in an // conditional. This is skipped, if there was an error in an
* (unskipped) conditional command or an interrupt afterwards // (unskipped) conditional command or an interrupt afterwards
* or if the finally clause is present and executed a new error, // or if the finally clause is present and executed a new error,
* interrupt, throw, ":continue", ":break", ":return", or // interrupt, throw, ":continue", ":break", ":return", or
* ":finish". */ // ":finish".
case CSTP_CONTINUE: case CSTP_CONTINUE:
ex_continue(eap); ex_continue(eap);
break; break;
@ -1866,10 +1866,10 @@ void leave_cleanup(cleanup_T *csp)
return; return;
} }
/* If there was an aborting error, an interrupt, or an uncaught exception // If there was an aborting error, an interrupt, or an uncaught exception
* after the corresponding call to enter_cleanup(), discard what has been // after the corresponding call to enter_cleanup(), discard what has been
* made pending by it. Report this to the user if required by the // made pending by it. Report this to the user if required by the
* 'verbose' option or when debugging. */ // 'verbose' option or when debugging.
if (aborting() || need_rethrow) { if (aborting() || need_rethrow) {
if (pending & CSTP_THROW) { if (pending & CSTP_THROW) {
// Cancel the pending exception (includes report). // Cancel the pending exception (includes report).
@ -1878,8 +1878,8 @@ void leave_cleanup(cleanup_T *csp)
report_discard_pending(pending, NULL); report_discard_pending(pending, NULL);
} }
/* If an error was about to be converted to an exception when // If an error was about to be converted to an exception when
* enter_cleanup() was called, free the message list. */ // enter_cleanup() was called, free the message list.
if (msg_list != NULL) { if (msg_list != NULL) {
free_global_msglist(); free_global_msglist();
} }
@ -1999,10 +1999,10 @@ int cleanup_conditionals(cstack_T *cstack, int searched_cond, int inclusive)
&& (cstack->cs_flags[idx] & CSF_CAUGHT)) { && (cstack->cs_flags[idx] & CSF_CAUGHT)) {
finish_exception((except_T *)cstack->cs_exception[idx]); finish_exception((except_T *)cstack->cs_exception[idx]);
} }
/* Stop at this try conditional - except the try block never // Stop at this try conditional - except the try block never
* got active (because of an inactive surrounding conditional // got active (because of an inactive surrounding conditional
* or when the ":try" appeared after an error or interrupt or // or when the ":try" appeared after an error or interrupt or
* throw). */ // throw).
if (cstack->cs_flags[idx] & CSF_TRUE) { if (cstack->cs_flags[idx] & CSF_TRUE) {
if (searched_cond == 0 && !inclusive) { if (searched_cond == 0 && !inclusive) {
break; break;
@ -2012,10 +2012,10 @@ int cleanup_conditionals(cstack_T *cstack, int searched_cond, int inclusive)
} }
} }
/* Stop on the searched conditional type (even when the surrounding // Stop on the searched conditional type (even when the surrounding
* conditional is not active or something has been made pending). // conditional is not active or something has been made pending).
* If "inclusive" is TRUE and "searched_cond" is CSF_TRY|CSF_SILENT, // If "inclusive" is TRUE and "searched_cond" is CSF_TRY|CSF_SILENT,
* check first whether "emsg_silent" needs to be restored. */ // check first whether "emsg_silent" needs to be restored.
if (cstack->cs_flags[idx] & searched_cond) { if (cstack->cs_flags[idx] & searched_cond) {
if (!inclusive) { if (!inclusive) {
break; break;

View File

@ -2637,8 +2637,8 @@ static void realloc_cmdbuff(int len)
&& ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL) { && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL) {
int i = (int)(ccline.xpc->xp_pattern - p); int i = (int)(ccline.xpc->xp_pattern - p);
/* If xp_pattern points inside the old cmdbuff it needs to be adjusted // If xp_pattern points inside the old cmdbuff it needs to be adjusted
* to point into the newly allocated memory. */ // to point into the newly allocated memory.
if (i >= 0 && i <= ccline.cmdlen) { if (i >= 0 && i <= ccline.cmdlen) {
ccline.xpc->xp_pattern = ccline.cmdbuff + i; ccline.xpc->xp_pattern = ccline.cmdbuff + i;
} }
@ -3457,8 +3457,8 @@ static bool cmdline_paste(int regname, bool literally, bool remcr)
return FAIL; return FAIL;
} }
/* When 'incsearch' is set and CTRL-R CTRL-W used: skip the duplicate // When 'incsearch' is set and CTRL-R CTRL-W used: skip the duplicate
* part of the word. */ // part of the word.
p = arg; p = arg;
if (p_is && regname == Ctrl_W) { if (p_is && regname == Ctrl_W) {
char_u *w; char_u *w;
@ -5976,8 +5976,8 @@ int set_cmdline_pos(int pos)
return 1; return 1;
} }
/* The position is not set directly but after CTRL-\ e or CTRL-R = has // The position is not set directly but after CTRL-\ e or CTRL-R = has
* changed the command line. */ // changed the command line.
if (pos < 0) { if (pos < 0) {
new_cmdpos = 0; new_cmdpos = 0;
} else { } else {
@ -6471,8 +6471,8 @@ static int open_cmdwin(void)
exmode_active = save_exmode; exmode_active = save_exmode;
/* Safety check: The old window or buffer was deleted: It's a bug when // Safety check: The old window or buffer was deleted: It's a bug when
* this happens! */ // this happens!
if (!win_valid(old_curwin) || !bufref_valid(&old_curbuf)) { if (!win_valid(old_curwin) || !bufref_valid(&old_curbuf)) {
cmdwin_result = Ctrl_C; cmdwin_result = Ctrl_C;
EMSG(_("E199: Active window or buffer deleted")); EMSG(_("E199: Active window or buffer deleted"));
@ -6498,8 +6498,8 @@ static int open_cmdwin(void)
stuffcharReadbuff(CAR); stuffcharReadbuff(CAR);
} }
} else if (cmdwin_result == Ctrl_C) { } else if (cmdwin_result == Ctrl_C) {
/* :q or :close, don't execute any command // :q or :close, don't execute any command
* and don't modify the cmd window. */ // and don't modify the cmd window.
ccline.cmdbuff = NULL; ccline.cmdbuff = NULL;
} else { } else {
ccline.cmdbuff = vim_strsave(get_cursor_line_ptr()); ccline.cmdbuff = vim_strsave(get_cursor_line_ptr());

View File

@ -269,10 +269,10 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
} }
} }
/* Remember the initial values of curbuf, curbuf->b_ffname and // Remember the initial values of curbuf, curbuf->b_ffname and
* curbuf->b_fname to detect whether they are altered as a result of // curbuf->b_fname to detect whether they are altered as a result of
* executing nasty autocommands. Also check if "fname" and "sfname" // executing nasty autocommands. Also check if "fname" and "sfname"
* point to one of these values. */ // point to one of these values.
old_curbuf = curbuf; old_curbuf = curbuf;
old_b_ffname = curbuf->b_ffname; old_b_ffname = curbuf->b_ffname;
old_b_fname = curbuf->b_fname; old_b_fname = curbuf->b_fname;
@ -429,8 +429,8 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
curbuf->b_orig_mode = 0; curbuf->b_orig_mode = 0;
} }
/* Reset the "new file" flag. It will be set again below when the // Reset the "new file" flag. It will be set again below when the
* file doesn't exist. */ // file doesn't exist.
curbuf->b_flags &= ~(BF_NEW | BF_NEW_W); curbuf->b_flags &= ~(BF_NEW | BF_NEW_W);
} }
@ -514,8 +514,8 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
} }
if (set_options) { if (set_options) {
/* Don't change 'eol' if reading from buffer as it will already be // Don't change 'eol' if reading from buffer as it will already be
* correctly set when reading stdin. */ // correctly set when reading stdin.
if (!read_buffer) { if (!read_buffer) {
curbuf->b_p_eol = TRUE; curbuf->b_p_eol = TRUE;
curbuf->b_start_eol = TRUE; curbuf->b_start_eol = TRUE;
@ -816,8 +816,8 @@ retry:
fio_flags = 0; fio_flags = 0;
converted = need_conversion(fenc); converted = need_conversion(fenc);
if (converted) { if (converted) {
/* "ucs-bom" means we need to check the first bytes of the file // "ucs-bom" means we need to check the first bytes of the file
* for a BOM. */ // for a BOM.
if (STRCMP(fenc, ENC_UCSBOM) == 0) { if (STRCMP(fenc, ENC_UCSBOM) == 0) {
fio_flags = FIO_UCSBOM; fio_flags = FIO_UCSBOM;
} else { } else {
@ -949,16 +949,16 @@ retry:
ptr = buffer + linerest; ptr = buffer + linerest;
line_start = buffer; line_start = buffer;
/* May need room to translate into. // May need room to translate into.
* For iconv() we don't really know the required space, use a // For iconv() we don't really know the required space, use a
* factor ICONV_MULT. // factor ICONV_MULT.
* latin1 to utf-8: 1 byte becomes up to 2 bytes // latin1 to utf-8: 1 byte becomes up to 2 bytes
* utf-16 to utf-8: 2 bytes become up to 3 bytes, 4 bytes // utf-16 to utf-8: 2 bytes become up to 3 bytes, 4 bytes
* become up to 4 bytes, size must be multiple of 2 // become up to 4 bytes, size must be multiple of 2
* ucs-2 to utf-8: 2 bytes become up to 3 bytes, size must be // ucs-2 to utf-8: 2 bytes become up to 3 bytes, size must be
* multiple of 2 // multiple of 2
* ucs-4 to utf-8: 4 bytes become up to 6 bytes, size must be // ucs-4 to utf-8: 4 bytes become up to 6 bytes, size must be
* multiple of 4 */ // multiple of 4
real_size = (int)size; real_size = (int)size;
#ifdef HAVE_ICONV #ifdef HAVE_ICONV
if (iconv_fd != (iconv_t)-1) { if (iconv_fd != (iconv_t)-1) {
@ -1000,9 +1000,9 @@ retry:
p = ml_get(read_buf_lnum) + read_buf_col; p = ml_get(read_buf_lnum) + read_buf_col;
n = (int)STRLEN(p); n = (int)STRLEN(p);
if ((int)tlen + n + 1 > size) { if ((int)tlen + n + 1 > size) {
/* Filled up to "size", append partial line. // Filled up to "size", append partial line.
* Change NL to NUL to reverse the effect done // Change NL to NUL to reverse the effect done
* below. */ // below.
n = (int)(size - tlen); n = (int)(size - tlen);
for (ni = 0; ni < n; ++ni) { for (ni = 0; ni < n; ++ni) {
if (p[ni] == NL) { if (p[ni] == NL) {
@ -1026,8 +1026,8 @@ retry:
ptr[tlen++] = NL; ptr[tlen++] = NL;
read_buf_col = 0; read_buf_col = 0;
if (++read_buf_lnum > from) { if (++read_buf_lnum > from) {
/* When the last line didn't have an // When the last line didn't have an
* end-of-line don't add it now either. */ // end-of-line don't add it now either.
if (!curbuf->b_p_eol) { if (!curbuf->b_p_eol) {
--tlen; --tlen;
} }
@ -1279,8 +1279,8 @@ retry:
} }
} }
/* If there is a trailing incomplete sequence move it to // If there is a trailing incomplete sequence move it to
* conv_rest[]. */ // conv_rest[].
if (tail != NULL) { if (tail != NULL) {
conv_restlen = (int)((ptr + size) - tail); conv_restlen = (int)((ptr + size) - tail);
memmove(conv_rest, tail, conv_restlen); memmove(conv_rest, tail, conv_restlen);
@ -1320,8 +1320,8 @@ retry:
} }
} }
/* found second word of double-word, get the first // found second word of double-word, get the first
* word and compute the resulting character */ // word and compute the resulting character
if (fio_flags & FIO_ENDIAN_L) { if (fio_flags & FIO_ENDIAN_L) {
u16c = (*--p << 8); u16c = (*--p << 8);
u16c += *--p; u16c += *--p;
@ -1369,9 +1369,9 @@ retry:
p -= len; p -= len;
u8c = utf_ptr2char(p); u8c = utf_ptr2char(p);
if (len == 0) { if (len == 0) {
/* Not a valid UTF-8 character, retry with // Not a valid UTF-8 character, retry with
* another fenc when possible, otherwise just // another fenc when possible, otherwise just
* report the error. */ // report the error.
if (can_retry) { if (can_retry) {
goto rewind_retry; goto rewind_retry;
} }
@ -1435,9 +1435,9 @@ retry:
} }
} }
if (l == 1 || l > todo) { if (l == 1 || l > todo) {
/* Illegal byte. If we can try another encoding // Illegal byte. If we can try another encoding
* do that, unless at EOF where a truncated // do that, unless at EOF where a truncated
* file is more likely than a conversion error. */ // file is more likely than a conversion error.
if (can_retry && !incomplete_tail) { if (can_retry && !incomplete_tail) {
break; break;
} }
@ -1909,8 +1909,8 @@ failed:
*/ */
curbuf->b_no_eol_lnum = read_no_eol_lnum; curbuf->b_no_eol_lnum = read_no_eol_lnum;
/* When reloading a buffer put the cursor at the first line that is // When reloading a buffer put the cursor at the first line that is
* different. */ // different.
if (flags & READ_KEEP_UNDO) { if (flags & READ_KEEP_UNDO) {
u_find_first_changed(); u_find_first_changed();
} }
@ -1929,8 +1929,8 @@ failed:
int m = msg_scroll; int m = msg_scroll;
int n = msg_scrolled; int n = msg_scrolled;
/* Save the fileformat now, otherwise the buffer will be considered // Save the fileformat now, otherwise the buffer will be considered
* modified if the format/encoding was automatically detected. */ // modified if the format/encoding was automatically detected.
if (set_options) { if (set_options) {
save_file_ff(curbuf); save_file_ff(curbuf);
} }
@ -4804,15 +4804,15 @@ int check_timestamps(int focus)
{ {
int didit = 0; int didit = 0;
/* Don't check timestamps while system() or another low-level function may // Don't check timestamps while system() or another low-level function may
* cause us to lose and gain focus. */ // cause us to lose and gain focus.
if (no_check_timestamps > 0) { if (no_check_timestamps > 0) {
return FALSE; return FALSE;
} }
/* Avoid doing a check twice. The OK/Reload dialog can cause a focus // Avoid doing a check twice. The OK/Reload dialog can cause a focus
* event and we would keep on checking if the file is steadily growing. // event and we would keep on checking if the file is steadily growing.
* Do check again after typing something. */ // Do check again after typing something.
if (focus && did_check_timestamps) { if (focus && did_check_timestamps) {
need_check_timestamps = TRUE; need_check_timestamps = TRUE;
return FALSE; return FALSE;
@ -5025,8 +5025,8 @@ int buf_check_timestamp(buf_T *buf)
mesg = _("W16: Warning: Mode of file \"%s\" has changed since editing started"); mesg = _("W16: Warning: Mode of file \"%s\" has changed since editing started");
mesg2 = _("See \":help W16\" for more info."); mesg2 = _("See \":help W16\" for more info.");
} else { } else {
/* Only timestamp changed, store it to avoid a warning // Only timestamp changed, store it to avoid a warning
* in check_mtime() later. */ // in check_mtime() later.
buf->b_mtime_read = buf->b_mtime; buf->b_mtime_read = buf->b_mtime;
} }
} }
@ -5623,12 +5623,11 @@ char_u *file_pat_to_reg_pat(const char_u *pat, const char_u *pat_end, char *allo
} }
#ifdef BACKSLASH_IN_FILENAME #ifdef BACKSLASH_IN_FILENAME
if (!no_bslash) { if (!no_bslash) {
/* translate: // translate:
* "\x" to "\\x" e.g., "dir\file" // "\x" to "\\x" e.g., "dir\file"
* "\*" to "\\.*" e.g., "dir\*.c" // "\*" to "\\.*" e.g., "dir\*.c"
* "\?" to "\\." e.g., "dir\??.c" // "\?" to "\\." e.g., "dir\??.c"
* "\+" to "\+" e.g., "fileX\+.c" // "\+" to "\+" e.g., "fileX\+.c"
*/
if ((vim_isfilec(p[1]) || p[1] == '*' || p[1] == '?') if ((vim_isfilec(p[1]) || p[1] == '*' || p[1] == '?')
&& p[1] != '+') { && p[1] != '+') {
reg_pat[i++] = '['; reg_pat[i++] = '[';
@ -5642,16 +5641,15 @@ char_u *file_pat_to_reg_pat(const char_u *pat, const char_u *pat_end, char *allo
} }
} }
#endif #endif
/* Undo escaping from ExpandEscape(): // Undo escaping from ExpandEscape():
* foo\?bar -> foo?bar // foo\?bar -> foo?bar
* foo\%bar -> foo%bar // foo\%bar -> foo%bar
* foo\,bar -> foo,bar // foo\,bar -> foo,bar
* foo\ bar -> foo bar // foo\ bar -> foo bar
* Don't unescape \, * and others that are also special in a // Don't unescape \, * and others that are also special in a
* regexp. // regexp.
* An escaped { must be unescaped since we use magic not // An escaped { must be unescaped since we use magic not
* verymagic. Use "\\\{n,m\}"" to get "\{n,m}". // verymagic. Use "\\\{n,m\}"" to get "\{n,m}".
*/
if (*++p == '?' if (*++p == '?'
#ifdef BACKSLASH_IN_FILENAME #ifdef BACKSLASH_IN_FILENAME
&& no_bslash && no_bslash

View File

@ -224,8 +224,8 @@ bool hasFoldingWin(win_T *const win, const linenr_T lnum, linenr_T *const firstp
break; break;
} }
/* Fold found, but it's open: Check nested folds. Line number is // Fold found, but it's open: Check nested folds. Line number is
* relative to containing fold. */ // relative to containing fold.
gap = &fp->fd_nested; gap = &fp->fd_nested;
lnum_rel -= fp->fd_top; lnum_rel -= fp->fd_top;
++level; ++level;
@ -264,8 +264,8 @@ bool hasFoldingWin(win_T *const win, const linenr_T lnum, linenr_T *const firstp
*/ */
int foldLevel(linenr_T lnum) int foldLevel(linenr_T lnum)
{ {
/* While updating the folds lines between invalid_top and invalid_bot have // While updating the folds lines between invalid_top and invalid_bot have
* an undefined fold level. Otherwise update the folds first. */ // an undefined fold level. Otherwise update the folds first.
if (invalid_top == (linenr_T)0) { if (invalid_top == (linenr_T)0) {
checkupdate(curwin); checkupdate(curwin);
} else if (lnum == prev_lnum && prev_lnum_lvl >= 0) { } else if (lnum == prev_lnum && prev_lnum_lvl >= 0) {
@ -492,9 +492,9 @@ static void newFoldLevelWin(win_T *wp)
checkupdate(wp); checkupdate(wp);
if (wp->w_fold_manual) { if (wp->w_fold_manual) {
/* Set all flags for the first level of folds to FD_LEVEL. Following // Set all flags for the first level of folds to FD_LEVEL. Following
* manual open/close will then change the flags to FD_OPEN or // manual open/close will then change the flags to FD_OPEN or
* FD_CLOSED for those folds that don't use 'foldlevel'. */ // FD_CLOSED for those folds that don't use 'foldlevel'.
fp = (fold_T *)wp->w_folds.ga_data; fp = (fold_T *)wp->w_folds.ga_data;
for (int i = 0; i < wp->w_folds.ga_len; ++i) { for (int i = 0; i < wp->w_folds.ga_len; ++i) {
fp[i].fd_flags = FD_LEVEL; fp[i].fd_flags = FD_LEVEL;
@ -904,8 +904,8 @@ int foldMoveTo(const bool updown, const int dir, const long count)
break; break;
} }
/* When moving up, consider a fold above the cursor; when // When moving up, consider a fold above the cursor; when
* moving down consider a fold below the cursor. */ // moving down consider a fold below the cursor.
if (dir == FORWARD) { if (dir == FORWARD) {
if (fp - (fold_T *)gap->ga_data >= gap->ga_len) { if (fp - (fold_T *)gap->ga_data >= gap->ga_len) {
break; break;
@ -1424,13 +1424,13 @@ void deleteFoldRecurse(buf_T *bp, garray_T *gap)
*/ */
void foldMarkAdjust(win_T *wp, linenr_T line1, linenr_T line2, long amount, long amount_after) void foldMarkAdjust(win_T *wp, linenr_T line1, linenr_T line2, long amount, long amount_after)
{ {
/* If deleting marks from line1 to line2, but not deleting all those // If deleting marks from line1 to line2, but not deleting all those
* lines, set line2 so that only deleted lines have their folds removed. */ // lines, set line2 so that only deleted lines have their folds removed.
if (amount == MAXLNUM && line2 >= line1 && line2 - line1 >= -amount_after) { if (amount == MAXLNUM && line2 >= line1 && line2 - line1 >= -amount_after) {
line2 = line1 - amount_after - 1; line2 = line1 - amount_after - 1;
} }
/* If appending a line in Insert mode, it should be included in the fold // If appending a line in Insert mode, it should be included in the fold
* just above the line. */ // just above the line.
if ((State & INSERT) && amount == (linenr_T)1 && line2 == MAXLNUM) { if ((State & INSERT) && amount == (linenr_T)1 && line2 == MAXLNUM) {
line1--; line1--;
} }
@ -1449,8 +1449,8 @@ static void foldMarkAdjustRecurse(win_T *wp, garray_T *gap, linenr_T line1, line
return; return;
} }
/* In Insert mode an inserted line at the top of a fold is considered part // In Insert mode an inserted line at the top of a fold is considered part
* of the fold, otherwise it isn't. */ // of the fold, otherwise it isn't.
if ((State & INSERT) && amount == (linenr_T)1 && line2 == MAXLNUM) { if ((State & INSERT) && amount == (linenr_T)1 && line2 == MAXLNUM) {
top = line1 + 1; top = line1 + 1;
} else { } else {
@ -1580,8 +1580,8 @@ static bool check_closed(win_T *const wp, fold_T *const fp, bool *const use_leve
{ {
bool closed = false; bool closed = false;
/* Check if this fold is closed. If the flag is FD_LEVEL this // Check if this fold is closed. If the flag is FD_LEVEL this
* fold and all folds it contains depend on 'foldlevel'. */ // fold and all folds it contains depend on 'foldlevel'.
if (*use_levelp || fp->fd_flags == FD_LEVEL) { if (*use_levelp || fp->fd_flags == FD_LEVEL) {
*use_levelp = true; *use_levelp = true;
if (level >= wp->w_p_fdl) { if (level >= wp->w_p_fdl) {
@ -2036,8 +2036,8 @@ static void foldUpdateIEMS(win_T *const wp, linenr_T top, linenr_T bot)
// Init marker variables to speed up foldlevelMarker(). // Init marker variables to speed up foldlevelMarker().
parseMarker(wp); parseMarker(wp);
/* Need to get the level of the line above top, it is used if there is // Need to get the level of the line above top, it is used if there is
* no marker at the top. */ // no marker at the top.
if (top > 1) { if (top > 1) {
// Get the fold level at top - 1. // Get the fold level at top - 1.
const int level = foldLevelWin(wp, top - 1); const int level = foldLevelWin(wp, top - 1);
@ -2047,9 +2047,9 @@ static void foldUpdateIEMS(win_T *const wp, linenr_T top, linenr_T bot)
fline.lvl = level; fline.lvl = level;
getlevel(&fline); getlevel(&fline);
/* If a fold started here, we already had the level, if it stops // If a fold started here, we already had the level, if it stops
* here, we need to use lvl_next. Could also start and end a fold // here, we need to use lvl_next. Could also start and end a fold
* in the same line. */ // in the same line.
if (fline.lvl > level) { if (fline.lvl > level) {
fline.lvl = level - (fline.lvl - fline.lvl_next); fline.lvl = level - (fline.lvl - fline.lvl_next);
} else { } else {
@ -2062,8 +2062,8 @@ static void foldUpdateIEMS(win_T *const wp, linenr_T top, linenr_T bot)
fline.lnum = top; fline.lnum = top;
if (foldmethodIsExpr(wp)) { if (foldmethodIsExpr(wp)) {
getlevel = foldlevelExpr; getlevel = foldlevelExpr;
/* start one line back, because a "<1" may indicate the end of a // start one line back, because a "<1" may indicate the end of a
* fold in the topline */ // fold in the topline
if (top > 1) { if (top > 1) {
--fline.lnum; --fline.lnum;
} }
@ -2152,9 +2152,9 @@ static void foldUpdateIEMS(win_T *const wp, linenr_T top, linenr_T bot)
end = fp->fd_top + fp->fd_len - 1; end = fp->fd_top + fp->fd_len - 1;
} else if (getlevel == foldlevelSyntax } else if (getlevel == foldlevelSyntax
&& foldLevelWin(wp, fline.lnum) != fline.lvl) { && foldLevelWin(wp, fline.lnum) != fline.lvl) {
/* For "syntax" method: Compare the foldlevel that the syntax // For "syntax" method: Compare the foldlevel that the syntax
* tells us to the foldlevel from the existing folds. If they // tells us to the foldlevel from the existing folds. If they
* don't match continue updating folds. */ // don't match continue updating folds.
end = fline.lnum; end = fline.lnum;
} else { } else {
break; break;
@ -2186,9 +2186,9 @@ static void foldUpdateIEMS(win_T *const wp, linenr_T top, linenr_T bot)
changed_window_setting_win(wp); changed_window_setting_win(wp);
} }
/* If we updated folds past "bot", need to redraw more lines. Don't do // If we updated folds past "bot", need to redraw more lines. Don't do
* this in other situations, the changed lines will be redrawn anyway and // this in other situations, the changed lines will be redrawn anyway and
* this method can cause the whole window to be updated. */ // this method can cause the whole window to be updated.
if (end != bot) { if (end != bot) {
if (wp->w_redraw_top == 0 || wp->w_redraw_top > top) { if (wp->w_redraw_top == 0 || wp->w_redraw_top > top) {
wp->w_redraw_top = top; wp->w_redraw_top = top;
@ -2273,10 +2273,10 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
// Updating folds can be slow, check for CTRL-C. // Updating folds can be slow, check for CTRL-C.
line_breakcheck(); line_breakcheck();
/* Set "lvl" to the level of line "flp->lnum". When flp->start is set // Set "lvl" to the level of line "flp->lnum". When flp->start is set
* and after the first line of the fold, set the level to zero to // and after the first line of the fold, set the level to zero to
* force the fold to end. Do the same when had_end is set: Previous // force the fold to end. Do the same when had_end is set: Previous
* line was marked as end of a fold. */ // line was marked as end of a fold.
lvl = flp->lvl; lvl = flp->lvl;
if (lvl > MAX_LEVEL) { if (lvl > MAX_LEVEL) {
lvl = MAX_LEVEL; lvl = MAX_LEVEL;
@ -2287,12 +2287,11 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
} }
if (flp->lnum > bot && !finish && fp != NULL) { if (flp->lnum > bot && !finish && fp != NULL) {
/* For "marker" and "syntax" methods: // For "marker" and "syntax" methods:
* - If a change caused a nested fold to be removed, we need to // - If a change caused a nested fold to be removed, we need to
* delete it and continue at least until where it ended. // delete it and continue at least until where it ended.
* - If a change caused a nested fold to be created, or this fold // - If a change caused a nested fold to be created, or this fold
* to continue below its original end, need to finish this fold. // to continue below its original end, need to finish this fold.
*/
if (getlevel != foldlevelMarker if (getlevel != foldlevelMarker
&& getlevel != foldlevelExpr && getlevel != foldlevelExpr
&& getlevel != foldlevelSyntax) { && getlevel != foldlevelSyntax) {
@ -2301,9 +2300,9 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
i = 0; i = 0;
fp2 = fp; fp2 = fp;
if (lvl >= level) { if (lvl >= level) {
/* Compute how deep the folds currently are, if it's deeper // Compute how deep the folds currently are, if it's deeper
* than "lvl" then some must be deleted, need to update // than "lvl" then some must be deleted, need to update
* at least one nested fold. */ // at least one nested fold.
ll = flp->lnum - fp->fd_top; ll = flp->lnum - fp->fd_top;
while (foldFind(&fp2->fd_nested, ll, &fp2)) { while (foldFind(&fp2->fd_nested, ll, &fp2)) {
++i; ++i;
@ -2322,9 +2321,9 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
} }
} }
/* At the start of the first nested fold and at the end of the current // At the start of the first nested fold and at the end of the current
* fold: check if existing folds at this level, before the current // fold: check if existing folds at this level, before the current
* one, need to be deleted or truncated. */ // one, need to be deleted or truncated.
if (fp == NULL if (fp == NULL
&& (lvl != level && (lvl != level
|| flp->lnum_save >= bot || flp->lnum_save >= bot
@ -2357,10 +2356,10 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
|| (lvl >= level || (lvl >= level
&& fp->fd_top <= flp->lnum_save))))) { && fp->fd_top <= flp->lnum_save))))) {
if (fp->fd_top + fp->fd_len + concat > firstlnum) { if (fp->fd_top + fp->fd_len + concat > firstlnum) {
/* Use existing fold for the new fold. If it starts // Use existing fold for the new fold. If it starts
* before where we started looking, extend it. If it // before where we started looking, extend it. If it
* starts at another line, update nested folds to keep // starts at another line, update nested folds to keep
* their position, compensating for the new fd_top. */ // their position, compensating for the new fd_top.
if (fp->fd_top == firstlnum) { if (fp->fd_top == firstlnum) {
// We have found a fold beginning exactly where we want one. // We have found a fold beginning exactly where we want one.
} else if (fp->fd_top >= startlnum) { } else if (fp->fd_top >= startlnum) {
@ -2504,8 +2503,8 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
bot = flp->lnum; bot = flp->lnum;
} }
/* Line numbers in the nested fold are relative to the start of // Line numbers in the nested fold are relative to the start of
* this fold. */ // this fold.
flp->lnum = flp->lnum_save - fp->fd_top; flp->lnum = flp->lnum_save - fp->fd_top;
flp->off += fp->fd_top; flp->off += fp->fd_top;
i = (int)(fp - (fold_T *)gap->ga_data); i = (int)(fp - (fold_T *)gap->ga_data);
@ -2548,8 +2547,8 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
break; break;
} }
/* leave flp->lnum_save to lnum of the line that was used to get // leave flp->lnum_save to lnum of the line that was used to get
* the level, flp->lnum to the lnum of the next line. */ // the level, flp->lnum to the lnum of the next line.
flp->lnum_save = flp->lnum; flp->lnum_save = flp->lnum;
flp->lnum = ll; flp->lnum = ll;
} }
@ -2634,8 +2633,8 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
deleteFoldEntry(flp->wp, gap, (int)(fp2 - (fold_T *)gap->ga_data), true); deleteFoldEntry(flp->wp, gap, (int)(fp2 - (fold_T *)gap->ga_data), true);
} }
/* Need to redraw the lines we inspected, which might be further down than // Need to redraw the lines we inspected, which might be further down than
* was asked for. */ // was asked for.
if (bot < flp->lnum - 1) { if (bot < flp->lnum - 1) {
bot = flp->lnum - 1; bot = flp->lnum - 1;
} }
@ -2948,8 +2947,8 @@ static void foldMerge(win_T *const wp, fold_T *fp1, garray_T *gap, fold_T *fp2)
garray_T *gap1 = &fp1->fd_nested; garray_T *gap1 = &fp1->fd_nested;
garray_T *gap2 = &fp2->fd_nested; garray_T *gap2 = &fp2->fd_nested;
/* If the last nested fold in fp1 touches the first nested fold in fp2, // If the last nested fold in fp1 touches the first nested fold in fp2,
* merge them recursively. */ // merge them recursively.
if (foldFind(gap1, fp1->fd_len - 1L, &fp3) && foldFind(gap2, 0L, &fp4)) { if (foldFind(gap1, fp1->fd_len - 1L, &fp3) && foldFind(gap2, 0L, &fp4)) {
foldMerge(wp, fp3, gap2, fp4); foldMerge(wp, fp3, gap2, fp4);
} }
@ -2986,8 +2985,8 @@ static void foldlevelIndent(fline_T *flp)
buf = flp->wp->w_buffer; buf = flp->wp->w_buffer;
s = skipwhite(ml_get_buf(buf, lnum, false)); s = skipwhite(ml_get_buf(buf, lnum, false));
/* empty line or lines starting with a character in 'foldignore': level // empty line or lines starting with a character in 'foldignore': level
* depends on surrounding lines */ // depends on surrounding lines
if (*s == NUL || vim_strchr(flp->wp->w_p_fdi, *s) != NULL) { if (*s == NUL || vim_strchr(flp->wp->w_p_fdi, *s) != NULL) {
// first and last line can't be undefined, use level 0 // first and last line can't be undefined, use level 0
if (lnum == 1 || lnum == buf->b_ml.ml_line_count) { if (lnum == 1 || lnum == buf->b_ml.ml_line_count) {
@ -3090,8 +3089,8 @@ static void foldlevelExpr(fline_T *flp)
// "-1", "0", "1", ..: set fold level // "-1", "0", "1", ..: set fold level
default: default:
if (n < 0) { if (n < 0) {
/* Use the current level for the next line, so that "a1" // Use the current level for the next line, so that "a1"
* will work there. */ // will work there.
flp->lvl_next = flp->lvl; flp->lvl_next = flp->lvl;
} else { } else {
flp->lvl_next = n; flp->lvl_next = n;
@ -3100,8 +3099,8 @@ static void foldlevelExpr(fline_T *flp)
break; break;
} }
/* If the level is unknown for the first or the last line in the file, use // If the level is unknown for the first or the last line in the file, use
* level 0. */ // level 0.
if (flp->lvl < 0) { if (flp->lvl < 0) {
if (lnum <= 1) { if (lnum <= 1) {
flp->lvl = 0; flp->lvl = 0;