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-06 11:48:09 +02:00
parent acd5e831b6
commit d6c789a571
2 changed files with 118 additions and 120 deletions

View File

@ -69,8 +69,8 @@
* All data is allocated and will all be freed when the buffer is unloaded.
*/
/* Uncomment the next line for including the u_check() function. This warns
* for errors in the debug information. */
// Uncomment the next line for including the u_check() function. This warns
// for errors in the debug information.
// #define U_DEBUG 1
#define UH_MAGIC 0x18dade // value for uh_magic when in use
#define UE_MAGIC 0xabc123 // value for ue_magic when in use
@ -291,8 +291,8 @@ bool undo_allowed(buf_T *buf)
return false;
}
/* Don't allow changes in the buffer while editing the cmdline. The
* caller of getcmdline() may get confused. */
// Don't allow changes in the buffer while editing the cmdline. The
// caller of getcmdline() may get confused.
if (textlock != 0) {
EMSG(_(e_secure));
return false;
@ -1921,8 +1921,8 @@ static void u_doit(int startcount, bool quiet, bool do_buf_event)
u_undoredo(false, do_buf_event);
/* Advance for next redo. Set "newhead" when at the end of the
* redoable changes. */
// Advance for next redo. Set "newhead" when at the end of the
// redoable changes.
if (curbuf->b_u_curhead->uh_prev.ptr == NULL) {
curbuf->b_u_newhead = curbuf->b_u_curhead;
}
@ -1967,8 +1967,8 @@ void undo_time(long step, bool sec, bool file, bool absolute)
u_oldcount = -1;
}
/* "target" is the node below which we want to be.
* Init "closest" to a value we can't reach. */
// "target" is the node below which we want to be.
// Init "closest" to a value we can't reach.
if (absolute) {
target = step;
closest = -1;
@ -1977,9 +1977,9 @@ void undo_time(long step, bool sec, bool file, bool absolute)
target = (long)(curbuf->b_u_time_cur) + step;
} else if (dofile) {
if (step < 0) {
/* Going back to a previous write. If there were changes after
* the last write, count that as moving one file-write, so
* that ":earlier 1f" undoes all changes since the last save. */
// Going back to a previous write. If there were changes after
// the last write, count that as moving one file-write, so
// that ":earlier 1f" undoes all changes since the last save.
uhp = curbuf->b_u_curhead;
if (uhp != NULL) {
uhp = uhp->uh_next.ptr;
@ -2003,8 +2003,8 @@ void undo_time(long step, bool sec, bool file, bool absolute)
// Moving forward to a newer write.
target = curbuf->b_u_save_nr_cur + step;
if (target > curbuf->b_u_save_nr_last) {
/* Go to after last write: after the latest change. Use
* the sequence number for that. */
// Go to after last write: after the latest change. Use
// the sequence number for that.
target = curbuf->b_u_seq_last + 1;
dofile = false;
}
@ -2072,10 +2072,10 @@ void undo_time(long step, bool sec, bool file, bool absolute)
}
if (round == 1 && !(dofile && val == 0)) {
/* Remember the header that is closest to the target.
* It must be at least in the right direction (checked with
* "b_u_seq_cur"). When the timestamp is equal find the
* highest/lowest sequence number. */
// Remember the header that is closest to the target.
// It must be at least in the right direction (checked with
// "b_u_seq_cur"). When the timestamp is equal find the
// highest/lowest sequence number.
if ((step < 0 ? uhp->uh_seq <= curbuf->b_u_seq_cur
: uhp->uh_seq > curbuf->b_u_seq_cur)
&& ((dosec && val == closest)
@ -2095,8 +2095,8 @@ void undo_time(long step, bool sec, bool file, bool absolute)
}
}
/* Quit searching when we found a match. But when searching for a
* time we need to continue looking for the best uh_seq. */
// Quit searching when we found a match. But when searching for a
// time we need to continue looking for the best uh_seq.
if (target == val && !dosec) {
target = uhp->uh_seq;
break;
@ -2112,12 +2112,11 @@ void undo_time(long step, bool sec, bool file, bool absolute)
&& uhp->uh_alt_next.ptr->uh_walk != nomark
&& uhp->uh_alt_next.ptr->uh_walk != mark) {
uhp = uhp->uh_alt_next.ptr;
}
/* go up in the tree if we haven't been there and we are at the
* start of alternate branches */
else if (uhp->uh_next.ptr != NULL && uhp->uh_alt_prev.ptr == NULL
&& uhp->uh_next.ptr->uh_walk != nomark
&& uhp->uh_next.ptr->uh_walk != mark) {
} else if (uhp->uh_next.ptr != NULL && uhp->uh_alt_prev.ptr == NULL
// go up in the tree if we haven't been there and we are at the
// start of alternate branches
&& uhp->uh_next.ptr->uh_walk != nomark
&& uhp->uh_next.ptr->uh_walk != mark) {
// If still at the start we don't go through this change.
if (uhp == curbuf->b_u_curhead) {
uhp->uh_walk = nomark;
@ -2297,8 +2296,8 @@ static void u_undoredo(int undo, bool do_buf_event)
bool empty_buffer; // buffer became empty
u_header_T *curhead = curbuf->b_u_curhead;
/* Don't want autocommands using the undo structures here, they are
* invalid till the end. */
// Don't want autocommands using the undo structures here, they are
// invalid till the end.
block_autocmds();
#ifdef U_DEBUG
@ -2549,8 +2548,8 @@ static void u_undoredo(int undo, bool do_buf_event)
}
}
/* The timestamp can be the same for multiple changes, just use the one of
* the undone/redone change. */
// The timestamp can be the same for multiple changes, just use the one of
// the undone/redone change.
curbuf->b_u_time_cur = curhead->uh_time;
unblock_autocmds();
@ -2709,12 +2708,11 @@ void ex_undolist(exarg_T *eap)
&& uhp->uh_alt_next.ptr->uh_walk != nomark
&& uhp->uh_alt_next.ptr->uh_walk != mark) {
uhp = uhp->uh_alt_next.ptr;
}
/* go up in the tree if we haven't been there and we are at the
* start of alternate branches */
else if (uhp->uh_next.ptr != NULL && uhp->uh_alt_prev.ptr == NULL
&& uhp->uh_next.ptr->uh_walk != nomark
&& uhp->uh_next.ptr->uh_walk != mark) {
} else if (uhp->uh_next.ptr != NULL && uhp->uh_alt_prev.ptr == NULL
// go up in the tree if we haven't been there and we are at the
// start of alternate branches
&& uhp->uh_next.ptr->uh_walk != nomark
&& uhp->uh_next.ptr->uh_walk != mark) {
uhp = uhp->uh_next.ptr;
--changes;
} else {
@ -2906,8 +2904,8 @@ static void u_freeheader(buf_T *buf, u_header_T *uhp, u_header_T **uhpp)
{
u_header_T *uhap;
/* When there is an alternate redo list free that branch completely,
* because we can never go there. */
// When there is an alternate redo list free that branch completely,
// because we can never go there.
if (uhp->uh_alt_next.ptr != NULL) {
u_freebranch(buf, uhp->uh_alt_next.ptr, uhpp);
}
@ -2942,8 +2940,8 @@ static void u_freebranch(buf_T *buf, u_header_T *uhp, u_header_T **uhpp)
{
u_header_T *tofree, *next;
/* If this is the top branch we may need to use u_freeheader() to update
* all the pointers. */
// If this is the top branch we may need to use u_freeheader() to update
// all the pointers.
if (uhp == buf->b_u_oldhead) {
while (buf->b_u_oldhead != NULL) {
u_freeheader(buf, buf->b_u_oldhead, uhpp);

View File

@ -298,8 +298,8 @@ newwindow:
tabpage_T *oldtab = curtab;
tabpage_T *newtab;
/* First create a new tab with the window, then go back to
* the old tab and close the window there. */
// First create a new tab with the window, then go back to
// the old tab and close the window there.
wp = curwin;
if (win_new_tabpage((int)Prenum, NULL) == OK
&& valid_tabpage(oldtab)) {
@ -519,8 +519,8 @@ wingotofile:
postponed_split = -1;
}
/* Execute the command right here, required when
* "wincmd g}" was used in a function. */
// Execute the command right here, required when
// "wincmd g}" was used in a function.
do_nv_ident('g', xchar);
break;
@ -922,8 +922,8 @@ int win_split(int size, int flags)
return FAIL;
}
/* When creating the help window make a snapshot of the window layout.
* Otherwise clear the snapshot, it's now invalid. */
// When creating the help window make a snapshot of the window layout.
// Otherwise clear the snapshot, it's now invalid.
if (flags & WSP_HELP) {
make_snapshot(SNAP_HELP_IDX);
} else {
@ -1260,8 +1260,8 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
frame_append(curfrp, frp);
}
/* Set w_fraction now so that the cursor keeps the same relative
* vertical position. */
// Set w_fraction now so that the cursor keeps the same relative
// vertical position.
if (!did_set_fraction) {
set_fraction(oldwin);
}
@ -1287,8 +1287,8 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
}
frp->fr_height = curfrp->fr_height;
/* "new_size" of the current window goes to the new window, use
* one column for the vertical separator */
// "new_size" of the current window goes to the new window, use
// one column for the vertical separator
win_new_width(wp, new_size);
if (before) {
wp->w_vsep_width = 1;
@ -1328,8 +1328,8 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
}
frp->fr_width = curfrp->fr_width;
/* "new_size" of the current window goes to the new window, use
* one row for the status line */
// "new_size" of the current window goes to the new window, use
// one row for the status line
win_new_height(wp, new_size);
if (flags & (WSP_TOP | WSP_BOT)) {
int new_fr_height = curfrp->fr_height - new_size;
@ -1388,8 +1388,8 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
'v');
}
/* Don't change the window height/width to 'winheight' / 'winwidth' if a
* size was given. */
// Don't change the window height/width to 'winheight' / 'winwidth' if a
// size was given.
if (flags & WSP_VERT) {
i = p_wiw;
if (size != 0) {
@ -1589,8 +1589,8 @@ int make_windows(int count, bool vertical)
int todo;
if (vertical) {
/* Each windows needs at least 'winminwidth' lines and a separator
* column. */
// Each windows needs at least 'winminwidth' lines and a separator
// column.
maxcount = (curwin->w_width + curwin->w_vsep_width
- (p_wiw - p_wmw)) / (p_wmw + 1);
} else {
@ -1679,8 +1679,8 @@ static void win_exchange(long Prenum)
frp = curwin->w_frame->fr_prev;
}
/* We can only exchange a window with another window, not with a frame
* containing windows. */
// We can only exchange a window with another window, not with a frame
// containing windows.
if (frp == NULL || frp->fr_win == NULL || frp->fr_win == curwin) {
return;
}
@ -1890,8 +1890,8 @@ void win_move_after(win_T *win1, win_T *win2)
win1->w_status_height = win2->w_status_height;
win2->w_status_height = height;
if (win1->w_vsep_width == 1) {
/* Remove the vertical separator from win1, add it to the last
* window, win2. Adjust the frame widths. */
// Remove the vertical separator from win1, add it to the last
// window, win2. Adjust the frame widths.
win2->w_vsep_width = 1;
win2->w_frame->fr_width += 1;
win1->w_vsep_width = 0;
@ -1955,8 +1955,8 @@ static void win_equal_rec(win_T *next_curwin, bool current, frame_T *topfr, int
bool hnc;
if (topfr->fr_layout == FR_LEAF) {
/* Set the width/height of this frame.
* Redraw when size or position changes */
// Set the width/height of this frame.
// Redraw when size or position changes
if (topfr->fr_height != height || topfr->fr_win->w_winrow != row
|| topfr->fr_width != width ||
topfr->fr_win->w_wincol != col) {
@ -2028,8 +2028,8 @@ static void win_equal_rec(win_T *next_curwin, bool current, frame_T *topfr, int
} else if (totwincount > 1
&& (room + (totwincount - 2))
/ (totwincount - 1) > p_wiw) {
/* Can make all windows wider than 'winwidth', spread
* the room equally. */
// Can make all windows wider than 'winwidth', spread
// the room equally.
next_curwin_size = (room + p_wiw
+ (totwincount - 1) * p_wmw
+ (totwincount - 1)) / totwincount;
@ -2084,8 +2084,8 @@ static void win_equal_rec(win_T *next_curwin, bool current, frame_T *topfr, int
new_size += n;
}
/* Skip frame that is full width when splitting or closing a
* window, unless equalizing all frames. */
// Skip frame that is full width when splitting or closing a
// window, unless equalizing all frames.
if (!current || dir != 'v' || topfr->fr_parent != NULL
|| (new_size != fr->fr_width)
|| frame_has_win(fr, next_curwin)) {
@ -2120,8 +2120,8 @@ static void win_equal_rec(win_T *next_curwin, bool current, frame_T *topfr, int
m = frame_minheight(topfr, next_curwin);
room = height - m;
if (room < 0) {
/* The room is less then 'winheight', use all space for the
* current window. */
// The room is less then 'winheight', use all space for the
// current window.
next_curwin_size = p_wh + room;
room = 0;
} else {
@ -2159,8 +2159,8 @@ static void win_equal_rec(win_T *next_curwin, bool current, frame_T *topfr, int
} else if (totwincount > 1
&& (room + (totwincount - 2))
/ (totwincount - 1) > p_wh) {
/* can make all windows higher than 'winheight',
* spread the room equally. */
// can make all windows higher than 'winheight',
// spread the room equally.
next_curwin_size = (room + p_wh
+ (totwincount - 1) * p_wmh
+ (totwincount - 1)) / totwincount;
@ -2214,8 +2214,8 @@ static void win_equal_rec(win_T *next_curwin, bool current, frame_T *topfr, int
}
new_size += n;
}
/* Skip frame that is full width when splitting or closing a
* window, unless equalizing all frames. */
// Skip frame that is full width when splitting or closing a
// window, unless equalizing all frames.
if (!current || dir != 'h' || topfr->fr_parent != NULL
|| (new_size != fr->fr_height)
|| frame_has_win(fr, next_curwin)) {
@ -2263,8 +2263,8 @@ void close_windows(buf_T *buf, int keep_curwin)
&& !(wp->w_closing || wp->w_buffer->b_locked > 0)) {
win_close_othertab(wp, false, tp);
/* Start all over, the tab page may be closed and
* autocommands may change the window layout. */
// Start all over, the tab page may be closed and
// autocommands may change the window layout.
nexttp = first_tabpage;
break;
}
@ -2630,8 +2630,8 @@ int win_close(win_T *win, bool free_buf)
*/
last_status(false);
/* After closing the help window, try restoring the window layout from
* before it was opened. */
// After closing the help window, try restoring the window layout from
// before it was opened.
if (help_window) {
restore_snapshot(SNAP_HELP_IDX, close_curwin);
}
@ -2703,8 +2703,8 @@ void win_close_othertab(win_T *win, int free_buf, tabpage_T *tp)
close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, false);
}
/* Careful: Autocommands may have closed the tab page or made it the
* current tab page. */
// Careful: Autocommands may have closed the tab page or made it the
// current tab page.
for (ptp = first_tabpage; ptp != NULL && ptp != tp; ptp = ptp->tp_next) {
;
}
@ -2863,9 +2863,9 @@ win_T *winframe_remove(win_T *win, int *dirp, tabpage_T *tp)
frame_remove(frp_close);
if (frp_close->fr_parent->fr_layout == FR_COL) {
/* When 'winfixheight' is set, try to find another frame in the column
* (as close to the closed frame as possible) to distribute the height
* to. */
// When 'winfixheight' is set, try to find another frame in the column
// (as close to the closed frame as possible) to distribute the height
// to.
if (frp2->fr_win != NULL && frp2->fr_win->w_p_wfh) {
frp = frp_close->fr_prev;
frp3 = frp_close->fr_next;
@ -2922,8 +2922,8 @@ win_T *winframe_remove(win_T *win, int *dirp, tabpage_T *tp)
*dirp = 'h';
}
/* If rows/columns go to a window below/right its positions need to be
* updated. Can only be done after the sizes have been updated. */
// If rows/columns go to a window below/right its positions need to be
// updated. Can only be done after the sizes have been updated.
if (frp2 == frp_close->fr_next) {
int row = win->w_winrow;
int col = win->w_wincol;
@ -2932,8 +2932,8 @@ win_T *winframe_remove(win_T *win, int *dirp, tabpage_T *tp)
}
if (frp2->fr_next == NULL && frp2->fr_prev == NULL) {
/* There is no other frame in this list, move its info to the parent
* and remove it. */
// There is no other frame in this list, move its info to the parent
// and remove it.
frp2->fr_parent->fr_layout = frp2->fr_layout;
frp2->fr_parent->fr_child = frp2->fr_child;
FOR_ALL_FRAMES(frp, frp2->fr_child) {
@ -2951,8 +2951,8 @@ win_T *winframe_remove(win_T *win, int *dirp, tabpage_T *tp)
frp2 = frp->fr_parent;
if (frp2 != NULL && frp2->fr_layout == frp->fr_layout) {
/* The frame above the parent has the same layout, have to merge
* the frames into this list. */
// The frame above the parent has the same layout, have to merge
// the frames into this list.
if (frp2->fr_child == frp) {
frp2->fr_child = frp->fr_child;
}
@ -3641,8 +3641,8 @@ static int win_alloc_firstwin(win_T *oldwin)
{
curwin = win_alloc(NULL, false);
if (oldwin == NULL) {
/* Very first window, need to create an empty buffer for it and
* initialize from scratch. */
// Very first window, need to create an empty buffer for it and
// initialize from scratch.
curbuf = buflist_new(NULL, NULL, 1L, BLN_LISTED);
if (curbuf == NULL) {
return FAIL;
@ -4014,10 +4014,10 @@ static void enter_tabpage(tabpage_T *tp, buf_T *old_curbuf, bool trigger_enter_a
const int row = win_comp_pos(); // recompute w_winrow for all windows
diff_need_scrollbind = true;
/* The tabpage line may have appeared or disappeared, may need to resize
* the frames for that. When the Vim window was resized need to update
* frame sizes too. Use the stored value of p_ch, so that it can be
* different for each tab page. */
// The tabpage line may have appeared or disappeared, may need to resize
// the frames for that. When the Vim window was resized need to update
// frame sizes too. Use the stored value of p_ch, so that it can be
// different for each tab page.
if (p_ch != curtab->tp_ch_used) {
clear_cmdline = true;
}
@ -4112,8 +4112,8 @@ void goto_tabpage(int n)
tp = curtab->tp_next;
}
} else if (n < 0) {
/* "gT": go to previous tab page, wrap around end. "N gT" repeats
* this N times. */
// "gT": go to previous tab page, wrap around end. "N gT" repeats
// this N times.
ttp = curtab;
for (i = n; i < 0; ++i) {
for (tp = first_tabpage; tp->tp_next != ttp && tp->tp_next != NULL;
@ -4677,9 +4677,9 @@ static win_T *win_alloc(win_T *after, bool hidden)
new_wp->w_vars = tv_dict_alloc();
init_var_dict(new_wp->w_vars, &new_wp->w_winvar, VAR_SCOPE);
/* Don't execute autocommands while the window is not properly
* initialized yet. gui_create_scrollbar() may trigger a FocusGained
* event. */
// Don't execute autocommands while the window is not properly
// initialized yet. gui_create_scrollbar() may trigger a FocusGained
// event.
block_autocmds();
/*
* link the window in the window list
@ -4742,8 +4742,8 @@ static void win_free(win_T *wp, tabpage_T *tp)
// reduce the reference count to the argument list.
alist_unlink(wp->w_alist);
/* Don't execute autocommands while the window is halfway being deleted.
* gui_mch_destroy_scrollbar() may trigger a FocusGained event. */
// Don't execute autocommands while the window is halfway being deleted.
// gui_mch_destroy_scrollbar() may trigger a FocusGained event.
block_autocmds();
clear_winopt(&wp->w_onebuf_opt);
@ -5200,8 +5200,8 @@ static void frame_setheight(frame_T *curfrp, int height)
frame_new_height(curfrp, height, false, false);
}
} else if (curfrp->fr_parent->fr_layout == FR_ROW) {
/* Row of frames: Also need to resize frames left and right of this
* one. First check for the minimal height of these. */
// Row of frames: Also need to resize frames left and right of this
// one. First check for the minimal height of these.
h = frame_minheight(curfrp->fr_parent, NULL);
if (height < h) {
height = h;
@ -5261,13 +5261,13 @@ static void frame_setheight(frame_T *curfrp, int height)
*/
take = height - curfrp->fr_height;
/* If there is not enough room, also reduce the height of a window
* with 'winfixheight' set. */
// If there is not enough room, also reduce the height of a window
// with 'winfixheight' set.
if (height > room + room_cmdline - room_reserved) {
room_reserved = room + room_cmdline - height;
}
/* If there is only a 'winfixheight' window and making the
* window smaller, need to make the other window taller. */
// If there is only a 'winfixheight' window and making the
// window smaller, need to make the other window taller.
if (take < 0 && room - curfrp->fr_height < room_reserved) {
room_reserved = 0;
}
@ -5342,8 +5342,8 @@ void win_setwidth(int width)
void win_setwidth_win(int width, win_T *wp)
{
/* Always keep current window at least one column wide, even when
* 'winminwidth' is zero. */
// Always keep current window at least one column wide, even when
// 'winminwidth' is zero.
if (wp == curwin) {
if (width < p_wmw) {
width = p_wmw;
@ -5394,8 +5394,8 @@ static void frame_setwidth(frame_T *curfrp, int width)
}
if (curfrp->fr_parent->fr_layout == FR_COL) {
/* Column of frames: Also need to resize frames above and below of
* this one. First check for the minimal width of these. */
// Column of frames: Also need to resize frames above and below of
// this one. First check for the minimal width of these.
w = frame_minwidth(curfrp->fr_parent, NULL);
if (width < w) {
width = w;
@ -5442,13 +5442,13 @@ static void frame_setwidth(frame_T *curfrp, int width)
*/
take = width - curfrp->fr_width;
/* If there is not enough room, also reduce the width of a window
* with 'winfixwidth' set. */
// If there is not enough room, also reduce the width of a window
// with 'winfixwidth' set.
if (width > room - room_reserved) {
room_reserved = room - width;
}
/* If there is only a 'winfixwidth' window and making the
* window smaller, need to make the other window narrower. */
// If there is only a 'winfixwidth' window and making the
// window smaller, need to make the other window narrower.
if (take < 0 && room - curfrp->fr_width < room_reserved) {
room_reserved = 0;
}
@ -5557,8 +5557,8 @@ void win_drag_status_line(win_T *dragwin, int offset)
curfr = fr;
if (fr != topframe) { // more than one window
fr = fr->fr_parent;
/* When the parent frame is not a column of frames, its parent should
* be. */
// When the parent frame is not a column of frames, its parent should
// be.
if (fr->fr_layout != FR_COL) {
curfr = fr;
if (fr != topframe) { // only a row of windows, may drag statusline
@ -6009,9 +6009,9 @@ void command_height(void)
frame_T *frp;
int old_p_ch = curtab->tp_ch_used;
/* Use the value of p_ch that we remembered. This is needed for when the
* GUI starts up, we can't be sure in what order things happen. And when
* p_ch was changed in another tab page. */
// Use the value of p_ch that we remembered. This is needed for when the
// GUI starts up, we can't be sure in what order things happen. And when
// p_ch was changed in another tab page.
curtab->tp_ch_used = p_ch;
// Find bottom frame with width of screen.
@ -6270,8 +6270,8 @@ static void last_status_rec(frame_T *fr, bool statusline)
EMSG(_(e_noroom));
return;
}
/* In a column of frames: go to frame above. If already at
* the top or in a row of frames: go to parent. */
// In a column of frames: go to frame above. If already at
// the top or in a row of frames: go to parent.
if (fp->fr_parent->fr_layout == FR_COL && fp->fr_prev != NULL) {
fp = fp->fr_prev;
} else {