aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDundar Göc <gocdundar@gmail.com>2021-10-20 16:38:54 +0200
committerDundar Göc <gocdundar@gmail.com>2021-10-21 12:07:14 +0200
commitf677ba4dab699713ebfee0c0754f8b607ddb3150 (patch)
treea1a69975fb761dd0e700a1658f91059ddeffee4f /src
parent122c0dfb5dbcfb1044debc1fef4706eb90741713 (diff)
downloadrneovim-f677ba4dab699713ebfee0c0754f8b607ddb3150.tar.gz
rneovim-f677ba4dab699713ebfee0c0754f8b607ddb3150.tar.bz2
rneovim-f677ba4dab699713ebfee0c0754f8b607ddb3150.zip
vim-patch:8.1.2379: using old C style comments
Problem: Using old C style comments. Solution: Use // comments where appropriate. https://github.com/vim/vim/commit/217e1b8359447f5550dcb0d1ee43380a90c253c5
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_cmds.c128
-rw-r--r--src/nvim/ex_docmd.c87
-rw-r--r--src/nvim/ex_eval.c160
-rw-r--r--src/nvim/ex_getln.c20
-rw-r--r--src/nvim/fileio.c100
-rw-r--r--src/nvim/fold.c128
6 files changed, 304 insertions, 319 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 4a23f284cc..36f8782fd7 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -1082,8 +1082,8 @@ void ex_copy(linenr_T line1, linenr_T line2, linenr_T n)
curwin->w_cursor.lnum = n;
while (line1 <= line2) {
- /* need to use vim_strsave() because the line will be unlocked within
- * ml_append() */
+ // need to use vim_strsave() because the line will be unlocked within
+ // ml_append()
p = vim_strsave(ml_get(line1));
ml_append(curwin->w_cursor.lnum, p, (colnr_T)0, false);
xfree(p);
@@ -1206,9 +1206,9 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
prevcmd = newcmd;
if (bangredo) { // put cmd in redo buffer for ! command
- /* If % or # appears in the command, it must have been escaped.
- * Reescape them, so that redoing them does not substitute them by the
- * buffername. */
+ // If % or # appears in the command, it must have been escaped.
+ // Reescape them, so that redoing them does not substitute them by the
+ // buffername.
char_u *cmd = vim_strsave_escaped(prevcmd, (char_u *)"%#");
AppendToRedobuffLit(cmd, -1);
@@ -1237,8 +1237,8 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
do_shell(newcmd, 0);
} else { // :range!
- /* Careful: This may recursively call do_bang() again! (because of
- * autocommands) */
+ // Careful: This may recursively call do_bang() again! (because of
+ // autocommands)
do_filter(line1, line2, eap, newcmd, do_in, do_out);
apply_autocmds(EVENT_SHELLFILTERPOST, NULL, NULL, false, curbuf);
}
@@ -1368,9 +1368,9 @@ static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd,
did_check_timestamps = FALSE;
need_check_timestamps = TRUE;
- /* When interrupting the shell command, it may still have produced some
- * useful output. Reset got_int here, so that readfile() won't cancel
- * reading. */
+ // When interrupting the shell command, it may still have produced some
+ // useful output. Reset got_int here, so that readfile() won't cancel
+ // reading.
os_breakcheck();
got_int = FALSE;
@@ -1837,8 +1837,8 @@ int do_write(exarg_T *eap)
alt_buf = buflist_findname(ffname);
}
if (alt_buf != NULL && alt_buf->b_ml.ml_mfp != NULL) {
- /* Overwriting a file that is loaded in another buffer is not a
- * good idea. */
+ // Overwriting a file that is loaded in another buffer is not a
+ // good idea.
EMSG(_(e_bufloaded));
goto theend;
}
@@ -2143,8 +2143,8 @@ int not_writing(void)
*/
static int check_readonly(int *forceit, buf_T *buf)
{
- /* Handle a file being readonly when the 'readonly' option is set or when
- * the file exists and permissions are read-only. */
+ // Handle a file being readonly when the 'readonly' option is set or when
+ // the file exists and permissions are read-only.
if (!*forceit && (buf->b_p_ro
|| (os_path_exists(buf->b_ffname)
&& !os_file_is_writable((char *)buf->b_ffname)))) {
@@ -2612,8 +2612,8 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
set_buflisted(TRUE);
}
- /* If autocommands change buffers under our fingers, forget about
- * editing the file. */
+ // If autocommands change buffers under our fingers, forget about
+ // editing the file.
if (buf != curbuf) {
goto theend;
}
@@ -2677,9 +2677,9 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
}
xfree(new_name);
- /* If autocommands change buffers under our fingers, forget about
- * re-editing the file. Should do the buf_clear_file(), but perhaps
- * the autocommands changed the buffer... */
+ // If autocommands change buffers under our fingers, forget about
+ // re-editing the file. Should do the buf_clear_file(), but perhaps
+ // the autocommands changed the buffer...
if (buf != curbuf) {
goto theend;
}
@@ -2711,8 +2711,8 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
*/
curwin_init();
- /* It's possible that all lines in the buffer changed. Need to update
- * automatic folding for all windows where it's used. */
+ // It's possible that all lines in the buffer changed. Need to update
+ // automatic folding for all windows where it's used.
FOR_ALL_TAB_WINDOWS(tp, win) {
if (win->w_buffer == curbuf) {
foldUpdateAll(win);
@@ -2744,9 +2744,9 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
}
handle_swap_exists(&old_curbuf);
} else {
- /* Read the modelines, but only to set window-local options. Any
- * buffer-local options have already been set and may have been
- * changed by the user. */
+ // Read the modelines, but only to set window-local options. Any
+ // buffer-local options have already been set and may have been
+ // changed by the user.
do_modelines(OPT_WINONLY);
apply_autocmds_retval(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf,
@@ -2778,16 +2778,16 @@ int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T new
maketitle();
}
- /* Tell the diff stuff that this buffer is new and/or needs updating.
- * Also needed when re-editing the same buffer, because unloading will
- * have removed it as a diff buffer. */
+ // Tell the diff stuff that this buffer is new and/or needs updating.
+ // Also needed when re-editing the same buffer, because unloading will
+ // have removed it as a diff buffer.
if (curwin->w_p_diff) {
diff_buf_add(curbuf);
diff_invalidate(curbuf);
}
- /* If the window options were changed may need to set the spell language.
- * Can only do this after the buffer has been properly setup. */
+ // If the window options were changed may need to set the spell language.
+ // Can only do this after the buffer has been properly setup.
if (did_get_winopts && curwin->w_p_spell && *curwin->w_s->b_p_spl != NUL) {
(void)did_set_spelllang(curwin);
}
@@ -3022,10 +3022,10 @@ void ex_append(exarg_T *eap)
curbuf->b_p_ai = !curbuf->b_p_ai;
}
- /* "start" is set to eap->line2+1 unless that position is invalid (when
- * eap->line2 pointed to the end of the buffer and nothing was appended)
- * "end" is set to lnum when something has been appended, otherwise
- * it is the same than "start" -- Acevedo */
+ // "start" is set to eap->line2+1 unless that position is invalid (when
+ // eap->line2 pointed to the end of the buffer and nothing was appended)
+ // "end" is set to lnum when something has been appended, otherwise
+ // it is the same than "start" -- Acevedo
curbuf->b_op_start.lnum = (eap->line2 < curbuf->b_ml.ml_line_count) ?
eap->line2 + 1 : curbuf->b_ml.ml_line_count;
if (eap->cmdidx != CMD_append) {
@@ -3555,8 +3555,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
pat = NULL; // search_regcomp() will use previous pattern
sub = (char_u *)old_sub.sub;
- /* Vi compatibility quirk: repeating with ":s" keeps the cursor in the
- * last column after using "$". */
+ // Vi compatibility quirk: repeating with ":s" keeps the cursor in the
+ // last column after using "$".
endcolumn = (curwin->w_curswant == MAXCOL);
}
@@ -3807,8 +3807,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
if (subflags.do_ask && !preview) {
int typed = 0;
- /* change State to CONFIRM, so that the mouse works
- * properly */
+ // change State to CONFIRM, so that the mouse works
+ // properly
int save_State = State;
State = CONFIRM;
setmouse(); // disable mouse in xterm
@@ -3864,9 +3864,9 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
const bool save_p_lz = p_lz;
int save_p_fen = curwin->w_p_fen;
- curwin->w_p_fen = FALSE;
- /* Invert the matched string.
- * Remove the inversion afterwards. */
+ curwin->w_p_fen = false;
+ // Invert the matched string.
+ // Remove the inversion afterwards.
int temp = RedrawingDisabled;
RedrawingDisabled = 0;
@@ -3874,11 +3874,11 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
p_lz = false;
if (new_start != NULL) {
- /* There already was a substitution, we would
- * like to show this to the user. We cannot
- * really update the line, it would change
- * what matches. Temporarily replace the line
- * and change it back afterwards. */
+ // There already was a substitution, we would
+ // like to show this to the user. We cannot
+ // really update the line, it would change
+ // what matches. Temporarily replace the line
+ // and change it back afterwards.
orig_line = vim_strsave(ml_get(lnum));
char_u *new_line = concat_str(new_start, sub_firstline + copycol);
@@ -3908,8 +3908,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
}
msg_starthere();
i = msg_scroll;
- msg_scroll = 0; /* truncate msg when
- needed */
+ msg_scroll = 0; // truncate msg when
+ // needed
msg_no_more = true;
msg_ext_set_kind("confirm_sub");
smsg_attr(HL_ATTR(HLF_R), // Same highlight as wait_return().
@@ -4878,8 +4878,8 @@ void ex_help(exarg_T *eap)
if (!p_im) {
restart_edit = 0; // don't want insert mode in help file
}
- /* Restore KeyTyped, setting 'filetype=help' may reset it.
- * It is needed for do_tag top open folds under the cursor. */
+ // Restore KeyTyped, setting 'filetype=help' may reset it.
+ // It is needed for do_tag top open folds under the cursor.
KeyTyped = old_KeyTyped;
do_tag(tag, DT_HELP, 1, FALSE, TRUE);
@@ -5073,11 +5073,10 @@ int find_help_tags(const char_u *arg, int *num_matches, char_u ***matches, bool
STRCPY(d + 4, "\\$");
}
} else {
- /* Replace:
- * "[:...:]" with "\[:...:]"
- * "[++...]" with "\[++...]"
- * "\{" with "\\{" -- matching "} \}"
- */
+ // Replace:
+ // "[:...:]" with "\[:...:]"
+ // "[++...]" with "\[++...]"
+ // "\{" with "\\{" -- matching "} \}"
if ((arg[0] == '[' && (arg[1] == ':'
|| (arg[1] == '+' && arg[2] == '+')))
|| (arg[0] == '\\' && arg[1] == '{')) {
@@ -5327,8 +5326,8 @@ void fix_help_buffer(void)
continue;
}
- /* Go through all directories in 'runtimepath', skipping
- * $VIMRUNTIME. */
+ // Go through all directories in 'runtimepath', skipping
+ // $VIMRUNTIME.
char_u *p = p_rtp;
while (*p != NUL) {
copy_option_part(&p, NameBuff, MAXPATHL, ",");
@@ -5413,10 +5412,9 @@ void fix_help_buffer(void)
if (*s == '\r' || *s == '\n') {
*s = NUL;
}
- /* The text is utf-8 when a byte
- * above 127 is found and no
- * illegal byte sequence is found.
- */
+ // The text is utf-8 when a byte
+ // above 127 is found and no
+ // illegal byte sequence is found.
if (*s >= 0x80 && this_utf != kFalse) {
this_utf = kTrue;
const int l = utf_ptr2len(s);
@@ -5427,9 +5425,9 @@ void fix_help_buffer(void)
}
++s;
}
- /* The help file is latin1 or utf-8;
- * conversion to the current
- * 'encoding' may be required. */
+ // The help file is latin1 or utf-8;
+ // conversion to the current
+ // 'encoding' may be required.
vc.vc_type = CONV_NONE;
convert_setup(&vc,
(char_u *)(this_utf == kTrue ? "utf-8" : "latin1"),
@@ -5716,8 +5714,8 @@ static void do_helptags(char_u *dirname, bool add_help_tags, bool ignore_writeer
return;
}
- /* Go over all files in the directory to find out what languages are
- * present. */
+ // Go over all files in the directory to find out what languages are
+ // present.
int j;
ga_init(&ga, 1, 10);
for (int i = 0; i < filecount; i++) {
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 4524026e3f..6914402ada 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -340,12 +340,12 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
int getline_is_func;
static int call_depth = 0; // recursiveness
- /* For every pair of do_cmdline()/do_one_cmd() calls, use an extra memory
- * location for storing error messages to be converted to an exception.
- * This ensures that the do_errthrow() call in do_one_cmd() does not
- * combine the messages stored by an earlier invocation of do_one_cmd()
- * with the command name of the later one. This would happen when
- * BufWritePost autocommands are executed after a write error. */
+ // For every pair of do_cmdline()/do_one_cmd() calls, use an extra memory
+ // location for storing error messages to be converted to an exception.
+ // This ensures that the do_errthrow() call in do_one_cmd() does not
+ // combine the messages stored by an earlier invocation of do_one_cmd()
+ // with the command name of the later one. This would happen when
+ // BufWritePost autocommands are executed after a write error.
saved_msg_list = msg_list;
msg_list = &private_msg_list;
private_msg_list = NULL;
@@ -445,12 +445,12 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
// 1. If repeating, get a previous line from lines_ga.
if (cstack.cs_looplevel > 0 && current_line < lines_ga.ga_len) {
- /* Each '|' separated command is stored separately in lines_ga, to
- * be able to jump to it. Don't use next_cmdline now. */
+ // Each '|' separated command is stored separately in lines_ga, to
+ // be able to jump to it. Don't use next_cmdline now.
XFREE_CLEAR(cmdline_copy);
- /* Check if a function has returned or, unless it has an unclosed
- * try conditional, aborted. */
+ // Check if a function has returned or, unless it has an unclosed
+ // try conditional, aborted.
if (getline_is_func) {
if (do_profiling == PROF_YES) {
func_line_end(real_cookie);
@@ -630,8 +630,8 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
new_last_cmdline = NULL;
}
} else {
- /* need to copy the command after the '|' to cmdline_copy, for the
- * next do_one_cmd() */
+ // need to copy the command after the '|' to cmdline_copy, for the
+ // next do_one_cmd()
STRMOVE(cmdline_copy, next_cmdline);
next_cmdline = cmdline_copy;
}
@@ -656,10 +656,10 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
if (cstack.cs_lflags & (CSL_HAD_CONT | CSL_HAD_ENDLOOP)) {
cstack.cs_lflags &= ~(CSL_HAD_CONT | CSL_HAD_ENDLOOP);
- /* Jump back to the matching ":while" or ":for". Be careful
- * not to use a cs_line[] from an entry that isn't a ":while"
- * or ":for": It would make "current_line" invalid and can
- * cause a crash. */
+ // Jump back to the matching ":while" or ":for". Be careful
+ // not to use a cs_line[] from an entry that isn't a ":while"
+ // or ":for": It would make "current_line" invalid and can
+ // cause a crash.
if (!did_emsg && !got_int && !current_exception
&& cstack.cs_idx >= 0
&& (cstack.cs_flags[cstack.cs_idx]
@@ -752,9 +752,9 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
while (!((got_int || (did_emsg && force_abort) || current_exception)
&& cstack.cs_trylevel == 0)
&& !(did_emsg
- /* Keep going when inside try/catch, so that the error can be
- * deal with, except when it is a syntax error, it may cause
- * the :endtry to be missed. */
+ // Keep going when inside try/catch, so that the error can be
+ // deal with, except when it is a syntax error, it may cause
+ // the :endtry to be missed.
&& (cstack.cs_trylevel == 0 || did_emsg_syntax)
&& used_getline
&& getline_equal(fgetline, cookie, getexline))
@@ -2880,8 +2880,8 @@ int cmd_exists(const char *const name)
}
}
- /* Check built-in commands and user defined commands.
- * For ":2match" and ":3match" we need to skip the number. */
+ // Check built-in commands and user defined commands.
+ // For ":2match" and ":3match" we need to skip the number.
ea.cmd = (char_u *)((*name == '2' || *name == '3') ? name + 1 : name);
ea.cmdidx = (cmdidx_T)0;
int full = false;
@@ -3963,8 +3963,8 @@ static linenr_T get_address(exarg_T *eap, char_u **ptr, cmd_addr_T addr_type, in
if (skip) {
++cmd;
} else {
- /* Only accept a mark in another file when it is
- * used by itself: ":'M". */
+ // Only accept a mark in another file when it is
+ // used by itself: ":'M".
fp = getmark(*cmd, to_other_file && cmd[1] == NUL);
++cmd;
if (fp == (pos_T *)-1) {
@@ -4444,11 +4444,10 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp)
xfree(l);
}
- /* Need to escape white space et al. with a backslash.
- * Don't do this for:
- * - replacement that already has been escaped: "##"
- * - shell commands (may have to use quotes instead).
- */
+ // Need to escape white space et al. with a backslash.
+ // Don't do this for:
+ // - replacement that already has been escaped: "##"
+ // - shell commands (may have to use quotes instead).
if (!eap->usefilter
&& !escaped
&& eap->cmdidx != CMD_bang
@@ -4794,8 +4793,8 @@ static int getargopt(exarg_T *eap)
*p = TOLOWER_ASC(*p);
}
} else {
- /* Check ++bad= argument. Must be a single-byte character, "keep" or
- * "drop". */
+ // Check ++bad= argument. Must be a single-byte character, "keep" or
+ // "drop".
if (get_bad_opt(eap->cmd + bad_char_idx, eap) == FAIL) {
return FAIL;
}
@@ -6772,15 +6771,15 @@ void tabpage_close_other(tabpage_T *tp, int forceit)
int h = tabline_height();
char_u prev_idx[NUMBUFLEN];
- /* Limit to 1000 windows, autocommands may add a window while we close
- * one. OK, so I'm paranoid... */
+ // Limit to 1000 windows, autocommands may add a window while we close
+ // one. OK, so I'm paranoid...
while (++done < 1000) {
snprintf((char *)prev_idx, sizeof(prev_idx), "%i", tabpage_index(tp));
wp = tp->tp_lastwin;
ex_win_close(forceit, wp, tp);
- /* Autocommands may delete the tab page under our fingers and we may
- * fail to close a window with a modified buffer. */
+ // Autocommands may delete the tab page under our fingers and we may
+ // fail to close a window with a modified buffer.
if (!valid_tabpage(tp) || tp->tp_firstwin == wp) {
break;
}
@@ -7166,8 +7165,8 @@ void ex_splitview(exarg_T *eap)
|| eap->cmdidx == CMD_tabfind
|| eap->cmdidx == CMD_tabnew;
- /* A ":split" in the quickfix window works like ":new". Don't want two
- * quickfix windows. But it's OK when doing ":tab split". */
+ // A ":split" in the quickfix window works like ":new". Don't want two
+ // quickfix windows. But it's OK when doing ":tab split".
if (bt_quickfix(curbuf) && cmdmod.tab == 0) {
if (eap->cmdidx == CMD_split) {
eap->cmdidx = CMD_new;
@@ -7514,18 +7513,18 @@ void do_exedit(exarg_T *eap, win_T *old_curwin)
enter_cleanup(&cs);
win_close(curwin, !need_hide && !buf_hide(curbuf));
- /* Restore the error/interrupt/exception state if not
- * discarded by a new aborting error, interrupt, or
- * uncaught exception. */
+ // Restore the error/interrupt/exception state if not
+ // discarded by a new aborting error, interrupt, or
+ // uncaught exception.
leave_cleanup(&cs);
}
}
} else if (readonlymode && curbuf->b_nwindows == 1) {
- /* When editing an already visited buffer, 'readonly' won't be set
- * but the previous value is kept. With ":view" and ":sview" we
- * want the file to be readonly, except when another window is
- * editing the same buffer. */
- curbuf->b_p_ro = TRUE;
+ // When editing an already visited buffer, 'readonly' won't be set
+ // but the previous value is kept. With ":view" and ":sview" we
+ // want the file to be readonly, except when another window is
+ // editing the same buffer.
+ curbuf->b_p_ro = true;
}
readonlymode = n;
} else {
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
index 09a1350f17..3deb09241c 100644
--- a/src/nvim/ex_eval.c
+++ b/src/nvim/ex_eval.c
@@ -406,9 +406,9 @@ char_u *get_exception_string(void *value, except_type_T type, char_u *cmdname, i
val = ret + 4;
}
- /* msg_add_fname may have been used to prefix the message with a file
- * name in quotes. In the exception value, put the file name in
- * parentheses and move it to the end. */
+ // msg_add_fname may have been used to prefix the message with a file
+ // name in quotes. In the exception value, put the file name in
+ // parentheses and move it to the end.
for (p = mesg;; p++) {
if (*p == NUL
|| (*p == 'E'
@@ -922,16 +922,14 @@ void ex_else(exarg_T *eap)
cstack->cs_flags[cstack->cs_idx] = CSF_ACTIVE;
}
- /*
- * When debugging or a breakpoint was encountered, display the debug prompt
- * (if not already done). This shows the user that an ":else" or ":elseif"
- * is executed when the ":if" or previous ":elseif" was not TRUE. Handle
- * a ">quit" debug command as if an interrupt had occurred before the
- * ":else" or ":elseif". That is, set "skip" and throw an interrupt
- * exception if appropriate. Doing this here prevents that an exception
- * for a parsing errors is discarded when throwing the interrupt exception
- * later on.
- */
+ // When debugging or a breakpoint was encountered, display the debug prompt
+ // (if not already done). This shows the user that an ":else" or ":elseif"
+ // is executed when the ":if" or previous ":elseif" was not TRUE. Handle
+ // a ">quit" debug command as if an interrupt had occurred before the
+ // ":else" or ":elseif". That is, set "skip" and throw an interrupt
+ // exception if appropriate. Doing this here prevents that an exception
+ // for a parsing errors is discarded when throwing the interrupt exception
+ // later on.
if (!skip && dbg_check_skipped(eap) && got_int) {
(void)do_intthrow(cstack);
skip = TRUE;
@@ -1055,11 +1053,11 @@ void ex_continue(exarg_T *eap)
if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0) {
eap->errmsg = (char_u *)N_("E586: :continue without :while or :for");
} else {
- /* Try to find the matching ":while". This might stop at a try
- * conditional not in its finally clause (which is then to be executed
- * next). Therefore, deactivate all conditionals except the ":while"
- * itself (if reached). */
- idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, FALSE);
+ // Try to find the matching ":while". This might stop at a try
+ // conditional not in its finally clause (which is then to be executed
+ // next). Therefore, deactivate all conditionals except the ":while"
+ // itself (if reached).
+ idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, false);
assert(idx >= 0);
if (cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR)) {
rewind_conditionals(cstack, idx, CSF_TRY, &cstack->cs_trylevel);
@@ -1070,8 +1068,8 @@ void ex_continue(exarg_T *eap)
*/
cstack->cs_lflags |= CSL_HAD_CONT; // let do_cmdline() handle it
} else {
- /* If a try conditional not in its finally clause is reached first,
- * make the ":continue" pending for execution at the ":endtry". */
+ // If a try conditional not in its finally clause is reached first,
+ // make the ":continue" pending for execution at the ":endtry".
cstack->cs_pending[idx] = CSTP_CONTINUE;
report_make_pending(CSTP_CONTINUE, NULL);
}
@@ -1092,7 +1090,7 @@ void ex_break(exarg_T *eap)
// Deactivate conditionals until the matching ":while" or a try
// conditional not in its finally clause (which is then to be
// executed next) is found. In the latter case, make the ":break"
- // pending for execution at the ":endtry". */
+ // pending for execution at the ":endtry".
idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, true);
if (idx >= 0 && !(cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR))) {
cstack->cs_pending[idx] = CSTP_BREAK;
@@ -1155,20 +1153,17 @@ void ex_endwhile(exarg_T *eap)
// Cleanup and rewind all contained (and unclosed) conditionals.
(void)cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, FALSE);
rewind_conditionals(cstack, idx, CSF_TRY, &cstack->cs_trylevel);
- }
- /*
- * When debugging or a breakpoint was encountered, display the debug
- * prompt (if not already done). This shows the user that an
- * ":endwhile"/":endfor" is executed when the ":while" was not TRUE or
- * after a ":break". Handle a ">quit" debug command as if an
- * interrupt had occurred before the ":endwhile"/":endfor". That is,
- * throw an interrupt exception if appropriate. Doing this here
- * prevents that an exception for a parsing error is discarded when
- * throwing the interrupt exception later on.
- */
- else if (cstack->cs_flags[cstack->cs_idx] & CSF_TRUE
- && !(cstack->cs_flags[cstack->cs_idx] & CSF_ACTIVE)
- && dbg_check_skipped(eap)) {
+ } else if (cstack->cs_flags[cstack->cs_idx] & CSF_TRUE
+ && !(cstack->cs_flags[cstack->cs_idx] & CSF_ACTIVE)
+ && dbg_check_skipped(eap)) {
+ // When debugging or a breakpoint was encountered, display the debug
+ // prompt (if not already done). This shows the user that an
+ // ":endwhile"/":endfor" is executed when the ":while" was not TRUE or
+ // after a ":break". Handle a ">quit" debug command as if an
+ // interrupt had occurred before the ":endwhile"/":endfor". That is,
+ // throw an interrupt exception if appropriate. Doing this here
+ // prevents that an exception for a parsing error is discarded when
+ // throwing the interrupt exception later on.
(void)do_intthrow(cstack);
}
@@ -1354,8 +1349,8 @@ void ex_catch(exarg_T *eap)
}
}
if (cstack->cs_flags[idx] & CSF_FINALLY) {
- /* Give up for a ":catch" after ":finally" and ignore it.
- * Just parse. */
+ // Give up for a ":catch" after ":finally" and ignore it.
+ // Just parse.
eap->errmsg = (char_u *)N_("E604: :catch after :finally");
give_up = TRUE;
} else {
@@ -1395,16 +1390,16 @@ void ex_catch(exarg_T *eap)
return;
}
- /* When debugging or a breakpoint was encountered, display the
- * debug prompt (if not already done) before checking for a match.
- * This is a helpful hint for the user when the regular expression
- * matching fails. Handle a ">quit" debug command as if an
- * interrupt had occurred before the ":catch". That is, discard
- * the original exception, replace it by an interrupt exception,
- * and don't catch it in this try block. */
+ // When debugging or a breakpoint was encountered, display the
+ // debug prompt (if not already done) before checking for a match.
+ // This is a helpful hint for the user when the regular expression
+ // matching fails. Handle a ">quit" debug command as if an
+ // interrupt had occurred before the ":catch". That is, discard
+ // the original exception, replace it by an interrupt exception,
+ // and don't catch it in this try block.
if (!dbg_check_skipped(eap) || !do_intthrow(cstack)) {
- /* Terminate the pattern and avoid the 'l' flag in 'cpoptions'
- * while compiling it. */
+ // Terminate the pattern and avoid the 'l' flag in 'cpoptions'
+ // while compiling it.
if (end != NULL) {
save_char = *end;
*end = NUL;
@@ -1440,16 +1435,16 @@ void ex_catch(exarg_T *eap)
}
if (caught) {
- /* Make this ":catch" clause active and reset did_emsg and got_int.
- * Put the exception on the caught stack. */
+ // Make this ":catch" clause active and reset did_emsg and got_int.
+ // Put the exception on the caught stack.
cstack->cs_flags[idx] |= CSF_ACTIVE | CSF_CAUGHT;
did_emsg = got_int = false;
catch_exception((except_T *)cstack->cs_exception[idx]);
- /* It's mandatory that the current exception is stored in the cstack
- * so that it can be discarded at the next ":catch", ":finally", or
- * ":endtry" or when the catch clause is left by a ":continue",
- * ":break", ":return", ":finish", error, interrupt, or another
- * exception. */
+ // It's mandatory that the current exception is stored in the cstack
+ // so that it can be discarded at the next ":catch", ":finally", or
+ // ":endtry" or when the catch clause is left by a ":continue",
+ // ":break", ":return", ":finish", error, interrupt, or another
+ // exception.
if (cstack->cs_exception[cstack->cs_idx] != current_exception) {
internal_error("ex_catch()");
}
@@ -1576,13 +1571,13 @@ void ex_finally(exarg_T *eap)
assert(pending >= CHAR_MIN && pending <= CHAR_MAX);
cstack->cs_pending[cstack->cs_idx] = (char)pending;
- /* It's mandatory that the current exception is stored in the
- * cstack so that it can be rethrown at the ":endtry" or be
- * discarded if the finally clause is left by a ":continue",
- * ":break", ":return", ":finish", error, interrupt, or another
- * exception. When emsg() is called for a missing ":endif" or
- * a missing ":endwhile"/":endfor" detected here, the
- * exception will be discarded. */
+ // It's mandatory that the current exception is stored in the
+ // cstack so that it can be rethrown at the ":endtry" or be
+ // discarded if the finally clause is left by a ":continue",
+ // ":break", ":return", ":finish", error, interrupt, or another
+ // exception. When emsg() is called for a missing ":endif" or
+ // a missing ":endwhile"/":endfor" detected here, the
+ // exception will be discarded.
if (current_exception
&& cstack->cs_exception[cstack->cs_idx] != current_exception) {
internal_error("ex_finally()");
@@ -1666,21 +1661,20 @@ void ex_endtry(exarg_T *eap)
}
}
- /* If there was no finally clause, show the user when debugging or
- * a breakpoint was encountered that the end of the try conditional has
- * been reached: display the debug prompt (if not already done). Do
- * this on normal control flow or when an exception was thrown, but not
- * on an interrupt or error not converted to an exception or when
- * a ":break", ":continue", ":return", or ":finish" is pending. These
- * actions are carried out immediately.
- */
+ // If there was no finally clause, show the user when debugging or
+ // a breakpoint was encountered that the end of the try conditional has
+ // been reached: display the debug prompt (if not already done). Do
+ // this on normal control flow or when an exception was thrown, but not
+ // on an interrupt or error not converted to an exception or when
+ // a ":break", ":continue", ":return", or ":finish" is pending. These
+ // actions are carried out immediately.
if ((rethrow || (!skip
&& !(cstack->cs_flags[idx] & CSF_FINALLY)
&& !cstack->cs_pending[idx]))
&& dbg_check_skipped(eap)) {
- /* Handle a ">quit" debug command as if an interrupt had occurred
- * before the ":endtry". That is, throw an interrupt exception and
- * set "skip" and "rethrow". */
+ // Handle a ">quit" debug command as if an interrupt had occurred
+ // before the ":endtry". That is, throw an interrupt exception and
+ // set "skip" and "rethrow".
if (got_int) {
skip = TRUE;
(void)do_intthrow(cstack);
@@ -1815,13 +1809,12 @@ void enter_cleanup(cleanup_T *csp)
| (current_exception ? CSTP_THROW : 0)
| (need_rethrow ? CSTP_THROW : 0);
- /* If we are currently throwing an exception, save it as well. On an error
- * not yet converted to an exception, update "force_abort" and reset
- * "cause_abort" (as do_errthrow() would do). This is needed for the
- * do_cmdline() call that is going to be made for autocommand execution. We
- * need not save *msg_list because there is an extra instance for every call
- * of do_cmdline(), anyway.
- */
+ // If we are currently throwing an exception, save it as well. On an error
+ // not yet converted to an exception, update "force_abort" and reset
+ // "cause_abort" (as do_errthrow() would do). This is needed for the
+ // do_cmdline() call that is going to be made for autocommand execution. We
+ // need not save *msg_list because there is an extra instance for every call
+ // of do_cmdline(), anyway.
if (current_exception || need_rethrow) {
csp->exception = current_exception;
current_exception = NULL;
@@ -1897,13 +1890,10 @@ void leave_cleanup(cleanup_T *csp)
*/
if (pending & CSTP_THROW) {
current_exception = csp->exception;
- }
- /*
- * If an error was about to be converted to an exception when
- * enter_cleanup() was called, let "cause_abort" take the part of
- * "force_abort" (as done by cause_errthrow()).
- */
- else if (pending & CSTP_ERROR) {
+ } else if (pending & CSTP_ERROR) {
+ // If an error was about to be converted to an exception when
+ // enter_cleanup() was called, let "cause_abort" take the part of
+ // "force_abort" (as done by cause_errthrow()).
cause_abort = force_abort;
force_abort = FALSE;
}
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 62a4d48645..79c36576d5 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -2625,8 +2625,8 @@ static void realloc_cmdbuff(int len)
char_u *p = ccline.cmdbuff;
alloc_cmdbuff(len); // will get some more
- /* There isn't always a NUL after the command, but it may need to be
- * there, thus copy up to the NUL and add a NUL. */
+ // There isn't always a NUL after the command, but it may need to be
+ // there, thus copy up to the NUL and add a NUL.
memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen);
ccline.cmdbuff[ccline.cmdlen] = NUL;
xfree(p);
@@ -3427,24 +3427,24 @@ static bool cmdline_paste(int regname, bool literally, bool remcr)
bool allocated;
struct cmdline_info save_ccline;
- /* check for valid regname; also accept special characters for CTRL-R in
- * the command line */
+ // check for valid regname; also accept special characters for CTRL-R in
+ // the command line
if (regname != Ctrl_F && regname != Ctrl_P && regname != Ctrl_W
&& regname != Ctrl_A && regname != Ctrl_L
&& !valid_yank_reg(regname, false)) {
return FAIL;
}
- /* A register containing CTRL-R can cause an endless loop. Allow using
- * CTRL-C to break the loop. */
+ // A register containing CTRL-R can cause an endless loop. Allow using
+ // CTRL-C to break the loop.
line_breakcheck();
if (got_int) {
return FAIL;
}