From d6c789a57142d4b4425ff7da748c02d14d988cf1 Mon Sep 17 00:00:00 2001 From: Dundar Göc Date: Wed, 6 Oct 2021 11:48:09 +0200 Subject: vim-patch:8.1.2396: using old C style comments Problem: Using old C style comments. Solution: Use // comments where appropriate. https://github.com/vim/vim/commit/e38eab22c1fb950127f0307a9904de6d4561dc70 --- src/nvim/undo.c | 76 +++++++++++++------------ src/nvim/window.c | 162 +++++++++++++++++++++++++++--------------------------- 2 files changed, 118 insertions(+), 120 deletions(-) (limited to 'src/nvim') diff --git a/src/nvim/undo.c b/src/nvim/undo.c index d5857ff8b9..d83c2438e6 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -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); diff --git a/src/nvim/window.c b/src/nvim/window.c index ff97eaa757..0a242c2795 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -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 { -- cgit From e8f87f15d735937f4b548ad40fb8dbaf741f6d0a Mon Sep 17 00:00:00 2001 From: Dundar Göc Date: Wed, 6 Oct 2021 11:45:14 +0200 Subject: vim-patch:8.1.2395: using old C style comments Problem: Using old C style comments. Solution: Use // comments where appropriate. https://github.com/vim/vim/commit/0d6f5d9740dbad1b0207f3ab257de806169dd905 --- src/nvim/spellfile.c | 2 +- src/nvim/syntax.c | 121 +++++++++++++++++++++++++-------------------------- src/nvim/tag.c | 73 +++++++++++++++---------------- 3 files changed, 95 insertions(+), 101 deletions(-) (limited to 'src/nvim') diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index 772275df84..50b12f9dcc 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -2602,7 +2602,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) upp = vim_strsave(items[1]); } else if (is_aff_rule(items, itemcnt, "REP", 2) || is_aff_rule(items, itemcnt, "REPSAL", 2)) { - /* Ignore REP/REPSAL count */; + // Ignore REP/REPSAL count if (!isdigit(*items[1])) { smsg(_("Expected REP(SAL) count in %s line %d"), fname, lnum); diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 49f54dcfe1..ecbfbf8a93 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -230,11 +230,10 @@ struct name_list { static char *(spo_name_tab[SPO_COUNT]) = { "ms=", "me=", "hs=", "he=", "rs=", "re=", "lc=" }; -/* The sp_off_flags are computed like this: - * offset from the start of the matched text: (1 << SPO_XX_OFF) - * offset from the end of the matched text: (1 << (SPO_XX_OFF + SPO_COUNT)) - * When both are present, only one is used. - */ +// The sp_off_flags are computed like this: +// offset from the start of the matched text: (1 << SPO_XX_OFF) +// offset from the end of the matched text: (1 << (SPO_XX_OFF + SPO_COUNT)) +// When both are present, only one is used. #define SPTYPE_MATCH 1 // match keyword with this group ID #define SPTYPE_START 2 // match a regexp, start of item @@ -345,7 +344,7 @@ static int next_seqnr = 1; // value to use for si_seqnr */ static int next_match_col; // column for start of next match static lpos_T next_match_m_endpos; // position for end of next match -static lpos_T next_match_h_startpos; // pos. for highl. start of next match +static lpos_T next_match_h_startpos; // pos. for highl. start of next match static lpos_T next_match_h_endpos; // pos. for highl. end of next match static int next_match_idx; // index of matched item static long next_match_flags; // flags for next match @@ -492,8 +491,8 @@ void syntax_start(win_T *wp, linenr_T lnum) // First line is always valid, no matter "minlines". first_stored = 1; } else { - /* Need to parse "minlines" lines before state can be considered - * valid to store. */ + // Need to parse "minlines" lines before state can be considered + // valid to store. first_stored = current_lnum + syn_block->b_syn_sync_minlines; } } else { @@ -514,12 +513,12 @@ void syntax_start(win_T *wp, linenr_T lnum) (void)syn_finish_line(false); current_lnum++; - /* If we parsed at least "minlines" lines or started at a valid - * state, the current state is considered valid. */ + // If we parsed at least "minlines" lines or started at a valid + // state, the current state is considered valid. if (current_lnum >= first_stored) { - /* Check if the saved state entry is for the current line and is - * equal to the current state. If so, then validate all saved - * states that depended on a change before the parsed line. */ + // Check if the saved state entry is for the current line and is + // equal to the current state. If so, then validate all saved + // states that depended on a change before the parsed line. if (prev == NULL) { prev = syn_stack_find_entry(current_lnum - 1); } @@ -548,19 +547,18 @@ void syntax_start(win_T *wp, linenr_T lnum) sp = sp->sst_next; } load_current_state(prev); - } - /* Store the state at this line when it's the first one, the line - * where we start parsing, or some distance from the previously - * saved state. But only when parsed at least 'minlines'. */ - else if (prev == NULL - || current_lnum == lnum - || current_lnum >= prev->sst_lnum + dist) { + } else if (prev == NULL + // Store the state at this line when it's the first one, the line + // where we start parsing, or some distance from the previously + // saved state. But only when parsed at least 'minlines'. + || current_lnum == lnum + || current_lnum >= prev->sst_lnum + dist) { prev = store_current_state(); } } - /* This can take a long time: break when CTRL-C pressed. The current - * state will be wrong then. */ + // This can take a long time: break when CTRL-C pressed. The current + // state will be wrong then. line_breakcheck(); if (got_int) { current_lnum = lnum; @@ -664,8 +662,8 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid) * 1. Search backwards for the end of a C-style comment. */ if (syn_block->b_syn_sync_flags & SF_CCOMMENT) { - /* Need to make syn_buf the current buffer for a moment, to be able to - * use find_start_comment(). */ + // Need to make syn_buf the current buffer for a moment, to be able to + // use find_start_comment(). curwin_save = curwin; curwin = wp; curbuf_save = curbuf; @@ -793,9 +791,9 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid) ++current_col; } - /* syn_current_attr() will have skipped the check for - * an item that ends here, need to do that now. Be - * careful not to go past the NUL. */ + // syn_current_attr() will have skipped the check for + // an item that ends here, need to do that now. Be + // careful not to go past the NUL. prev_current_col = current_col; if (syn_getcurline()[current_col] != NUL) { ++current_col; @@ -987,9 +985,8 @@ static void syn_update_ends(bool startofline) check_keepend(); } -/**************************************** - * Handling of the state stack cache. - */ +///////////////////////////////////////// +// Handling of the state stack cache. /* * EXPLANATION OF THE SYNTAX STATE STACK CACHE @@ -1081,8 +1078,8 @@ static void syn_stack_alloc(void) } if (syn_block->b_sst_array != NULL) { - /* When shrinking the array, cleanup the existing stack. - * Make sure that all valid entries fit in the new array. */ + // When shrinking the array, cleanup the existing stack. + // Make sure that all valid entries fit in the new array. while (syn_block->b_sst_len - syn_block->b_sst_freecount + 2 > len && syn_stack_cleanup()) { ; @@ -1165,9 +1162,9 @@ static void syn_stack_apply_changes_block(synblock_T *block, buf_T *buf) p = np; continue; } - /* This state is below the changed area. Remember the line - * that needs to be parsed before this entry can be made valid - * again. */ + // This state is below the changed area. Remember the line + // that needs to be parsed before this entry can be made valid + // again. if (p->sst_change_lnum != 0 && p->sst_change_lnum > buf->b_mod_top) { if (p->sst_change_lnum + buf->b_mod_xlines > buf->b_mod_top) { p->sst_change_lnum += buf->b_mod_xlines; @@ -1638,8 +1635,8 @@ int get_syntax_attr(const colnr_T col, bool *const can_spell, const bool keep_st int attr = 0; if (can_spell != NULL) { - /* Default: Only do spelling when there is no @Spell cluster or when - * ":syn spell toplevel" was used. */ + // Default: Only do spelling when there is no @Spell cluster or when + // ":syn spell toplevel" was used. *can_spell = syn_block->b_syn_spell == SYNSPL_DEFAULT ? (syn_block->b_spell_cluster_id == 0) : (syn_block->b_syn_spell == SYNSPL_TOP); @@ -1901,15 +1898,15 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con syn_add_start_off(&pos, ®match, spp, SPO_MS_OFF, -1); if (pos.lnum > current_lnum) { - /* must have used end of match in a next line, - * we can't handle that */ + // must have used end of match in a next line, + // we can't handle that spp->sp_startcol = MAXCOL; continue; } startcol = pos.col; - /* remember the next column where this pattern - * matches in the current line */ + // remember the next column where this pattern + // matches in the current line spp->sp_startcol = startcol; /* @@ -1999,8 +1996,8 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con /* * keep the best match so far in next_match_* */ - /* Highlighting must start after startpos and end - * before endpos. */ + // Highlighting must start after startpos and end + // before endpos. if (hl_startpos.lnum == current_lnum && (int)hl_startpos.col < startcol) { hl_startpos.col = startcol; @@ -2029,8 +2026,8 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con if (next_match_idx >= 0 && next_match_col == (int)current_col) { synpat_T *lspp; - /* When a zero-width item matched which has a nextgroup, - * don't push the item but set nextgroup. */ + // When a zero-width item matched which has a nextgroup, + // don't push the item but set nextgroup. lspp = &(SYN_ITEMS(syn_block)[next_match_idx]); if (next_match_m_endpos.lnum == current_lnum && next_match_m_endpos.col == current_col @@ -2127,8 +2124,8 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con * done in the current item. */ if (syn_block->b_spell_cluster_id == 0) { - /* There is no @Spell cluster: Do spelling for items without - * @NoSpell cluster. */ + // There is no @Spell cluster: Do spelling for items without + // @NoSpell cluster. if (syn_block->b_nospell_cluster_id == 0 || current_trans_id == 0) { *can_spell = (syn_block->b_syn_spell != SYNSPL_NOTOP); @@ -2180,8 +2177,8 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con } } } else if (can_spell != NULL) { - /* Default: Only do spelling when there is no @Spell cluster or when - * ":syn spell toplevel" was used. */ + // Default: Only do spelling when there is no @Spell cluster or when + // ":syn spell toplevel" was used. *can_spell = syn_block->b_syn_spell == SYNSPL_DEFAULT ? (syn_block->b_spell_cluster_id == 0) : (syn_block->b_syn_spell == SYNSPL_TOP); @@ -2365,8 +2362,8 @@ static void check_state_ends(void) current_next_list = NULL; } - /* When the ended item has "extend", another item with - * "keepend" now needs to check for its end. */ + // When the ended item has "extend", another item with + // "keepend" now needs to check for its end. had_extend = (cur_si->si_flags & HL_EXTEND); pop_current_state(); @@ -2541,9 +2538,9 @@ static void update_si_end(stateitem_T *sip, int startcol, bool force) return; } - /* Don't update when it's already done. Can be a match of an end pattern - * that started in a previous line. Watch out: can also be a "keepend" - * from a containing item. */ + // Don't update when it's already done. Can be a match of an end pattern + // that started in a previous line. Watch out: can also be a "keepend" + // from a containing item. if (!force && sip->si_m_endpos.lnum >= current_lnum) { return; } @@ -2822,8 +2819,8 @@ static void find_endpos(int idx, lpos_T *startpos, lpos_T *m_endpos, lpos_T *hl_ } limit_pos(hl_endpos, m_endpos); - /* now the match ends where the highlighting ends, it is turned - * into the matchgroup for the end */ + // now the match ends where the highlighting ends, it is turned + // into the matchgroup for the end *m_endpos = *hl_endpos; } else { *end_idx = 0; @@ -5571,8 +5568,8 @@ static int in_id_list(stateitem_T *cur_si, int16_t *list, struct sp_syn *ssp, in // If ssp has a "containedin" list and "cur_si" is in it, return TRUE. if (cur_si != NULL && ssp->cont_in_list != NULL && !(cur_si->si_flags & HL_MATCH)) { - /* Ignore transparent items without a contains argument. Double check - * that we don't go back past the first one. */ + // Ignore transparent items without a contains argument. Double check + // that we don't go back past the first one. while ((cur_si->si_flags & HL_TRANS_CONT) && cur_si > (stateitem_T *)(current_state.ga_data)) { --cur_si; @@ -5636,8 +5633,8 @@ static int in_id_list(stateitem_T *cur_si, int16_t *list, struct sp_syn *ssp, in } if (item >= SYNID_CLUSTER) { scl_list = SYN_CLSTR(syn_block)[item - SYNID_CLUSTER].scl_list; - /* restrict recursiveness to 30 to avoid an endless loop for a - * cluster that includes itself (indirectly) */ + // restrict recursiveness to 30 to avoid an endless loop for a + // cluster that includes itself (indirectly) if (scl_list != NULL && depth < 30) { ++depth; r = in_id_list(NULL, scl_list, ssp, contained); @@ -5932,8 +5929,8 @@ int syn_get_sub_char(void) int syn_get_stack_item(int i) { if (i >= current_state.ga_len) { - /* Need to invalidate the state, because we didn't properly finish it - * for the last character, "keep_state" was TRUE. */ + // Need to invalidate the state, because we didn't properly finish it + // for the last character, "keep_state" was TRUE. invalidate_current_state(); current_col = MAXCOL; return -1; diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 768cca284b..3b29d62191 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -230,8 +230,8 @@ int do_tag(char_u *tag, int type, int count, int forceit, int verbose) if (g_do_tagpreview != 0) { if (ptag_entry.tagname != NULL && STRCMP(ptag_entry.tagname, tag) == 0) { - /* Jumping to same tag: keep the current match, so that - * the CursorHold autocommand example works. */ + // Jumping to same tag: keep the current match, so that + // the CursorHold autocommand example works. cur_match = ptag_entry.cur_match; cur_fnum = ptag_entry.cur_fnum; } else { @@ -407,9 +407,9 @@ int do_tag(char_u *tag, int type, int count, int forceit, int verbose) tagstack[tagstackidx].fmark.fnum = curbuf->b_fnum; } - /* Curwin will change in the call to jumpto_tag() if ":stag" was - * used or an autocommand jumps to another window; store value of - * tagstackidx now. */ + // Curwin will change in the call to jumpto_tag() if ":stag" was + // used or an autocommand jumps to another window; store value of + // tagstackidx now. curwin->w_tagstackidx = tagstackidx; if (type != DT_SELECT && type != DT_JUMP) { curwin->w_tagstack[tagstackidx].cur_match = cur_match; @@ -418,9 +418,9 @@ int do_tag(char_u *tag, int type, int count, int forceit, int verbose) } } - /* When not using the current buffer get the name of buffer "cur_fnum". - * Makes sure that the tag order doesn't change when using a remembered - * position for "cur_match". */ + // When not using the current buffer get the name of buffer "cur_fnum". + // Makes sure that the tag order doesn't change when using a remembered + // position for "cur_match". if (cur_fnum != curbuf->b_fnum) { buf_T *buf = buflist_findnr(cur_fnum); @@ -1101,8 +1101,8 @@ static void prepare_pats(pat_T *pats, int has_re) pats->head = pats->pat; pats->headlen = pats->len; if (has_re) { - /* When the pattern starts with '^' or "\\<", binary searching can be - * used (much faster). */ + // When the pattern starts with '^' or "\\<", binary searching can be + // used (much faster). if (pats->pat[0] == '^') { pats->head = pats->pat + 1; } else if (pats->pat[0] == '\\' && pats->pat[1] == '<') { @@ -1500,8 +1500,8 @@ int find_tags(char_u *pat, int *num_matches, char_u ***matchesp, int flags, int orgpat.len = (int)STRLEN(pat); if (curbuf->b_help) { - /* When "@ab" is specified use only the "ab" language, otherwise - * search all languages. */ + // When "@ab" is specified use only the "ab" language, otherwise + // search all languages. if (orgpat.len > 3 && pat[orgpat.len - 3] == '@' && ASCII_ISALPHA(pat[orgpat.len - 2]) && ASCII_ISALPHA(pat[orgpat.len - 1])) { @@ -1613,9 +1613,9 @@ int find_tags(char_u *pat, int *num_matches, char_u ***matchesp, int flags, int } } if (s == NULL || *s == NUL) { - /* Language not in 'helplang': use last, prefer English, - * unless found already. */ - ++help_pri; + // Language not in 'helplang': use last, prefer English, + // unless found already. + help_pri++; if (STRICMP(help_lang, "en") != 0) { ++help_pri; } @@ -1654,8 +1654,8 @@ int find_tags(char_u *pat, int *num_matches, char_u ***matchesp, int flags, int stop_searching = true; break; } - /* When mincount is TAG_MANY, stop when enough matches have been - * found (for completion). */ + // When mincount is TAG_MANY, stop when enough matches have been + // found (for completion). if (mincount == TAG_MANY && match_count >= TAG_MANY) { stop_searching = true; retval = OK; @@ -1695,8 +1695,8 @@ int find_tags(char_u *pat, int *num_matches, char_u ***matchesp, int flags, int vim_fseek(fp, search_info.curr_offset, SEEK_SET); eof = vim_fgets(lbuf, lbuf_size, fp); if (!eof && search_info.curr_offset != 0) { - /* The explicit cast is to work around a bug in gcc 3.4.2 - * (repeated below). */ + // The explicit cast is to work around a bug in gcc 3.4.2 + // (repeated below). search_info.curr_offset = vim_ftell(fp); if (search_info.curr_offset == search_info.high_offset) { // oops, gone a bit too far; try from low offset @@ -1739,9 +1739,9 @@ line_read_in: char_u *conv_line; int len; - /* Convert every line. Converting the pattern from 'enc' to - * the tags file encoding doesn't work, because characters are - * not recognized. */ + // Convert every line. Converting the pattern from 'enc' to + // the tags file encoding doesn't work, because characters are + // not recognized. conv_line = string_convert(&vimconv, lbuf, NULL); if (conv_line != NULL) { // Copy or swap lbuf and conv_line. @@ -1764,13 +1764,12 @@ line_read_in: * format, and for "not sorted" flag. */ if (state == TS_START) { - /* The header ends when the line sorts below "!_TAG_". When - * case is folded lower case letters sort before "_". */ + // The header ends when the line sorts below "!_TAG_". When + // case is folded lower case letters sort before "_". if (STRNCMP(lbuf, "!_TAG_", 6) <= 0 || (lbuf[0] == '!' && ASCII_ISLOWER(lbuf[1]))) { if (STRNCMP(lbuf, "!_TAG_", 6) != 0) { - /* Non-header item before the header, e.g. "!" itself. - */ + // Non-header item before the header, e.g. "!" itself. goto parse_line; } @@ -1781,10 +1780,9 @@ line_read_in: tag_file_sorted = lbuf[18]; } if (STRNCMP(lbuf, "!_TAG_FILE_ENCODING\t", 20) == 0) { - /* Prepare to convert every line from the specified - * encoding to 'encoding'. */ - for (p = lbuf + 20; *p > ' ' && *p < 127; ++p) { - ; + // Prepare to convert every line from the specified + // encoding to 'encoding'. + for (p = lbuf + 20; *p > ' ' && *p < 127; p++) { } *p = NUL; convert_setup(&vimconv, lbuf + 20, p_enc); @@ -1820,9 +1818,9 @@ line_read_in: } if (state == TS_BINARY && orgpat.regmatch.rm_ic && !sortic) { - /* Binary search won't work for ignoring case, use linear - * search. */ - linear = TRUE; + // Binary search won't work for ignoring case, use linear + // search. + linear = true; state = TS_LINEAR; } @@ -1927,9 +1925,8 @@ parse_line: } if (tagcmp == 0) { - /* We've located the tag, now skip back and search - * forward until the first matching tag is found. - */ + // We've located the tag, now skip back and search + // forward until the first matching tag is found. state = TS_SKIP_BACK; search_info.match_offset = search_info.curr_offset; continue; @@ -1966,8 +1963,8 @@ parse_line: if (mb_strnicmp(tagp.tagname, orgpat.head, (size_t)cmplen) != 0) { state = TS_STEP_FORWARD; } else { - /* Have to skip back more. Restore the curr_offset - * used, otherwise we get stuck at a long line. */ + // Have to skip back more. Restore the curr_offset + // used, otherwise we get stuck at a long line. search_info.curr_offset = search_info.curr_offset_used; } continue; -- cgit From 41d3b98debb3c90306f301dad185a6b487fa4002 Mon Sep 17 00:00:00 2001 From: Dundar Göc Date: Wed, 6 Oct 2021 11:42:33 +0200 Subject: vim-patch:8.1.2394: using old C style comments Problem: Using old C style comments. Solution: Use // comments where appropriate. https://github.com/vim/vim/commit/63d9e730f726341bf41ee4f4b829253cb9879110 --- src/nvim/regexp.c | 12 +++---- src/nvim/regexp_nfa.c | 79 +++++++++++++++++++++++----------------------- src/nvim/screen.c | 8 ++--- src/nvim/search.c | 87 +++++++++++++++++++++++++-------------------------- 4 files changed, 92 insertions(+), 94 deletions(-) (limited to 'src/nvim') diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 98a46cf781..eca6739f5c 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -3003,8 +3003,8 @@ static void ungetchr(void) at_start = prev_at_start; prev_at_start = false; - /* Backup regparse, so that it's at the same position as before the - * getchr(). */ + // Backup regparse, so that it's at the same position as before the + // getchr(). regparse -= prevchr_len; } @@ -6412,8 +6412,8 @@ static int cstrncmp(char_u *s1, char_u *s2, int *n) int c1, c2, c11, c12; int junk; - /* we have to handle the strcmp ourselves, since it is necessary to - * deal with the composing characters by ignoring them: */ + // we have to handle the strcmp ourselves, since it is necessary to + // deal with the composing characters by ignoring them: str1 = s1; str2 = s2; c1 = c2 = 0; @@ -7184,8 +7184,8 @@ static regengine_T nfa_regengine = (char_u *)"" }; -/* Which regexp engine to use? Needed for vim_regcomp(). - * Must match with 'regexpengine'. */ +// Which regexp engine to use? Needed for vim_regcomp(). +// Must match with 'regexpengine'. static int regexp_engine = 0; #ifdef REGEXP_DEBUG diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index 039f9b4675..7550ff64ef 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -372,8 +372,8 @@ nfa_regcomp_start ( /* A reasonable estimation for maximum size */ nstate_max = (STRLEN(expr) + 1) * 25; - /* Some items blow up in size, such as [A-z]. Add more space for that. - * When it is still not enough realloc_post_list() will be used. */ + // Some items blow up in size, such as [A-z]. Add more space for that. + // When it is still not enough realloc_post_list() will be used. nstate_max += 1000; /* Size for postfix representation of expr. */ @@ -1424,8 +1424,8 @@ static int nfa_regatom(void) } break; - /* Catch \%^ and \%$ regardless of where they appear in the - * pattern -- regardless of whether or not it makes sense. */ + // Catch \%^ and \%$ regardless of where they appear in the + // pattern -- regardless of whether or not it makes sense. case '^': EMIT(NFA_BOF); break; @@ -1466,13 +1466,13 @@ static int nfa_regatom(void) EMIT(NFA_OPT_CHARS); EMIT(n); - /* Emit as "\%(\%[abc]\)" to be able to handle - * "\%[abc]*" which would cause the empty string to be - * matched an unlimited number of times. NFA_NOPEN is - * added only once at a position, while NFA_SPLIT is - * added multiple times. This is more efficient than - * not allowing NFA_SPLIT multiple times, it is used - * a lot. */ + // Emit as "\%(\%[abc]\)" to be able to handle + // "\%[abc]*" which would cause the empty string to be + // matched an unlimited number of times. NFA_NOPEN is + // added only once at a position, while NFA_SPLIT is + // added multiple times. This is more efficient than + // not allowing NFA_SPLIT multiple times, it is used + // a lot. EMIT(NFA_NOPEN); break; } @@ -1882,8 +1882,8 @@ static int nfa_regpiece(void) int my_post_start; int quest; - /* Save the current parse state, so that we can use it if {m,n} is - * next. */ + // Save the current parse state, so that we can use it if {m,n} is + // next. save_parse_state(&old_state); /* store current pos in the postfix form, for \{m,n} involving 0s */ @@ -1967,12 +1967,11 @@ static int nfa_regpiece(void) break; case Magic('{'): - /* a{2,5} will expand to 'aaa?a?a?' - * a{-1,3} will expand to 'aa??a??', where ?? is the nongreedy - * version of '?' - * \v(ab){2,3} will expand to '(ab)(ab)(ab)?', where all the - * parenthesis have the same id - */ + // a{2,5} will expand to 'aaa?a?a?' + // a{-1,3} will expand to 'aa??a??', where ?? is the nongreedy + // version of '?' + // \v(ab){2,3} will expand to '(ab)(ab)(ab)?', where all the + // parenthesis have the same id greedy = true; c2 = peekchr(); @@ -1983,8 +1982,8 @@ static int nfa_regpiece(void) if (!read_limits(&minval, &maxval)) EMSG_RET_FAIL(_("E870: (NFA regexp) Error reading repetition limits")); - /* {0,inf}, {0,} and {} are equivalent to - * * */ + // {0,inf}, {0,} and {} are equivalent to + // * if (minval == 0 && maxval == MAX_LIMIT) { if (greedy) /* \{}, \{0,} */ @@ -3327,10 +3326,10 @@ static nfa_state_T *post2nfa(int *postfix, int *end, int nfa_calc_size) break; } - /* Allow "NFA_MOPEN" as a valid postfix representation for - * the empty regexp "". In this case, the NFA will be - * NFA_MOPEN -> NFA_MCLOSE. Note that this also allows - * empty groups of parenthesis, and empty mbyte chars */ + // Allow "NFA_MOPEN" as a valid postfix representation for + // the empty regexp "". In this case, the NFA will be + // NFA_MOPEN -> NFA_MCLOSE. Note that this also allows + // empty groups of parenthesis, and empty mbyte chars if (stackp == stack) { s = alloc_state(mopen, NULL, NULL); if (s == NULL) @@ -3343,8 +3342,8 @@ static nfa_state_T *post2nfa(int *postfix, int *end, int nfa_calc_size) break; } - /* At least one node was emitted before NFA_MOPEN, so - * at least one node will be between NFA_MOPEN and NFA_MCLOSE */ + // At least one node was emitted before NFA_MOPEN, so + // at least one node will be between NFA_MOPEN and NFA_MCLOSE e = POP(); s = alloc_state(mopen, e.start, NULL); /* `(' */ if (s == NULL) @@ -3501,14 +3500,14 @@ static void nfa_postprocess(nfa_regprog_T *prog) int ch_invisible = failure_chance(prog->state[i].out, 0); int ch_follows = failure_chance(prog->state[i].out1->out, 0); - /* Postpone when the invisible match is expensive or has a - * lower chance of failing. */ + // Postpone when the invisible match is expensive or has a + // lower chance of failing. if (c == NFA_START_INVISIBLE_BEFORE || c == NFA_START_INVISIBLE_BEFORE_NEG) { - /* "before" matches are very expensive when - * unbounded, always prefer what follows then, - * unless what follows will always match. - * Otherwise strongly prefer what follows. */ + // "before" matches are very expensive when + // unbounded, always prefer what follows then, + // unless what follows will always match. + // Otherwise strongly prefer what follows. if (prog->state[i].val <= 0 && ch_follows > 0) { directly = false; } else { @@ -3527,9 +3526,9 @@ static void nfa_postprocess(nfa_regprog_T *prog) } } -/**************************************************************** -* NFA execution code. -****************************************************************/ +///////////////////////////////////////////////////////////////// +// NFA execution code. +///////////////////////////////////////////////////////////////// /* Values for done in nfa_pim_T. */ #define NFA_PIM_UNUSED 0 /* pim not used */ @@ -4195,8 +4194,8 @@ skip_add: save_ptr = NULL; memset(&save_multipos, 0, sizeof(save_multipos)); - /* Set the position (with "off" added) in the subexpression. Save - * and restore it when it was in use. Otherwise fill any gap. */ + // Set the position (with "off" added) in the subexpression. Save + // and restore it when it was in use. Otherwise fill any gap. if (REG_MULTI) { if (subidx < sub->in_use) { save_multipos = sub->list.multi[subidx]; @@ -4295,8 +4294,8 @@ skip_add: sub = &subs->norm; } - /* We don't fill in gaps here, there must have been an MOPEN that - * has done that. */ + // We don't fill in gaps here, there must have been an MOPEN that + // has done that. save_in_use = sub->in_use; if (sub->in_use <= subidx) sub->in_use = subidx + 1; diff --git a/src/nvim/screen.c b/src/nvim/screen.c index fcd8fb1118..a1d03b363d 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -5164,8 +5164,8 @@ void win_redr_status_matches(expand_T *xp, int num_matches, char_u **matches, in if (row >= 0) { if (wild_menu_showing == 0 || wild_menu_showing == WM_LIST) { if (msg_scrolled > 0) { - /* Put the wildmenu just above the command line. If there is - * no room, scroll the screen one line up. */ + // Put the wildmenu just above the command line. If there is + // no room, scroll the screen one line up. if (cmdline_row == Rows - 1) { msg_scroll_up(false); msg_scrolled++; @@ -7032,8 +7032,8 @@ int showmode(void) if (VIsual_active) { char *p; - /* Don't concatenate separate words to avoid translation - * problems. */ + // Don't concatenate separate words to avoid translation + // problems. switch ((VIsual_select ? 4 : 0) + (VIsual_mode == Ctrl_V) * 2 + (VIsual_mode == 'V')) { diff --git a/src/nvim/search.c b/src/nvim/search.c index 3d30932d69..1b54d12042 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -839,14 +839,14 @@ int searchit(win_T *win, buf_T *buf, pos_T *pos, pos_T *end_pos, Direction dir, } } - /* With the SEARCH_END option move to the last character - * of the match. Don't do it for an empty match, end - * should be same as start then. */ + // With the SEARCH_END option move to the last character + // of the match. Don't do it for an empty match, end + // should be same as start then. if ((options & SEARCH_END) && !(options & SEARCH_NOOF) && !(matchpos.lnum == endpos.lnum && matchpos.col == endpos.col)) { - /* For a match in the first column, set the position - * on the NUL in the previous line. */ + // For a match in the first column, set the position + // on the NUL in the previous line. pos->lnum = lnum + endpos.lnum; pos->col = endpos.col; if (endpos.col == 0) { @@ -1498,8 +1498,8 @@ int search_for_exact_line(buf_T *buf, pos_T *pos, Direction dir, char_u *pat) p = skipwhite(ptr); pos->col = (colnr_T)(p - ptr); - /* when adding lines the matching line may be empty but it is not - * ignored because we are interested in the next line -- Acevedo */ + // when adding lines the matching line may be empty but it is not + // ignored because we are interested in the next line -- Acevedo if ((compl_cont_status & CONT_ADDING) && !(compl_cont_status & CONT_SOL)) { if (mb_strcmp_ic((bool)p_ic, (const char *)p, (const char *)pat) == 0) { @@ -1566,9 +1566,9 @@ int searchc(cmdarg_T *cap, int t_cmd) c = *lastc; // For multi-byte re-use last lastc_bytes[] and lastc_bytelen. - /* Force a move of at least one char, so ";" and "," will move the - * cursor, even if the cursor is right in front of char we are looking - * at. */ + // Force a move of at least one char, so ";" and "," will move the + // cursor, even if the cursor is right in front of char we are looking + // at. if (vim_strchr(p_cpo, CPO_SCOLON) == NULL && count == 1 && t_cmd) { stop = false; } @@ -2084,10 +2084,10 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel) if (linep[pos.col - 1] == 'R' && linep[pos.col] == '"' && vim_strchr(linep + pos.col + 1, '(') != NULL) { - /* Possible start of raw string. Now that we have the - * delimiter we can check if it ends before where we - * started searching, or before the previously found - * raw string start. */ + // Possible start of raw string. Now that we have the + // delimiter we can check if it ends before where we + // started searching, or before the previously found + // raw string start. if (!find_rawstring_end(linep, &pos, count > 0 ? &match_pos : &curwin->w_cursor)) { count++; @@ -2208,8 +2208,8 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel) break; case '"': - /* a quote that is preceded with an odd number of backslashes is - * ignored */ + // a quote that is preceded with an odd number of backslashes is + // ignored if (do_quotes) { int col; @@ -2282,8 +2282,8 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel) bslcnt++; } } - /* Only accept a match when 'M' is in 'cpo' or when escaping - * is what we expect. */ + // Only accept a match when 'M' is in 'cpo' or when escaping + // is what we expect. if (cpo_bsl || (bslcnt & 1) == match_escaped) { if (c == initc) { count++; @@ -3505,8 +3505,8 @@ int current_block(oparg_T *oap, long count, int include, int what, int other) // Include the character under the cursor. oap->inclusive = true; } else { - /* End is before the start (no text in between <>, [], etc.): don't - * operate on any text. */ + // End is before the start (no text in between <>, [], etc.): don't + // operate on any text. curwin->w_cursor = start_pos; } } @@ -4044,8 +4044,8 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar) } if (!vis_empty) { - /* Check if the existing selection exactly spans the text inside - * quotes. */ + // Check if the existing selection exactly spans the text inside + // quotes. if (vis_bef_curs) { inside_quotes = VIsual.col > 0 && line[VIsual.col - 1] == quotechar @@ -4072,11 +4072,11 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar) } if (!vis_empty && line[col_start] == quotechar) { - /* Already selecting something and on a quote character. Find the - * next quoted string. */ + // Already selecting something and on a quote character. Find the + // next quoted string. if (vis_bef_curs) { - /* Assume we are on a closing quote: move to after the next - * opening quote. */ + // Assume we are on a closing quote: m