vim-patch:8.1.2396: using old C style comments

Problem:    Using old C style comments.
Solution:   Use // comments where appropriate.
e38eab22c1
This commit is contained in:
Dundar Göc 2021-10-21 11:10:39 +02:00
parent 8000f6d566
commit e59c0009a7
3 changed files with 93 additions and 95 deletions

View File

@ -1720,8 +1720,8 @@ char_u *trans_function_name(char_u **pp, bool skip, int flags, funcdict_T *fdp,
return (char_u *)xmemdupz(start, len);
}
/* A name starting with "<SID>" or "<SNR>" is local to a script. But
* don't skip over "s:", get_lval() needs it for "s:dict.func". */
// A name starting with "<SID>" or "<SNR>" is local to a script. But
// don't skip over "s:", get_lval() needs it for "s:dict.func".
lead = eval_fname_script((const char *)start);
if (lead > 2) {
start += lead;
@ -2405,14 +2405,14 @@ void ex_function(exarg_T *eap)
// Add the line to the function.
ga_grow(&newlines, 1 + sourcing_lnum_off);
/* Copy the line to newly allocated memory. get_one_sourceline()
* allocates 250 bytes per line, this saves 80% on average. The cost
* is an extra alloc/free. */
// Copy the line to newly allocated memory. get_one_sourceline()
// allocates 250 bytes per line, this saves 80% on average. The cost
// is an extra alloc/free.
p = vim_strsave(theline);
((char_u **)(newlines.ga_data))[newlines.ga_len++] = p;
/* Add NULL lines for continuation lines, so that the line count is
* equal to the index in the growarray. */
// Add NULL lines for continuation lines, so that the line count is
// equal to the index in the growarray.
while (sourcing_lnum_off-- > 0) {
((char_u **)(newlines.ga_data))[newlines.ga_len++] = NULL;
}
@ -2490,8 +2490,8 @@ void ex_function(exarg_T *eap)
goto erret;
}
/* Give the function a sequential number. Can only be used with a
* Funcref! */
// Give the function a sequential number. Can only be used with a
// Funcref!
xfree(name);
sprintf(numbuf, "%d", ++func_nr);
name = vim_strsave((char_u *)numbuf);
@ -3079,13 +3079,13 @@ int do_return(exarg_T *eap, int reanimate, int is_cmd, void *rettv)
cstack->cs_pending[idx] = CSTP_RETURN;
if (!is_cmd && !reanimate) {
/* A pending return again gets pending. "rettv" points to an
* allocated variable with the rettv of the original ":return"'s
* argument if present or is NULL else. */
// A pending return again gets pending. "rettv" points to an
// allocated variable with the rettv of the original ":return"'s
// argument if present or is NULL else.
cstack->cs_rettv[idx] = rettv;
} else {
/* When undoing a return in order to make it pending, get the stored
* return rettv. */
// When undoing a return in order to make it pending, get the stored
// return rettv.
if (reanimate) {
assert(current_funccal->rettv);
rettv = current_funccal->rettv;
@ -3214,8 +3214,8 @@ int func_has_ended(void *cookie)
{
funccall_T *fcp = (funccall_T *)cookie;
/* Ignore the "abort" flag if the abortion behavior has been changed due to
* an error inside a try conditional. */
// Ignore the "abort" flag if the abortion behavior has been changed due to
// an error inside a try conditional.
return ((fcp->func->uf_flags & FC_ABORT) && did_emsg && !aborted_in_try())
|| fcp->returned;
}

View File

@ -503,8 +503,8 @@ int u_savecommon(buf_T *buf, linenr_T top, linenr_T bot, linenr_T newbot, int re
break;
}
/* If lines have been inserted/deleted we give up.
* Also when the line was included in a multi-line save. */
// If lines have been inserted/deleted we give up.
// Also when the line was included in a multi-line save.
if ((buf->b_u_newhead->uh_getbot_entry != uep
? (uep->ue_top + uep->ue_size + 1
!= (uep->ue_bot == 0
@ -520,18 +520,18 @@ int u_savecommon(buf_T *buf, linenr_T top, linenr_T bot, linenr_T newbot, int re
// If it's the same line we can skip saving it again.
if (uep->ue_size == 1 && uep->ue_top == top) {
if (i > 0) {
/* It's not the last entry: get ue_bot for the last
* entry now. Following deleted/inserted lines go to
* the re-used entry. */
// It's not the last entry: get ue_bot for the last
// entry now. Following deleted/inserted lines go to
// the re-used entry.
u_getbot(buf);
buf->b_u_synced = false;
/* Move the found entry to become the last entry. The
* order of undo/redo doesn't matter for the entries
* we move it over, since they don't change the line
* count and don't include this line. It does matter
* for the found entry if the line count is changed by
* the executed command. */
// Move the found entry to become the last entry. The
// order of undo/redo doesn't matter for the entries
// we move it over, since they don't change the line
// count and don't include this line. It does matter
// for the found entry if the line count is changed by
// the executed command.
prev_uep->ue_next = uep->ue_next;
uep->ue_next = buf->b_u_newhead->uh_entry;
buf->b_u_newhead->uh_entry = uep;
@ -1213,8 +1213,8 @@ void u_write_undo(const char *const name, const bool forceit, buf_T *const buf,
// Strip any sticky and executable bits.
perm = perm & 0666;
/* If the undo file already exists, verify that it actually is an undo
* file, and delete it. */
// If the undo file already exists, verify that it actually is an undo
// file, and delete it.
if (os_path_exists((char_u *)file_name)) {
if (name == NULL || !forceit) {
// Check we can read it and it's an undo file.
@ -1254,8 +1254,8 @@ void u_write_undo(const char *const name, const bool forceit, buf_T *const buf,
os_remove(file_name);
}
/* If there is no undo information at all, quit here after deleting any
* existing undo file. */
// If there is no undo information at all, quit here after deleting any
// existing undo file.
if (buf->b_u_numhead == 0 && buf->b_u_line_ptr == NULL) {
if (p_verbose > 0) {
verb_msg(_("Skipping undo file write, nothing to undo"));
@ -1883,10 +1883,10 @@ static void u_doit(int startcount, bool quiet, bool do_buf_event)
u_oldcount = -1;
}
while (count--) {
/* Do the change warning now, so that it triggers FileChangedRO when
* needed. This may cause the file to be reloaded, that must happen
* before we do anything, because it may change curbuf->b_u_curhead
* and more. */
// Do the change warning now, so that it triggers FileChangedRO when
// needed. This may cause the file to be reloaded, that must happen
// before we do anything, because it may change curbuf->b_u_curhead
// and more.
change_warning(curbuf, 0);
if (undo_undoes) {
@ -1987,16 +1987,16 @@ void undo_time(long step, bool sec, bool file, bool absolute)
uhp = curbuf->b_u_newhead;
}
if (uhp != NULL && uhp->uh_save_nr != 0) {
/* "uh_save_nr" was set in the last block, that means
* there were no changes since the last write */
// "uh_save_nr" was set in the last block, that means
// there were no changes since the last write
target = curbuf->b_u_save_nr_cur + step;
} else {
// count the changes since the last write as one step
target = curbuf->b_u_save_nr_cur + step + 1;
}
if (target <= 0) {
/* Go to before first write: before the oldest change. Use
* the sequence number for that. */
// Go to before first write: before the oldest change. Use
// the sequence number for that.
dofile = false;
}
} else {
@ -2047,11 +2047,11 @@ void undo_time(long step, bool sec, bool file, bool absolute)
* When using the closest time we use the sequence number in the second
* round, because there may be several entries with the same time.
*/
for (round = 1; round <= 2; ++round) {
/* Find the path from the current state to where we want to go. The
* desired state can be anywhere in the undo tree, need to go all over
* it. We put "nomark" in uh_walk where we have been without success,
* "mark" where it could possibly be. */
for (round = 1; round <= 2; round++) {
// Find the path from the current state to where we want to go. The
// desired state can be anywhere in the undo tree, need to go all over
// it. We put "nomark" in uh_walk where we have been without success,
// "mark" where it could possibly be.
mark = ++lastmark;
nomark = ++lastmark;
@ -2519,10 +2519,10 @@ static void u_undoredo(int undo, bool do_buf_event)
beginline(BL_SOL | BL_FIX);
}
} else {
/* We get here with the current cursor line being past the end (eg
* after adding lines at the end of the file, and then undoing it).
* check_cursor() will move the cursor to the last line. Move it to
* the first column here. */
// We get here with the current cursor line being past the end (eg
// after adding lines at the end of the file, and then undoing it).
// check_cursor() will move the cursor to the last line. Move it to
// the first column here.
curwin->w_cursor.col = 0;
curwin->w_cursor.coladd = 0;
}
@ -2533,8 +2533,8 @@ static void u_undoredo(int undo, bool do_buf_event)
// Remember where we are for "g-" and ":earlier 10s".
curbuf->b_u_seq_cur = curhead->uh_seq;
if (undo) {
/* We are below the previous undo. However, to make ":earlier 1s"
* work we compute this as being just above the just undone change. */
// We are below the previous undo. However, to make ":earlier 1s"
// work we compute this as being just above the just undone change.
curbuf->b_u_seq_cur = curhead->uh_next.ptr ?
curhead->uh_next.ptr->uh_seq : 0;
}

View File

@ -464,9 +464,8 @@ wingotofile:
}
break;
/* Go to the first occurrence of the identifier under cursor along path in a
* new window -- webb
*/
// Go to the first occurrence of the identifier under cursor along path in a
// new window -- webb
case 'i': // Go to any match
case Ctrl_I:
type = FIND_ANY;
@ -1046,8 +1045,8 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
win_setwidth_win(oldwin->w_width + new_size + 1, oldwin);
}
/* Only make all windows the same width if one of them (except oldwin)
* is wider than one of the split windows. */
// Only make all windows the same width if one of them (except oldwin)
// is wider than one of the split windows.
if (!do_equal && p_ea && size == 0 && *p_ead != 'v'
&& oldwin->w_frame->fr_parent != NULL) {
frp = oldwin->w_frame->fr_parent->fr_child;
@ -1125,9 +1124,9 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
do_equal = true;
}
/* We don't like to take lines for the new window from a
* 'winfixheight' window. Take them from a window above or below
* instead, if possible. */
// We don't like to take lines for the new window from a
// 'winfixheight' window. Take them from a window above or below
// instead, if possible.
if (oldwin->w_p_wfh) {
// Set w_fraction now so that the cursor keeps the same relative
// vertical position using the old height.
@ -1142,8 +1141,8 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
}
}
/* Only make all windows the same height if one of them (except oldwin)
* is higher than one of the split windows. */
// Only make all windows the same height if one of them (except oldwin)
// is higher than one of the split windows.
if (!do_equal && p_ea && size == 0
&& *p_ead != 'h'
&& oldwin->w_frame->fr_parent != NULL) {
@ -1874,15 +1873,14 @@ void win_move_after(win_T *win1, win_T *win2)
// check if there is something to do
if (win2->w_next != win1) {
/* may need move the status line/vertical separator of the last window
* */
// may need move the status line/vertical separator of the last window
if (win1 == lastwin) {
height = win1->w_prev->w_status_height;
win1->w_prev->w_status_height = win1->w_status_height;
win1->w_status_height = height;
if (win1->w_prev->w_vsep_width == 1) {
/* Remove the vertical separator from the last-but-one window,
* add it to the last window. Adjust the frame widths. */
// Remove the vertical separator from the last-but-one window,
// add it to the last window. Adjust the frame widths.
win1->w_prev->w_vsep_width = 0;
win1->w_prev->w_frame->fr_width -= 1;
win1->w_vsep_width = 1;
@ -1974,8 +1972,8 @@ static void win_equal_rec(win_T *next_curwin, bool current, frame_T *topfr, int
topfr->fr_height = height;
if (dir != 'v') { // equalize frame widths
/* Compute the maximum number of windows horizontally in this
* frame. */
// Compute the maximum number of windows horizontally in this
// frame.
n = frame_minwidth(topfr, NOWIN);
// add one for the rightmost window, it doesn't have a separator
if (col + width == Columns) {
@ -2360,8 +2358,8 @@ static bool close_last_window_tabpage(win_T *win, bool free_buf, tabpage_T *prev
char_u prev_idx[NUMBUFLEN];
sprintf((char *)prev_idx, "%i", tabpage_index(prev_curtab));
/* Safety check: Autocommands may have closed the window when jumping
* to the other tab page. */
// Safety check: Autocommands may have closed the window when jumping
// to the other tab page.
if (valid_tabpage(prev_curtab) && prev_curtab->tp_firstwin == win) {
int h = tabline_height();
@ -2421,15 +2419,15 @@ int win_close(win_T *win, bool free_buf)
return FAIL;
}
/* When closing the last window in a tab page first go to another tab page
* and then close the window and the tab page to avoid that curwin and
* curtab are invalid while we are freeing memory. */
// When closing the last window in a tab page first go to another tab page
// and then close the window and the tab page to avoid that curwin and
// curtab are invalid while we are freeing memory.
if (close_last_window_tabpage(win, free_buf, prev_curtab)) {
return FAIL;
}
/* When closing the help window, try restoring a snapshot after closing
* the window. Otherwise clear the snapshot, it's now invalid. */
// When closing the help window, try restoring a snapshot after closing
// the window. Otherwise clear the snapshot, it's now invalid.
if (bt_help(win->w_buffer)) {
help_window = true;
} else {
@ -2575,9 +2573,9 @@ int win_close(win_T *win, bool free_buf)
}
}
/* Make sure curwin isn't invalid. It can cause severe trouble when
* printing an error message. For win_equal() curbuf needs to be valid
* too. */
// Make sure curwin isn't invalid. It can cause severe trouble when
// printing an error message. For win_equal() curbuf needs to be valid
// too.
if (win == curwin) {
curwin = wp;
if (wp->w_p_pvw || bt_quickfix(wp->w_buffer)) {
@ -2895,9 +2893,9 @@ win_T *winframe_remove(win_T *win, int *dirp, tabpage_T *tp)
frp2 == frp_close->fr_next, false);
*dirp = 'v';
} else {
/* When 'winfixwidth' is set, try to find another frame in the column
* (as close to the closed frame as possible) to distribute the width
* to. */
// When 'winfixwidth' is set, try to find another frame in the column
// (as close to the closed frame as possible) to distribute the width
// to.
if (frp2->fr_win != NULL && frp2->fr_win->w_p_wfw) {
frp = frp_close->fr_prev;
frp3 = frp_close->fr_next;
@ -3112,8 +3110,8 @@ static void frame_new_height(frame_T *topfrp, int height, bool topfirst, bool wf
}
} while (frp != NULL);
} else { // fr_layout == FR_COL
/* Complicated case: Resize a column of frames. Resize the bottom
* frame first, frames above that when needed. */
// Complicated case: Resize a column of frames. Resize the bottom
// frame first, frames above that when needed.
frp = topfrp->fr_child;
if (wfh) {
@ -3310,8 +3308,8 @@ static void frame_new_width(frame_T *topfrp, int width, bool leftfirst, bool wfw
}
} while (frp != NULL);
} else { // fr_layout == FR_ROW
/* Complicated case: Resize a row of frames. Resize the rightmost
* frame first, frames left of it when needed. */
// Complicated case: Resize a row of frames. Resize the rightmost
// frame first, frames left of it when needed.
frp = topfrp->fr_child;
if (wfw) {
@ -4043,8 +4041,8 @@ static void enter_tabpage(tabpage_T *tp, buf_T *old_curbuf, bool trigger_enter_a
lastused_tabpage = old_curtab;
/* Apply autocommands after updating the display, when 'rows' and
* 'columns' have been set correctly. */
// Apply autocommands after updating the display, when 'rows' and
// 'columns' have been set correctly.
if (trigger_enter_autocmds) {
apply_autocmds(EVENT_TABENTER, NULL, NULL, false, curbuf);
if (old_curbuf != curbuf) {
@ -4776,8 +4774,8 @@ static void win_free(win_T *wp, tabpage_T *tp)
xfree(wp->w_localdir);
xfree(wp->w_prevdir);
/* Remove the window from the b_wininfo lists, it may happen that the
* freed memory is re-used for another window. */
// Remove the window from the b_wininfo lists, it may happen that the
// freed memory is re-used for another window.
FOR_ALL_BUFFERS(buf) {
for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next) {
if (wip->wi_win == wp) {
@ -4950,8 +4948,8 @@ void shell_new_rows(void)
h = frame_minheight(topframe, NULL);
}
/* First try setting the heights of windows with 'winfixheight'. If
* that doesn't result in the right height, forget about that option. */
// First try setting the heights of windows with 'winfixheight'. If
// that doesn't result in the right height, forget about that option.
frame_new_height(topframe, h, false, true);
if (!frame_check_height(topframe, h)) {
frame_new_height(topframe, h, false, false);
@ -4972,8 +4970,8 @@ void shell_new_columns(void)
return;
}
/* First try setting the widths of windows with 'winfixwidth'. If that
* doesn't result in the right width, forget about that option. */
// First try setting the widths of windows with 'winfixwidth'. If that
// doesn't result in the right width, forget about that option.
frame_new_width(topframe, Columns, false, true);
if (!frame_check_width(topframe, Columns)) {
frame_new_width(topframe, Columns, false, false);
@ -5572,8 +5570,8 @@ void win_drag_status_line(win_T *dragwin, int offset)
}
}
/* If this is the last frame in a column, may want to resize the parent
* frame instead (go two up to skip a row of frames). */
// If this is the last frame in a column, may want to resize the parent
// frame instead (go two up to skip a row of frames).
while (curfr != topframe && curfr->fr_next == NULL) {
if (fr != topframe) {
fr = fr->fr_parent;
@ -5699,8 +5697,8 @@ void win_drag_vsep_line(win_T *dragwin, int offset)
fr = fr->fr_parent;
}
/* If this is the last frame in a row, may want to resize a parent
* frame instead. */
// If this is the last frame in a row, may want to resize a parent
// frame instead.
while (curfr->fr_next == NULL) {
if (fr == topframe) {
break;