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); return (char_u *)xmemdupz(start, len);
} }
/* A name starting with "<SID>" or "<SNR>" is local to a script. But // 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". */ // don't skip over "s:", get_lval() needs it for "s:dict.func".
lead = eval_fname_script((const char *)start); lead = eval_fname_script((const char *)start);
if (lead > 2) { if (lead > 2) {
start += lead; start += lead;
@@ -2405,14 +2405,14 @@ void ex_function(exarg_T *eap)
// Add the line to the function. // Add the line to the function.
ga_grow(&newlines, 1 + sourcing_lnum_off); ga_grow(&newlines, 1 + sourcing_lnum_off);
/* Copy the line to newly allocated memory. get_one_sourceline() // Copy the line to newly allocated memory. get_one_sourceline()
* allocates 250 bytes per line, this saves 80% on average. The cost // allocates 250 bytes per line, this saves 80% on average. The cost
* is an extra alloc/free. */ // is an extra alloc/free.
p = vim_strsave(theline); p = vim_strsave(theline);
((char_u **)(newlines.ga_data))[newlines.ga_len++] = p; ((char_u **)(newlines.ga_data))[newlines.ga_len++] = p;
/* Add NULL lines for continuation lines, so that the line count is // Add NULL lines for continuation lines, so that the line count is
* equal to the index in the growarray. */ // equal to the index in the growarray.
while (sourcing_lnum_off-- > 0) { while (sourcing_lnum_off-- > 0) {
((char_u **)(newlines.ga_data))[newlines.ga_len++] = NULL; ((char_u **)(newlines.ga_data))[newlines.ga_len++] = NULL;
} }
@@ -2490,8 +2490,8 @@ void ex_function(exarg_T *eap)
goto erret; goto erret;
} }
/* Give the function a sequential number. Can only be used with a // Give the function a sequential number. Can only be used with a
* Funcref! */ // Funcref!
xfree(name); xfree(name);
sprintf(numbuf, "%d", ++func_nr); sprintf(numbuf, "%d", ++func_nr);
name = vim_strsave((char_u *)numbuf); 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; cstack->cs_pending[idx] = CSTP_RETURN;
if (!is_cmd && !reanimate) { if (!is_cmd && !reanimate) {
/* A pending return again gets pending. "rettv" points to an // A pending return again gets pending. "rettv" points to an
* allocated variable with the rettv of the original ":return"'s // allocated variable with the rettv of the original ":return"'s
* argument if present or is NULL else. */ // argument if present or is NULL else.
cstack->cs_rettv[idx] = rettv; cstack->cs_rettv[idx] = rettv;
} else { } else {
/* When undoing a return in order to make it pending, get the stored // When undoing a return in order to make it pending, get the stored
* return rettv. */ // return rettv.
if (reanimate) { if (reanimate) {
assert(current_funccal->rettv); assert(current_funccal->rettv);
rettv = current_funccal->rettv; rettv = current_funccal->rettv;
@@ -3214,8 +3214,8 @@ int func_has_ended(void *cookie)
{ {
funccall_T *fcp = (funccall_T *)cookie; funccall_T *fcp = (funccall_T *)cookie;
/* Ignore the "abort" flag if the abortion behavior has been changed due to // Ignore the "abort" flag if the abortion behavior has been changed due to
* an error inside a try conditional. */ // an error inside a try conditional.
return ((fcp->func->uf_flags & FC_ABORT) && did_emsg && !aborted_in_try()) return ((fcp->func->uf_flags & FC_ABORT) && did_emsg && !aborted_in_try())
|| fcp->returned; || 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; break;
} }
/* If lines have been inserted/deleted we give up. // If lines have been inserted/deleted we give up.
* Also when the line was included in a multi-line save. */ // Also when the line was included in a multi-line save.
if ((buf->b_u_newhead->uh_getbot_entry != uep if ((buf->b_u_newhead->uh_getbot_entry != uep
? (uep->ue_top + uep->ue_size + 1 ? (uep->ue_top + uep->ue_size + 1
!= (uep->ue_bot == 0 != (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 it's the same line we can skip saving it again.
if (uep->ue_size == 1 && uep->ue_top == top) { if (uep->ue_size == 1 && uep->ue_top == top) {
if (i > 0) { if (i > 0) {
/* It's not the last entry: get ue_bot for the last // It's not the last entry: get ue_bot for the last
* entry now. Following deleted/inserted lines go to // entry now. Following deleted/inserted lines go to
* the re-used entry. */ // the re-used entry.
u_getbot(buf); u_getbot(buf);
buf->b_u_synced = false; buf->b_u_synced = false;
/* Move the found entry to become the last entry. The // Move the found entry to become the last entry. The
* order of undo/redo doesn't matter for the entries // order of undo/redo doesn't matter for the entries
* we move it over, since they don't change the line // we move it over, since they don't change the line
* count and don't include this line. It does matter // count and don't include this line. It does matter
* for the found entry if the line count is changed by // for the found entry if the line count is changed by
* the executed command. */ // the executed command.
prev_uep->ue_next = uep->ue_next; prev_uep->ue_next = uep->ue_next;
uep->ue_next = buf->b_u_newhead->uh_entry; uep->ue_next = buf->b_u_newhead->uh_entry;
buf->b_u_newhead->uh_entry = uep; 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. // Strip any sticky and executable bits.
perm = perm & 0666; perm = perm & 0666;
/* If the undo file already exists, verify that it actually is an undo // If the undo file already exists, verify that it actually is an undo
* file, and delete it. */ // file, and delete it.
if (os_path_exists((char_u *)file_name)) { if (os_path_exists((char_u *)file_name)) {
if (name == NULL || !forceit) { if (name == NULL || !forceit) {
// Check we can read it and it's an undo file. // 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); os_remove(file_name);
} }
/* If there is no undo information at all, quit here after deleting any // If there is no undo information at all, quit here after deleting any
* existing undo file. */ // existing undo file.
if (buf->b_u_numhead == 0 && buf->b_u_line_ptr == NULL) { if (buf->b_u_numhead == 0 && buf->b_u_line_ptr == NULL) {
if (p_verbose > 0) { if (p_verbose > 0) {
verb_msg(_("Skipping undo file write, nothing to undo")); 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; u_oldcount = -1;
} }
while (count--) { while (count--) {
/* Do the change warning now, so that it triggers FileChangedRO when // Do the change warning now, so that it triggers FileChangedRO when
* needed. This may cause the file to be reloaded, that must happen // needed. This may cause the file to be reloaded, that must happen
* before we do anything, because it may change curbuf->b_u_curhead // before we do anything, because it may change curbuf->b_u_curhead
* and more. */ // and more.
change_warning(curbuf, 0); change_warning(curbuf, 0);
if (undo_undoes) { if (undo_undoes) {
@@ -1987,16 +1987,16 @@ void undo_time(long step, bool sec, bool file, bool absolute)
uhp = curbuf->b_u_newhead; uhp = curbuf->b_u_newhead;
} }
if (uhp != NULL && uhp->uh_save_nr != 0) { if (uhp != NULL && uhp->uh_save_nr != 0) {
/* "uh_save_nr" was set in the last block, that means // "uh_save_nr" was set in the last block, that means
* there were no changes since the last write */ // there were no changes since the last write
target = curbuf->b_u_save_nr_cur + step; target = curbuf->b_u_save_nr_cur + step;
} else { } else {
// count the changes since the last write as one step // count the changes since the last write as one step
target = curbuf->b_u_save_nr_cur + step + 1; target = curbuf->b_u_save_nr_cur + step + 1;
} }
if (target <= 0) { if (target <= 0) {
/* Go to before first write: before the oldest change. Use // Go to before first write: before the oldest change. Use
* the sequence number for that. */ // the sequence number for that.
dofile = false; dofile = false;
} }
} else { } 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 * When using the closest time we use the sequence number in the second
* round, because there may be several entries with the same time. * round, because there may be several entries with the same time.
*/ */
for (round = 1; round <= 2; ++round) { for (round = 1; round <= 2; round++) {
/* Find the path from the current state to where we want to go. The // 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 // 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, // it. We put "nomark" in uh_walk where we have been without success,
* "mark" where it could possibly be. */ // "mark" where it could possibly be.
mark = ++lastmark; mark = ++lastmark;
nomark = ++lastmark; nomark = ++lastmark;
@@ -2519,10 +2519,10 @@ static void u_undoredo(int undo, bool do_buf_event)
beginline(BL_SOL | BL_FIX); beginline(BL_SOL | BL_FIX);
} }
} else { } else {
/* We get here with the current cursor line being past the end (eg // 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). // 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 // check_cursor() will move the cursor to the last line. Move it to
* the first column here. */ // the first column here.
curwin->w_cursor.col = 0; curwin->w_cursor.col = 0;
curwin->w_cursor.coladd = 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". // Remember where we are for "g-" and ":earlier 10s".
curbuf->b_u_seq_cur = curhead->uh_seq; curbuf->b_u_seq_cur = curhead->uh_seq;
if (undo) { if (undo) {
/* We are below the previous undo. However, to make ":earlier 1s" // We are below the previous undo. However, to make ":earlier 1s"
* work we compute this as being just above the just undone change. */ // work we compute this as being just above the just undone change.
curbuf->b_u_seq_cur = curhead->uh_next.ptr ? curbuf->b_u_seq_cur = curhead->uh_next.ptr ?
curhead->uh_next.ptr->uh_seq : 0; curhead->uh_next.ptr->uh_seq : 0;
} }

View File

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