From c667da5185ce5dce914d2006d62da2be0cedb384 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 30 Nov 2019 20:52:27 +0100 Subject: patch 8.1.2368: using old C style comments Problem: Using old C style comments. Solution: Use // comments where appropriate. --- src/autocmd.c | 17 +- src/beval.c | 17 +- src/blob.c | 2 +- src/blowfish.c | 46 +-- src/buffer.c | 915 ++++++++++++++++++++++++++++---------------------------- src/change.c | 12 +- src/channel.c | 545 +++++++++++++++++---------------- src/charset.c | 277 +++++++++-------- src/cindent.c | 6 +- src/crypt.c | 73 +++-- src/crypt_zip.c | 8 +- src/version.c | 2 + 12 files changed, 959 insertions(+), 961 deletions(-) (limited to 'src') diff --git a/src/autocmd.c b/src/autocmd.c index 7e8a6925f9..de24dd219c 100644 --- a/src/autocmd.c +++ b/src/autocmd.c @@ -232,14 +232,14 @@ typedef struct AutoPatCmd struct AutoPatCmd *next; // chain of active apc-s for auto-invalidation } AutoPatCmd; -static AutoPatCmd *active_apc_list = NULL; /* stack of active autocommands */ +static AutoPatCmd *active_apc_list = NULL; // stack of active autocommands /* * augroups stores a list of autocmd group names. */ static garray_T augroups = {0, 0, sizeof(char_u *), 10, NULL}; #define AUGROUP_NAME(i) (((char_u **)augroups.ga_data)[i]) -/* use get_deleted_augroup() to get this */ +// use get_deleted_augroup() to get this static char_u *deleted_augroup = NULL; /* @@ -247,7 +247,7 @@ static char_u *deleted_augroup = NULL; */ static int current_augroup = AUGROUP_DEFAULT; -static int au_need_clean = FALSE; /* need to delete marked patterns */ +static int au_need_clean = FALSE; // need to delete marked patterns static char_u *event_nr2name(event_T event); static int au_get_grouparg(char_u **argp); @@ -258,7 +258,7 @@ static int au_find_group(char_u *name); static event_T last_event; static int last_group; -static int autocmd_blocked = 0; /* block all autocmds */ +static int autocmd_blocked = 0; // block all autocmds static char_u * get_deleted_augroup(void) @@ -783,7 +783,7 @@ au_event_restore(char_u *old_ei) vim_free(old_ei); } } -# endif /* FEAT_SYN_HL */ +# endif // FEAT_SYN_HL /* * do_autocmd() -- implements the :autocmd command. Can be used in the @@ -1027,7 +1027,7 @@ do_autocmd_event( int patlen; int is_buflocal; int buflocal_nr; - char_u buflocal_pat[25]; /* for "" */ + char_u buflocal_pat[25]; // for "" if (group == AUGROUP_ALL) findgroup = current_augroup; @@ -1120,7 +1120,8 @@ do_autocmd_event( { if (ap->pat != NULL) { - /* Accept a pattern when: + /* + * Accept a pattern when: * - a group was specified and it's that group, or a group was * not specified and it's the current group, or a group was * not specified and we are listing @@ -1177,7 +1178,7 @@ do_autocmd_event( */ if (ap == NULL) { - /* refuse to add buffer-local ap if buffer number is invalid */ + // refuse to add buffer-local ap if buffer number is invalid if (is_buflocal && (buflocal_nr == 0 || buflist_findnr(buflocal_nr) == NULL)) { diff --git a/src/beval.c b/src/beval.c index 8ef8e8e1d5..1bc31a17a9 100644 --- a/src/beval.c +++ b/src/beval.c @@ -239,13 +239,13 @@ general_beval_cb(BalloonEval *beval, int state UNUSED) #endif static int recursive = FALSE; - /* Don't do anything when 'ballooneval' is off, messages scrolled the - * windows up or we have no beval area. */ + // Don't do anything when 'ballooneval' is off, messages scrolled the + // windows up or we have no beval area. if (!can_use_beval() || beval == NULL) return; - /* Don't do this recursively. Happens when the expression evaluation - * takes a long time and invokes something that checks for CTRL-C typed. */ + // Don't do this recursively. Happens when the expression evaluation + // takes a long time and invokes something that checks for CTRL-C typed. if (recursive) return; recursive = TRUE; @@ -257,7 +257,7 @@ general_beval_cb(BalloonEval *beval, int state UNUSED) : wp->w_buffer->b_p_bexpr; if (*bexpr != NUL) { - /* Convert window pointer to number. */ + // Convert window pointer to number. for (cw = firstwin; cw != wp; cw = cw->w_next) ++winnr; @@ -285,9 +285,9 @@ general_beval_cb(BalloonEval *beval, int state UNUSED) vim_free(result); result = eval_to_string(bexpr, NULL, TRUE); - /* Remove one trailing newline, it is added when the result was a - * list and it's hardly ever useful. If the user really wants a - * trailing newline he can add two and one remains. */ + // Remove one trailing newline, it is added when the result was a + // list and it's hardly ever useful. If the user really wants a + // trailing newline he can add two and one remains. if (result != NULL) { len = STRLEN(result); @@ -322,4 +322,3 @@ general_beval_cb(BalloonEval *beval, int state UNUSED) } #endif - diff --git a/src/blob.c b/src/blob.c index 278ced62c8..2a7ec3a73a 100644 --- a/src/blob.c +++ b/src/blob.c @@ -328,4 +328,4 @@ blob_remove(typval_T *argvars, typval_T *rettv) } } -#endif /* defined(FEAT_EVAL) */ +#endif // defined(FEAT_EVAL) diff --git a/src/blowfish.c b/src/blowfish.c index 65f89327ed..a73b3b6c55 100644 --- a/src/blowfish.c +++ b/src/blowfish.c @@ -35,28 +35,28 @@ typedef union { } block8; #if defined(MSWIN) - /* MS-Windows is always little endian */ + // MS-Windows is always little endian #else # ifdef HAVE_CONFIG_H - /* in configure.ac AC_C_BIGENDIAN() defines WORDS_BIGENDIAN when needed */ + // in configure.ac AC_C_BIGENDIAN() defines WORDS_BIGENDIAN when needed # else error! Please change this code to define WORDS_BIGENDIAN for big-endian machines. # endif #endif -/* The state of encryption, referenced by cryptstate_T. */ +// The state of encryption, referenced by cryptstate_T. typedef struct { - UINT32_T pax[18]; /* P-array */ - UINT32_T sbx[4][256]; /* S-boxes */ + UINT32_T pax[18]; // P-array + UINT32_T sbx[4][256]; // S-boxes int randbyte_offset; int update_offset; - char_u cfb_buffer[BF_MAX_CFB_LEN]; /* up to 64 bytes used */ - int cfb_len; /* size of cfb_buffer actually used */ + char_u cfb_buffer[BF_MAX_CFB_LEN]; // up to 64 bytes used + int cfb_len; // size of cfb_buffer actually used } bf_state_T; -/* Blowfish code */ +// Blowfish code static UINT32_T pax_init[18] = { 0x243f6a88u, 0x85a308d3u, 0x13198a2eu, 0x03707344u, 0xa4093822u, 0x299f31d0u, @@ -409,13 +409,13 @@ bf_key_init( char_u *key; int keylen; - /* Process the key 1001 times. - * See http://en.wikipedia.org/wiki/Key_strengthening. */ + // Process the key 1001 times. + // See http://en.wikipedia.org/wiki/Key_strengthening. key = sha256_key(password, salt, salt_len); for (i = 0; i < 1000; i++) key = sha256_key(key, salt, salt_len); - /* Convert the key from 64 hex chars to 32 binary chars. */ + // Convert the key from 64 hex chars to 32 binary chars. keylen = (int)STRLEN(key) / 2; if (keylen == 0) { @@ -428,8 +428,8 @@ bf_key_init( key[i] = u; } - /* Use "key" to initialize the P-array ("pax") and S-boxes ("sbx") of - * Blowfish. */ + // Use "key" to initialize the P-array ("pax") and S-boxes ("sbx") of + // Blowfish. mch_memmove(bfs->sbx, sbx_init, 4 * 4 * 256); for (i = 0; i < 18; ++i) @@ -484,7 +484,7 @@ typedef struct { char_u salt[9]; char_u plaintxt[9]; char_u cryptxt[9]; - char_u badcryptxt[9]; /* cryptxt when big/little endian is wrong */ + char_u badcryptxt[9]; // cryptxt when big/little endian is wrong UINT32_T keysum; } struct_bf_test_data; @@ -497,9 +497,9 @@ static struct_bf_test_data bf_test_data[] = { "password", "salt", "plaintxt", - "\xad\x3d\xfa\x7f\xe8\xea\x40\xf6", /* cryptxt */ - "\x72\x50\x3b\x38\x10\x60\x22\xa7", /* badcryptxt */ - 0x56701b5du /* keysum */ + "\xad\x3d\xfa\x7f\xe8\xea\x40\xf6", // cryptxt + "\x72\x50\x3b\x38\x10\x60\x22\xa7", // badcryptxt + 0x56701b5du // keysum }, }; @@ -518,8 +518,8 @@ bf_self_test(void) vim_memset(&state, 0, sizeof(bf_state_T)); state.cfb_len = BF_MAX_CFB_LEN; - /* We can't simply use sizeof(UINT32_T), it would generate a compiler - * warning. */ + // We can't simply use sizeof(UINT32_T), it would generate a compiler + // warning. if (ui != 0xffffffffUL || ui + 1 != 0) { err++; emsg(_("E820: sizeof(uint32_t) != 4")); @@ -537,7 +537,7 @@ bf_self_test(void) if (!bf_check_tables(state.pax, state.sbx, bf_test_data[i].keysum)) err++; - /* Don't modify bf_test_data[i].plaintxt, self test is idempotent. */ + // Don't modify bf_test_data[i].plaintxt, self test is idempotent. memcpy(bk.uc, bf_test_data[i].plaintxt, 8); bf_e_cblock(&state, bk.uc); if (memcmp(bk.uc, bf_test_data[i].cryptxt, 8) != 0) @@ -651,8 +651,8 @@ crypt_blowfish_init( return FAIL; state->method_state = bfs; - /* "blowfish" uses a 64 byte buffer, causing it to repeat 8 byte groups 8 - * times. "blowfish2" uses a 8 byte buffer to avoid repeating. */ + // "blowfish" uses a 64 byte buffer, causing it to repeat 8 byte groups 8 + // times. "blowfish2" uses a 8 byte buffer to avoid repeating. bfs->cfb_len = state->method_nr == CRYPT_M_BF ? BF_MAX_CFB_LEN : BF_BLOCK; if (blowfish_self_test() == FAIL) @@ -684,4 +684,4 @@ blowfish_self_test(void) return OK; } -#endif /* FEAT_CRYPT */ +#endif // FEAT_CRYPT diff --git a/src/buffer.c b/src/buffer.c index 3b50c89379..4868428f52 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -78,9 +78,9 @@ get_highest_fnum(void) */ static int read_buffer( - int read_stdin, /* read file from stdin, otherwise fifo */ - exarg_T *eap, /* for forced 'ff' and 'fenc' or NULL */ - int flags) /* extra flags for readfile() */ + int read_stdin, // read file from stdin, otherwise fifo + exarg_T *eap, // for forced 'ff' and 'fenc' or NULL + int flags) // extra flags for readfile() { int retval = OK; linenr_T line_count; @@ -98,24 +98,24 @@ read_buffer( flags | READ_BUFFER); if (retval == OK) { - /* Delete the binary lines. */ + // Delete the binary lines. while (--line_count >= 0) ml_delete((linenr_T)1, FALSE); } else { - /* Delete the converted lines. */ + // Delete the converted lines. while (curbuf->b_ml.ml_line_count > line_count) ml_delete(line_count, FALSE); } - /* Put the cursor on the first line. */ + // Put the cursor on the first line. curwin->w_cursor.lnum = 1; curwin->w_cursor.col = 0; if (read_stdin) { - /* Set or reset 'modified' before executing autocommands, so that - * it can be changed there. */ + // Set or reset 'modified' before executing autocommands, so that + // it can be changed there. if (!readonlymode && !BUFEMPTY()) changed(); else if (retval == OK) @@ -158,9 +158,9 @@ buffer_ensure_loaded(buf_T *buf) */ int open_buffer( - int read_stdin, /* read file from stdin */ - exarg_T *eap, /* for forced 'ff' and 'fenc' or NULL */ - int flags) /* extra flags for readfile() */ + int read_stdin, // read file from stdin + exarg_T *eap, // for forced 'ff' and 'fenc' or NULL + int flags) // extra flags for readfile() { int retval = OK; bufref_T old_curbuf; @@ -211,12 +211,12 @@ open_buffer( return FAIL; } - /* The autocommands in readfile() may change the buffer, but only AFTER - * reading the file. */ + // The autocommands in readfile() may change the buffer, but only AFTER + // reading the file. set_bufref(&old_curbuf, curbuf); modified_was_set = FALSE; - /* mark cursor position as being invalid */ + // mark cursor position as being invalid curwin->w_valid = 0; if (curbuf->b_ffname != NULL @@ -264,7 +264,7 @@ open_buffer( #ifdef FEAT_NETBEANS_INTG netbeansFireChanges = oldFire; #endif - /* Help buffer is filtered. */ + // Help buffer is filtered. if (bt_help(curbuf)) fix_help_buffer(); } @@ -287,7 +287,7 @@ open_buffer( retval = read_buffer(TRUE, eap, flags); } - /* if first time loading this buffer, init b_chartab[] */ + // if first time loading this buffer, init b_chartab[] if (curbuf->b_flags & BF_NEVERLOADED) { (void)buf_init_chartab(curbuf, FALSE); @@ -301,11 +301,11 @@ open_buffer( * Apply the automatic commands, before processing the modelines. * So the modelines have priority over autocommands. */ - /* When reading stdin, the buffer contents always needs writing, so set - * the changed flag. Unless in readonly mode: "ls | gview -". - * When interrupted and 'cpoptions' contains 'i' set changed flag. */ + // When reading stdin, the buffer contents always needs writing, so set + // the changed flag. Unless in readonly mode: "ls | gview -". + // When interrupted and 'cpoptions' contains 'i' set changed flag. if ((got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL) - || modified_was_set /* ":set modified" used in autocmd */ + || modified_was_set // ":set modified" used in autocmd #ifdef FEAT_EVAL || (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL) #endif @@ -313,14 +313,14 @@ open_buffer( changed(); else if (retval == OK && !read_stdin && !read_fifo) unchanged(curbuf, FALSE, TRUE); - save_file_ff(curbuf); /* keep this fileformat */ + save_file_ff(curbuf); // keep this fileformat - /* Set last_changedtick to avoid triggering a TextChanged autocommand right - * after it was added. */ + // Set last_changedtick to avoid triggering a TextChanged autocommand right + // after it was added. curbuf->b_last_changedtick = CHANGEDTICK(curbuf); curbuf->b_last_changedtick_pum = CHANGEDTICK(curbuf); - /* require "!" to overwrite the file, because it wasn't read completely */ + // require "!" to overwrite the file, because it wasn't read completely #ifdef FEAT_EVAL if (aborting()) #else @@ -329,12 +329,12 @@ open_buffer( curbuf->b_flags |= BF_READERR; #ifdef FEAT_FOLDING - /* Need to update automatic folding. Do this before the autocommands, - * they may use the fold info. */ + // Need to update automatic folding. Do this before the autocommands, + // they may use the fold info. foldUpdateAll(curwin); #endif - /* need to set w_topline, unless some autocommand already did that. */ + // need to set w_topline, unless some autocommand already did that. if (!(curwin->w_valid & VALID_TOPLINE)) { curwin->w_topline = 1; @@ -358,7 +358,7 @@ open_buffer( { aco_save_T aco; - /* Go to the buffer that was opened. */ + // Go to the buffer that was opened. aucmd_prepbuf(&aco, old_curbuf.br_buf); do_modelines(0); curbuf->b_flags &= ~(BF_CHECK_RO | BF_NEVERLOADED); @@ -370,7 +370,7 @@ open_buffer( apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf); #endif - /* restore curwin/curbuf and a few other things */ + // restore curwin/curbuf and a few other things aucmd_restbuf(&aco); } } @@ -413,8 +413,8 @@ buf_valid(buf_T *buf) { buf_T *bp; - /* Assume that we more often have a recent buffer, start with the last - * one. */ + // Assume that we more often have a recent buffer, start with the last + // one. for (bp = lastbuf; bp != NULL; bp = bp->b_prev) if (bp == buf) return TRUE; @@ -490,7 +490,7 @@ can_unload_buffer(buf_T *buf) */ void close_buffer( - win_T *win, /* if not NULL, set b_last_cursor */ + win_T *win, // if not NULL, set b_last_cursor buf_T *buf, int action, int abort_if_last) @@ -510,18 +510,18 @@ close_buffer( * The caller must take care of NOT deleting/freeing when 'bufhidden' is * "hide" (otherwise we could never free or delete a buffer). */ - if (buf->b_p_bh[0] == 'd') /* 'bufhidden' == "delete" */ + if (buf->b_p_bh[0] == 'd') // 'bufhidden' == "delete" { del_buf = TRUE; unload_buf = TRUE; } - else if (buf->b_p_bh[0] == 'w') /* 'bufhidden' == "wipe" */ + else if (buf->b_p_bh[0] == 'w') // 'bufhidden' == "wipe" { del_buf = TRUE; unload_buf = TRUE; wipe_buf = TRUE; } - else if (buf->b_p_bh[0] == 'u') /* 'bufhidden' == "unload" */ + else if (buf->b_p_bh[0] == 'u') // 'bufhidden' == "unload" unload_buf = TRUE; #ifdef FEAT_TERMINAL @@ -534,19 +534,19 @@ close_buffer( if (!can_unload_buffer(buf)) return; - /* Wiping out or unloading a terminal buffer kills the job. */ + // Wiping out or unloading a terminal buffer kills the job. free_terminal(buf); } else { - /* The job keeps running, hide the buffer. */ + // The job keeps running, hide the buffer. del_buf = FALSE; unload_buf = FALSE; } } else { - /* A terminal buffer is wiped out if the job has finished. */ + // A terminal buffer is wiped out if the job has finished. del_buf = TRUE; unload_buf = TRUE; wipe_buf = TRUE; @@ -554,18 +554,18 @@ close_buffer( } #endif - /* Disallow deleting the buffer when it is locked (already being closed or - * halfway a command that relies on it). Unloading is allowed. */ + // Disallow deleting the buffer when it is locked (already being closed or + // halfway a command that relies on it). Unloading is allowed. if ((del_buf || wipe_buf) && !can_unload_buffer(buf)) return; - /* check no autocommands closed the window */ + // check no autocommands closed the window if (win != NULL && win_valid_any_tab(win)) { - /* Set b_last_cursor when closing the last window for the buffer. - * Remember the last cursor position and window options of the buffer. - * This used to be only for the current window, but then options like - * 'foldmethod' may be lost with a ":only" command. */ + // Set b_last_cursor when closing the last window for the buffer. + // Remember the last cursor position and window options of the buffer. + // This used to be only for the current window, but then options like + // 'foldmethod' may be lost with a ":only" command. if (buf->b_nwindows == 1) set_last_cursor(win); buflist_setfpos(buf, win, @@ -575,7 +575,7 @@ close_buffer( set_bufref(&bufref, buf); - /* When the buffer is no longer in a window, trigger BufWinLeave */ + // When the buffer is no longer in a window, trigger BufWinLeave if (buf->b_nwindows == 1) { ++buf->b_locked; @@ -583,40 +583,40 @@ close_buffer( FALSE, buf) && !bufref_valid(&bufref)) { - /* Autocommands deleted the buffer. */ + // Autocommands deleted the buffer. aucmd_abort: emsg(_(e_auabort)); return; } --buf->b_locked; if (abort_if_last && one_window()) - /* Autocommands made this the only window. */ + // Autocommands made this the only window. goto aucmd_abort; - /* When the buffer becomes hidden, but is not unloaded, trigger - * BufHidden */ + // When the buffer becomes hidden, but is not unloaded, trigger + // BufHidden if (!unload_buf) { ++buf->b_locked; if (apply_autocmds(EVENT_BUFHIDDEN, buf->b_fname, buf->b_fname, FALSE, buf) && !bufref_valid(&bufref)) - /* Autocommands deleted the buffer. */ + // Autocommands deleted the buffer. goto aucmd_abort; --buf->b_locked; if (abort_if_last && one_window()) - /* Autocommands made this the only window. */ + // Autocommands made this the only window. goto aucmd_abort; } #ifdef FEAT_EVAL - if (aborting()) /* autocmds may abort script processing */ + if (aborting()) // autocmds may abort script processing return; #endif } - /* If the buffer was in curwin and the window has changed, go back to that - * window, if it still exists. This avoids that ":edit x" triggering a - * "tabnext" BufUnload autocmd leaves a window behind without a buffer. */ + // If the buffer was in curwin and the window has changed, go back to that + // window, if it still exists. This avoids that ":edit x" triggering a + // "tabnext" BufUnload autocmd leaves a window behind without a buffer. if (is_curwin && curwin != the_curwin && win_valid_any_tab(the_curwin)) { block_autocmds(); @@ -626,26 +626,26 @@ aucmd_abort: nwindows = buf->b_nwindows; - /* decrease the link count from windows (unless not in any window) */ + // decrease the link count from windows (unless not in any window) if (buf->b_nwindows > 0) --buf->b_nwindows; #ifdef FEAT_DIFF if (diffopt_hiddenoff() && !unload_buf && buf->b_nwindows == 0) - diff_buf_delete(buf); /* Clear 'diff' for hidden buffer. */ + diff_buf_delete(buf); // Clear 'diff' for hidden buffer. #endif - /* Return when a window is displaying the buffer or when it's not - * unloaded. */ + // Return when a window is displaying the buffer or when it's not + // unloaded. if (buf->b_nwindows > 0 || !unload_buf) return; - /* Always remove the buffer when there is no file name. */ + // Always remove the buffer when there is no file name. if (buf->b_ffname == NULL) del_buf = TRUE; - /* When closing the current buffer stop Visual mode before freeing - * anything. */ + // When closing the current buffer stop Visual mode before freeing + // anything. if (buf == curbuf && VIsual_active #if defined(EXITFREE) && !entered_free_all_mem @@ -657,18 +657,18 @@ aucmd_abort: * Free all things allocated for this buffer. * Also calls the "BufDelete" autocommands when del_buf is TRUE. */ - /* Remember if we are closing the current buffer. Restore the number of - * windows, so that autocommands in buf_freeall() don't get confused. */ + // Remember if we are closing the current buffer. Restore the number of + // windows, so that autocommands in buf_freeall() don't get confused. is_curbuf = (buf == curbuf); buf->b_nwindows = nwindows; buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0)); - /* Autocommands may have deleted the buffer. */ + // Autocommands may have deleted the buffer. if (!bufref_valid(&bufref)) return; #ifdef FEAT_EVAL - if (aborting()) /* autocmds may abort script processing */ + if (aborting()) // autocmds may abort script processing return; #endif @@ -683,10 +683,10 @@ aucmd_abort: return; if (win_valid_any_tab(win) && win->w_buffer == buf) - win->w_buffer = NULL; /* make sure we don't use the buffer now */ + win->w_buffer = NULL; // make sure we don't use the buffer now - /* Autocommands may have opened or closed windows for this buffer. - * Decrement the count for the close we do here. */ + // Autocommands may have opened or closed windows for this buffer. + // Decrement the count for the close we do here. if (buf->b_nwindows > 0) --buf->b_nwindows; @@ -722,14 +722,14 @@ aucmd_abort: { if (del_buf) { - /* Free all internal variables and reset option values, to make - * ":bdel" compatible with Vim 5.7. */ + // Free all internal variables and reset option values, to make + // ":bdel" compatible with Vim 5.7. free_buffer_stuff(buf, TRUE); - /* Make it look like a new buffer. */ + // Make it look like a new buffer. buf->b_flags = BF_CHECK_RO | BF_NEVERLOADED; - /* Init the options when loaded again. */ + // Init the options when loaded again. buf->b_p_initialized = FALSE; } buf_clear_file(buf); @@ -752,7 +752,7 @@ buf_clear_file(buf_T *buf) buf->b_p_bomb = FALSE; buf->b_start_bomb = FALSE; buf->b_ml.ml_mfp = NULL; - buf->b_ml.ml_flags = ML_EMPTY; /* empty buffer */ + buf->b_ml.ml_flags = ML_EMPTY; // empty buffer #ifdef FEAT_NETBEANS_INTG netbeans_deleted_all_lines(buf); #endif @@ -775,7 +775,7 @@ buf_freeall(buf_T *buf, int flags) win_T *the_curwin = curwin; tabpage_T *the_curtab = curtab; - /* Make sure the buffer isn't closed by autocommands. */ + // Make sure the buffer isn't closed by autocommands. ++buf->b_locked; set_bufref(&bufref, buf); if (buf->b_ml.ml_mfp != NULL) @@ -783,7 +783,7 @@ buf_freeall(buf_T *buf, int flags) if (apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname, FALSE, buf) && !bufref_valid(&bufref)) - /* autocommands deleted the buffer */ + // autocommands deleted the buffer return; } if ((flags & BFA_DEL) && buf->b_p_bl) @@ -791,7 +791,7 @@ buf_freeall(buf_T *buf, int flags) if (apply_autocmds(EVENT_BUFDELETE, buf->b_fname, buf->b_fname, FALSE, buf) && !bufref_valid(&bufref)) - /* autocommands deleted the buffer */ + // autocommands deleted the buffer return; } if (flags & BFA_WIPE) @@ -799,14 +799,14 @@ buf_freeall(buf_T *buf, int flags) if (apply_autocmds(EVENT_BUFWIPEOUT, buf->b_fname, buf->b_fname, FALSE, buf) && !bufref_valid(&bufref)) - /* autocommands deleted the buffer */ + // autocommands deleted the buffer return; } --buf->b_locked; - /* If the buffer was in curwin and the window has changed, go back to that - * window, if it still exists. This avoids that ":edit x" triggering a - * "tabnext" BufUnload autocmd leaves a window behind without a buffer. */ + // If the buffer was in curwin and the window has changed, go back to that + // window, if it still exists. This avoids that ":edit x" triggering a + // "tabnext" BufUnload autocmd leaves a window behind without a buffer. if (is_curwin && curwin != the_curwin && win_valid_any_tab(the_curwin)) { block_autocmds(); @@ -815,7 +815,7 @@ buf_freeall(buf_T *buf, int flags) } #ifdef FEAT_EVAL - if (aborting()) /* autocmds may abort script processing */ + if (aborting()) // autocmds may abort script processing return; #endif @@ -828,16 +828,16 @@ buf_freeall(buf_T *buf, int flags) if (buf == curbuf && !is_curbuf) return; #ifdef FEAT_DIFF - diff_buf_delete(buf); /* Can't use 'diff' for unloaded buffer. */ + diff_buf_delete(buf); // Can't use 'diff' for unloaded buffer. #endif #ifdef FEAT_SYN_HL - /* Remove any ownsyntax, unless exiting. */ + // Remove any ownsyntax, unless exiting. if (curwin != NULL && curwin->w_buffer == buf) reset_synblock(curwin); #endif #ifdef FEAT_FOLDING - /* No folds in an empty buffer. */ + // No folds in an empty buffer. { win_T *win; tabpage_T *tp; @@ -851,20 +851,20 @@ buf_freeall(buf_T *buf, int flags) #ifdef FEAT_TCL tcl_buffer_free(buf); #endif - ml_close(buf, TRUE); /* close and delete the memline/memfile */ - buf->b_ml.ml_line_count = 0; /* no lines in buffer */ + ml_close(buf, TRUE); // close and delete the memline/memfile + buf->b_ml.ml_line_count = 0; // no lines in buffer if ((flags & BFA_KEEP_UNDO) == 0) { - u_blockfree(buf); /* free the memory allocated for undo */ - u_clearall(buf); /* reset all undo information */ + u_blockfree(buf); // free the memory allocated for undo + u_clearall(buf); // reset all undo information } #ifdef FEAT_SYN_HL - syntax_clear(&buf->b_s); /* reset syntax info */ + syntax_clear(&buf->b_s); // reset syntax info #endif #ifdef FEAT_TEXT_PROP clear_buf_prop_types(buf); #endif - buf->b_flags &= ~BF_READERR; /* a read error is no longer relevant */ + buf->b_flags &= ~BF_READERR; // a read error is no longer relevant } /* @@ -877,7 +877,7 @@ free_buffer(buf_T *buf) ++buf_free_count; free_buffer_stuff(buf, TRUE); #ifdef FEAT_EVAL - /* b:changedtick uses an item in buf_T, remove it now */ + // b:changedtick uses an item in buf_T, remove it now dictitem_remove(buf->b_vars, (dictitem_T *)&buf->b_ct_di); unref_var_dict(buf->b_vars); remove_listeners(buf); @@ -918,8 +918,8 @@ free_buffer(buf_T *buf) if (autocmd_busy) { - /* Do not free the buffer structure while autocommands are executing, - * it's still needed. Free it when autocmd_busy is reset. */ + // Do not free the buffer structure while autocommands are executing, + // it's still needed. Free it when autocmd_busy is reset. buf->b_next = au_pending_free_buf; au_pending_free_buf = buf; } @@ -952,11 +952,11 @@ init_changedtick(buf_T *buf) static void free_buffer_stuff( buf_T *buf, - int free_options) /* free options as well */ + int free_options) // free options as well { if (free_options) { - clear_wininfo(buf); /* including window-local options */ + clear_wininfo(buf); // including window-local options free_buf_options(buf, TRUE); #ifdef FEAT_SPELL ga_clear(&buf->b_s.b_langp); @@ -966,7 +966,7 @@ free_buffer_stuff( { varnumber_T tick = CHANGEDTICK(buf); - vars_clear(&buf->b_vars->dv_hashtab); /* free all buffer variables */ + vars_clear(&buf->b_vars->dv_hashtab); // free all buffer variables hash_init(&buf->b_vars->dv_hashtab); init_changedtick(buf); CHANGEDTICK(buf) = tick; @@ -979,8 +979,8 @@ free_buffer_stuff( #ifdef FEAT_NETBEANS_INTG netbeans_file_killed(buf); #endif - map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); /* clear local mappings */ - map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */ + map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); // clear local mappings + map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); // clear local abbrevs VIM_CLEAR(buf->b_start_fenc); } @@ -1029,19 +1029,19 @@ goto_buffer( #if defined(FEAT_EVAL) cleanup_T cs; - /* Reset the error/interrupt/exception state here so that - * aborting() returns FALSE when closing a window. */ + // Reset the error/interrupt/exception state here so that + // aborting() returns FALSE when closing a window. enter_cleanup(&cs); #endif - /* Quitting means closing the split window, nothing else. */ + // Quitting means closing the split window, nothing else. win_close(curwin, TRUE); swap_exists_action = SEA_NONE; swap_exists_did_quit = TRUE; #if defined(FEAT_EVAL) - /* Restore the error/interrupt/exception state if not discarded by a - * new aborting error, interrupt, or uncaught exception. */ + // Restore the error/interrupt/exception state if not discarded by a + // new aborting error, interrupt, or uncaught exception. leave_cleanup(&cs); #endif } @@ -1067,15 +1067,15 @@ handle_swap_exists(bufref_T *old_curbuf) if (swap_exists_action == SEA_QUIT) { #if defined(FEAT_EVAL) - /* Reset the error/interrupt/exception state here so that - * aborting() returns FALSE when closing a buffer. */ + // Reset the error/interrupt/exception state here so that + // aborting() returns FALSE when closing a buffer. enter_cleanup(&cs); #endif - /* User selected Quit at ATTENTION prompt. Go back to previous - * buffer. If that buffer is gone or the same as the current one, - * open a new, empty buffer. */ - swap_exists_action = SEA_NONE; /* don't want it again */ + // User selected Quit at ATTENTION prompt. Go back to previous + // buffer. If that buffer is gone or the same as the current one, + // open a new, empty buffer. + swap_exists_action = SEA_NONE; // don't want it again swap_exists_did_quit = TRUE; close_buffer(curwin, curbuf, DOBUF_UNLOAD, FALSE); if (old_curbuf == NULL || !bufref_valid(old_curbuf) @@ -1098,32 +1098,32 @@ handle_swap_exists(bufref_T *old_curbuf) check_colorcolumn(curwin); #endif } - /* If "old_curbuf" is NULL we are in big trouble here... */ + // If "old_curbuf" is NULL we are in big trouble here... #if defined(FEAT_EVAL) - /* Restore the error/interrupt/exception state if not discarded by a - * new aborting error, interrupt, or uncaught exception. */ + // Restore the error/interrupt/exception state if not discarded by a + // new aborting error, interrupt, or uncaught exception. leave_cleanup(&cs); #endif } else if (swap_exists_action == SEA_RECOVER) { #if defined(FEAT_EVAL) - /* Reset the error/interrupt/exception state here so that - * aborting() returns FALSE when closing a buffer. */ + // Reset the error/interrupt/exception state here so that + // aborting() returns FALSE when closing a buffer. enter_cleanup(&cs); #endif - /* User selected Recover at ATTENTION prompt. */ + // User selected Recover at ATTENTION prompt. msg_scroll = TRUE; ml_recover(FALSE); - msg_puts("\n"); /* don't overwrite the last message */ + msg_puts("\n"); // don't overwrite the last message cmdline_row = msg_row; do_modelines(0); #if defined(FEAT_EVAL) - /* Restore the error/interrupt/exception state if not discarded by a - * new aborting error, interrupt, or uncaught exception. */ + // Restore the error/interrupt/exception state if not discarded by a + // new aborting error, interrupt, or uncaught exception. leave_cleanup(&cs); #endif } @@ -1146,16 +1146,16 @@ handle_swap_exists(bufref_T *old_curbuf) char * do_bufdel( int command, - char_u *arg, /* pointer to extra arguments */ + char_u *arg, // pointer to extra arguments int addr_count, - int start_bnr, /* first buffer number in a range */ - int end_bnr, /* buffer nr or last buffer nr in a range */ + int start_bnr, // first buffer number in a range + int end_bnr, // buffer nr or last buffer nr in a range int forceit) { - int do_current = 0; /* delete current buffer? */ - int deleted = 0; /* number of buffers deleted */ - char *errormsg = NULL; /* return value */ - int bnr; /* buffer number */ + int do_current = 0; // delete current buffer? + int deleted = 0; // number of buffers deleted + char *errormsg = NULL; // return value + int bnr; // buffer number char_u *p; if (addr_count == 0) @@ -1166,11 +1166,11 @@ do_bufdel( { if (addr_count == 2) { - if (*arg) /* both range and argument is not allowed */ + if (*arg) // both range and argument is not allowed return _(e_trailing); bnr = start_bnr; } - else /* addr_count == 1 */ + else // addr_count == 1 bnr = end_bnr; for ( ;!got_int; ui_breakcheck()) @@ -1195,7 +1195,7 @@ do_bufdel( if (++bnr > end_bnr) break; } - else /* addr_count == 1 */ + else // addr_count == 1 { arg = skipwhite(arg); if (*arg == NUL) @@ -1206,7 +1206,7 @@ do_bufdel( bnr = buflist_findpat(arg, p, command == DOBUF_WIPE || command == DOBUF_WIPE_REUSE, FALSE, FALSE); - if (bnr < 0) /* failed */ + if (bnr < 0) // failed break; arg = p; } @@ -1268,7 +1268,7 @@ empty_curbuf( set_bufref(&bufref, buf); if (close_others) - /* Close any other windows on this buffer, then make it empty. */ + // Close any other windows on this buffer, then make it empty. close_windows(buf, TRUE); setpcmark(); @@ -1308,9 +1308,9 @@ empty_curbuf( do_buffer( int action, int start, - int dir, /* FORWARD or BACKWARD */ - int count, /* buffer number or number of buffers */ - int forceit) /* TRUE for :...! */ + int dir, // FORWARD or BACKWARD + int count, // buffer number or number of buffers + int forceit) // TRUE for :...! { buf_T *buf; buf_T *bp; @@ -1323,7 +1323,7 @@ do_buffer( case DOBUF_LAST: buf = lastbuf; break; default: buf = curbuf; break; } - if (start == DOBUF_MOD) /* find next modified buffer */ + if (start == DOBUF_MOD) // find next modified buffer { while (count-- > 0) { @@ -1341,7 +1341,7 @@ do_buffer( return FAIL; } } - else if (start == DOBUF_FIRST && count) /* find specified buffer number */ + else if (start == DOBUF_FIRST && count) // find specified buffer number { while (buf != NULL && buf->b_fnum != count) buf = buf->b_next; @@ -1351,8 +1351,8 @@ do_buffer( bp = NULL; while (count > 0 || (!unload && !buf->b_p_bl && bp != buf)) { - /* remember the buffer where we start, we come back there when all - * buffers are unlisted. */ + // remember the buffer where we start, we come back there when all + // buffers are unlisted. if (bp == NULL) bp = buf; if (dir == FORWARD) @@ -1367,26 +1367,26 @@ do_buffer( if (buf == NULL) buf = lastbuf; } - /* don't count unlisted buffers */ + // don't count unlisted buffers if (unload || buf->b_p_bl) { --count; - bp = NULL; /* use this buffer as new starting point */ + bp = NULL; // use this buffer as new starting point } if (bp == buf) { - /* back where we started, didn't find anything. */ + // back where we started, didn't find anything. emsg(_("E85: There is no listed buffer")); return FAIL; } } } - if (buf == NULL) /* could not find it */ + if (buf == NULL) // could not find it { if (start == DOBUF_FIRST) { - /* don't warn when deleting */ + // don't warn when deleting if (!unload) semsg(_(e_nobufnr), count); } @@ -1414,8 +1414,8 @@ do_buffer( set_bufref(&bufref, buf); - /* When unloading or deleting a buffer that's already unloaded and - * unlisted: fail silently. */ + // When unloading or deleting a buffer that's already unloaded and + // unlisted: fail silently. if (action != DOBUF_WIPE && action != DOBUF_WIPE_REUSE && buf->b_ml.ml_mfp == NULL && !buf->b_p_bl) return FAIL; @@ -1427,11 +1427,11 @@ do_buffer( { dialog_changed(buf, FALSE); if (!bufref_valid(&bufref)) - /* Autocommand deleted buffer, oops! It's not changed - * now. */ + // Autocommand deleted buffer, oops! It's not changed + // now. return FAIL; - /* If it's still changed fail silently, the dialog already - * mentioned why it fails. */ + // If it's still changed fail silently, the dialog already + // mentioned why it fails. if (bufIsChanged(buf)) return FAIL; } @@ -1444,7 +1444,7 @@ do_buffer( } } - /* When closing the current buffer stop Visual mode. */ + // When closing the current buffer stop Visual mode. if (buf == curbuf && VIsual_active) end_visual_mode(); @@ -1492,8 +1492,8 @@ do_buffer( * then before the current buffer. * Finally use any buffer. */ - buf = NULL; /* selected buffer */ - bp = NULL; /* used when no loaded buffer found */ + buf = NULL; // selected buffer + bp = NULL; // used when no loaded buffer found if (au_new_curbuf.br_buf != NULL && bufref_valid(&au_new_curbuf)) buf = au_new_curbuf.br_buf; #ifdef FEAT_JUMPLIST @@ -1512,29 +1512,29 @@ do_buffer( if (buf != NULL) { if (buf == curbuf || !buf->b_p_bl) - buf = NULL; /* skip current and unlisted bufs */ + buf = NULL; // skip current and unlisted bufs else if (buf->b_ml.ml_mfp == NULL) { - /* skip unloaded buf, but may keep it for later */ + // skip unloaded buf, but may keep it for later if (bp == NULL) bp = buf; buf = NULL; } } - if (buf != NULL) /* found a valid buffer: stop searching */ + if (buf != NULL) // found a valid buffer: stop searching break; - /* advance to older entry in jump list */ + // advance to older entry in jump list if (!jumpidx && curwin->w_jumplistidx == curwin->w_jumplistlen) break; if (--jumpidx < 0) jumpidx = curwin->w_jumplistlen - 1; - if (jumpidx == forward) /* List exhausted for sure */ + if (jumpidx == forward) // List exhausted for sure break; } } #endif - if (buf == NULL) /* No previous buffer, Try 2'nd approach */ + if (buf == NULL) // No previous buffer, Try 2'nd approach { forward = TRUE; buf = curbuf->b_next; @@ -1542,18 +1542,18 @@ do_buffer( { if (buf == NULL) { - if (!forward) /* tried both directions */ + if (!forward) // tried both directions break; buf = curbuf->b_prev; forward = FALSE; continue; } - /* in non-help buffer, try to skip help buffers, and vv */ + // in non-help buffer, try to skip help buffers, and vv if (buf->b_help == curbuf->b_help && buf->b_p_bl) { - if (buf->b_ml.ml_mfp != NULL) /* found loaded buffer */ + if (buf->b_ml.ml_mfp != NULL) // found loaded buffer break; - if (bp == NULL) /* remember unloaded buf for later */ + if (bp == NULL) // remember unloaded buf for later bp = buf; } if (forward) @@ -1562,15 +1562,15 @@ do_buffer( buf = buf->b_prev; } } - if (buf == NULL) /* No loaded buffer, use unloaded one */ + if (buf == NULL) // No loaded buffer, use unloaded one buf = bp; - if (buf == NULL) /* No loaded buffer, find listed one */ + if (buf == NULL) // No loaded buffer, find listed one { FOR_ALL_BUFFERS(buf) if (buf->b_p_bl && buf != curbuf) break; } - if (buf == NULL) /* Still no buffer, just take one */ + if (buf == NULL) // Still no buffer, just take one { if (curbuf->b_next != NULL) buf = curbuf->b_next; @@ -1581,29 +1581,29 @@ do_buffer( if (buf == NULL) { - /* Autocommands must have wiped out all other buffers. Only option - * now is to make the current buffer empty. */ + // Autocommands must have wiped out all other buffers. Only option + // now is to make the current buffer empty. return empty_curbuf(FALSE, forceit, action); } /* * make buf current buffer */ - if (action == DOBUF_SPLIT) /* split window first */ + if (action == DOBUF_SPLIT) // split window first { - /* If 'switchbuf' contains "useopen": jump to first window containing - * "buf" if one exists */ + // If 'switchbuf' contains "useopen": jump to first window containing + // "buf" if one exists if ((swb_flags & SWB_USEOPEN) && buf_jump_open_win(buf)) return OK; - /* If 'switchbuf' contains "usetab": jump to first window in any tab - * page containing "buf" if one exists */ + // If 'switchbuf' contains "usetab": jump to first window in any tab + // page containing "buf" if one exists if ((swb_flags & SWB_USETAB) && buf_jump_open_tab(buf)) return OK; if (win_split(0, 0) == FAIL) return FAIL; } - /* go to current buffer - nothing to do */ + // go to current buffer - nothing to do if (buf == curbuf) return OK; @@ -1620,7 +1620,7 @@ do_buffer( set_bufref(&bufref, buf); dialog_changed(curbuf, FALSE); if (!bufref_valid(&bufref)) - /* Autocommand deleted buffer, oops! */ + // Autocommand deleted buffer, oops! return FAIL; } if (bufIsChanged(curbuf)) @@ -1631,14 +1631,14 @@ do_buffer( } } - /* Go to the other buffer. */ + // Go to the other buffer. set_curbuf(buf, action); if (action == DOBUF_SPLIT) - RESET_BINDING(curwin); /* reset 'scrollbind' and 'cursorbind' */ + RESET_BINDING(curwin); // reset 'scrollbind' and 'cursorbind' #if defined(FEAT_EVAL) - if (aborting()) /* autocmds may abort script processing */ + if (aborting()) // autocmds may abort script processing return FAIL; #endif @@ -1669,20 +1669,19 @@ set_curbuf(buf_T *buf, int action) setpcmark(); if (!cmdmod.keepalt) - curwin->w_alt_fnum = curbuf->b_fnum; /* remember alternate file */ - buflist_altfpos(curwin); /* remember curpos */ + curwin->w_alt_fnum = curbuf->b_fnum; // remember alternate file + buflist_altfpos(curwin); // remember curpos - /* Don't restart Select mode after switching to another buffer. */ + // Don't restart Select mode after switching to another buffer. VIsual_reselect = FALSE; - /* close_windows() or apply_autocmds() may change curbuf and wipe out "buf" - */ + // close_windows() or apply_autocmds() may change curbuf and wipe out "buf" prevbuf = curbuf; set_bufref(&prevbufref, prevbuf); set_bufref(&newbufref, buf); - /* Autocommands may delete the curren buffer and/or the buffer we wan to go - * to. In those cases don't close the buffer. */ + // Autocommands may delete the curren buffer and/or the buffer we wan to go + // to. In those cases don't close the buffer. if (!apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf) || (bufref_valid(&prevbufref) && bufref_valid(&newbufref) @@ -1711,13 +1710,13 @@ set_curbuf(buf_T *buf, int action) && !buf_hide(prevbuf) && !bufIsChanged(prevbuf)) ? DOBUF_UNLOAD : 0, FALSE); if (curwin != previouswin && win_valid(previouswin)) - /* autocommands changed curwin, Grr! */ + // autocommands changed curwin, Grr! curwin = previouswin; } } - /* An autocommand may have deleted "buf", already entered it (e.g., when - * it did ":bunload") or aborted the script processing. - * If curwin->w_buffer is null, enter_buffer() will make it valid again */ + // An autocommand may have deleted "buf", already entered it (e.g., when + // it did ":bunload") or aborted the script processing. + // If curwin->w_buffer is null, enter_buffer() will make it valid again if ((buf_valid(buf) && buf != curbuf #ifdef FEAT_EVAL && !aborting() @@ -1765,25 +1764,25 @@ enter_buffer(buf_T *buf) curwin->w_s = &(curbuf->b_s); #endif - /* Cursor on first line by default. */ + // Cursor on first line by default. curwin->w_cursor.lnum = 1; curwin->w_cursor.col = 0; curwin->w_cursor.coladd = 0; curwin->w_set_curswant = TRUE; curwin->w_topline_was_set = FALSE; - /* mark cursor position as being invalid */ + // mark cursor position as being invalid curwin->w_valid = 0; buflist_setfpos(curbuf, curwin, curbuf->b_last_cursor.lnum, curbuf->b_last_cursor.col, TRUE); - /* Make sure the buffer is loaded. */ - if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */ + // Make sure the buffer is loaded. + if (curbuf->b_ml.ml_mfp == NULL) // need to load the file { - /* If there is no filetype, allow for detecting one. Esp. useful for - * ":ball" used in a autocommand. If there already is a filetype we - * might prefer to keep it. */ + // If there is no filetype, allow for detecting one. Esp. useful for + // ":ball" used in a autocommand. If there already is a filetype we + // might prefer to keep it. if (*curbuf->b_p_ft == NUL) did_filetype = FALSE; @@ -1805,25 +1804,25 @@ enter_buffer(buf_T *buf) apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf); } - /* If autocommands did not change the cursor position, restore cursor lnum - * and possibly cursor col. */ + // If autocommands did not change the cursor position, restore cursor lnum + // and possibly cursor col. if (curwin->w_cursor.lnum == 1 && inindent(0)) buflist_getfpos(); - check_arg_idx(curwin); /* check for valid arg_idx */ + check_arg_idx(curwin); // check for valid arg_idx #ifdef FEAT_TITLE maketitle(); #endif - /* when autocmds didn't change it */ + // when autocmds didn't change it if (curwin->w_topline == 1 && !curwin->w_topline_was_set) - scroll_cursor_halfway(FALSE); /* redisplay at correct position */ + scroll_cursor_halfway(FALSE); // redisplay at correct position #ifdef FEAT_NETBEANS_INTG - /* Send fileOpened event because we've changed buffers. */ + // Send fileOpened event because we've changed buffers. netbeans_file_activated(curbuf); #endif - /* Change directories when the 'acd' option is set. */ + // Change directories when the 'acd' option is set. DO_AUTOCHDIR; #ifdef FEAT_KEYMAP @@ -1831,8 +1830,8 @@ enter_buffer(buf_T *buf) (void)keymap_init(); #endif #ifdef FEAT_SPELL - /* May need to set the spell language. Can only do this after the buffer - * has been properly setup. */ + // May need to set the spell language. Can only do this after the buffer + // has been properly setup. if (!curbuf->b_help && curwin->w_p_spell && *curwin->w_s->b_p_spl != NUL) (void)did_set_spelllang(curwin); #endif @@ -1937,8 +1936,8 @@ buflist_new( * If file name already exists in the list, update the entry. */ #ifdef UNIX - /* On Unix we can use inode numbers when the file exists. Works better - * for hard links. */ + // On Unix we can use inode numbers when the file exists. Works better + // for hard links. if (sfname == NULL || mch_stat((char *)sfname, &st) < 0) st.st_dev = (dev_T)-1; #endif @@ -1955,8 +1954,8 @@ buflist_new( buflist_setfpos(buf, curwin, lnum, (colnr_T)0, FALSE); if ((flags & BLN_NOOPT) == 0) - /* copy the options now, if 'cpo' doesn't have 's' and not done - * already */ + // copy the options now, if 'cpo' doesn't have 's' and not done + // already buf_copy_options(buf, 0); if ((flags & BLN_LISTED) && !buf->b_p_bl) @@ -1987,19 +1986,19 @@ buflist_new( if ((flags & BLN_CURBUF) && curbuf_reusable()) { buf = curbuf; - /* It's like this buffer is deleted. Watch out for autocommands that - * change curbuf! If that happens, allocate a new buffer anyway. */ + // It's like this buffer is deleted. Watch out for autocommands that + // change curbuf! If that happens, allocate a new buffer anyway. if (curbuf->b_p_bl) apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf); if (buf == curbuf) apply_autocmds(EVENT_BUFWIPEOUT, NULL, NULL, FALSE, curbuf); #ifdef FEAT_EVAL - if (aborting()) /* autocmds may abort script processing */ + if (aborting()) // autocmds may abort script processing return NULL; #endif if (buf == curbuf) { - /* Make sure 'bufhidden' and 'buftype' are empty */ + // Make sure 'bufhidden' and 'buftype' are empty clear_string_option(&buf->b_p_bh); clear_string_option(&buf->b_p_bt); } @@ -2013,7 +2012,7 @@ buflist_new( return NULL; } #ifdef FEAT_EVAL - /* init b: variables */ + // init b: variables buf->b_vars = dict_alloc(); if (buf->b_vars == NULL) { @@ -2050,22 +2049,22 @@ buflist_new( if (buf == curbuf) { - /* free all things allocated for this buffer */ + // free all things allocated for this buffer buf_freeall(buf, 0); - if (buf != curbuf) /* autocommands deleted the buffer! */ + if (buf != curbuf) // autocommands deleted the buffer! return NULL; #if defined(FEAT_EVAL) - if (aborting()) /* autocmds may abort script processing */ + if (aborting()) // autocmds may abort script processing return NULL; #endif - free_buffer_stuff(buf, FALSE); /* delete local variables et al. */ + free_buffer_stuff(buf, FALSE); // delete local variables et al. - /* Init the options. */ + // Init the options. buf->b_p_initialized = FALSE; buf_copy_options(buf, BCO_ENTER); #ifdef FEAT_KEYMAP - /* need to reload lmaps and set b:keymap_name */ + // need to reload lmaps and set b:keymap_name curbuf->b_kmap_state |= KEYMAP_INIT; #endif } @@ -2075,12 +2074,12 @@ buflist_new( * put new buffer at the end of the buffer list */ buf->b_next = NULL; - if (firstbuf == NULL) /* buffer list is empty */ + if (firstbuf == NULL) // buffer list is empty { buf->b_prev = NULL; firstbuf = buf; } - else /* append new buffer at end of list */ + else // append new buffer at end of list { lastbuf->b_next = buf; buf->b_prev = lastbuf; @@ -2097,7 +2096,7 @@ buflist_new( } else buf->b_fnum = top_file_num++; - if (top_file_num < 0) /* wrap around (may cause duplicates) */ + if (top_file_num < 0) // wrap around (may cause duplicates) { emsg(_("W14: Warning: List of file names overflow")); if (emsg_silent == 0) @@ -2139,16 +2138,16 @@ buflist_new( if (flags & BLN_DUMMY) buf->b_flags |= BF_DUMMY; buf_clear_file(buf); - clrallmarks(buf); /* clear marks */ - fmarks_check_names(buf); /* check file marks for this file */ - buf->b_p_bl = (flags & BLN_LISTED) ? TRUE : FALSE; /* init 'buflisted' */ + clrallmarks(buf); // clear marks + fmarks_check_names(buf); // check file marks for this file + buf->b_p_bl = (flags & BLN_LISTED) ? TRUE : FALSE; // init 'buflisted' if (!(flags & BLN_DUMMY)) { bufref_T bufref; - /* Tricky: these autocommands may change the buffer list. They could - * also split the window with re-using the one empty buffer. This may - * result in unexpectedly losing the empty buffer. */ + // Tricky: these autocommands may change the buffer list. They could + // also split the window with re-using the one empty buffer. This may + // result in unexpectedly losing the empty buffer. set_bufref(&bufref, buf); if (apply_autocmds(EVENT_BUFNEW, NULL, NULL, FALSE, buf) && !bufref_valid(&bufref)) @@ -2160,7 +2159,7 @@ buflist_new( return NULL; } #ifdef FEAT_EVAL - if (aborting()) /* autocmds may abort script processing */ + if (aborting()) // autocmds may abort script processing return NULL; #endif } @@ -2318,7 +2317,7 @@ buflist_getfile( return FAIL; } - /* if alternate file is the current buffer, nothing to do */ + // if alternate file is the current buffer, nothing to do if (buf == curbuf) return OK; @@ -2330,7 +2329,7 @@ buflist_getfile( if (curbuf_locked()) return FAIL; - /* altfpos may be changed by getfile(), get it now */ + // altfpos may be changed by getfile(), get it now if (lnum == 0) { fpos = buflist_findfpos(buf); @@ -2342,18 +2341,18 @@ buflist_getfile( if (options & GETF_SWITCH) { - /* If 'switchbuf' contains "useopen": jump to first window containing - * "buf" if one exists */ + // If 'switchbuf' contains "useopen": jump to first window containing + // "buf" if one exists if (swb_flags & SWB_USEOPEN) wp = buf_jump_open_win(buf); - /* If 'switchbuf' contains "usetab": jump to first window in any tab - * page containing "buf" if one exists */ + // If 'switchbuf' contains "usetab": jump to first window in any tab + // page containing "buf" if one exists if (wp == NULL && (swb_flags & SWB_USETAB)) wp = buf_jump_open_tab(buf); - /* If 'switchbuf' contains "split", "vsplit" or "newtab" and the - * current buffer isn't empty: open new tab or window */ + // If 'switchbuf' contains "split", "vsplit" or "newtab" and the + // current buffer isn't empty: open new tab or window if (wp == NULL && (swb_flags & (SWB_VSPLIT | SWB_SPLIT | SWB_NEWTAB)) && !BUFEMPTY()) { @@ -2372,7 +2371,7 @@ buflist_getfile( { --RedrawingDisabled; - /* cursor is at to BOL and w_cursor.lnum is checked due to getfile() */ + // cursor is at to BOL and w_cursor.lnum is checked due to getfile() if (!p_sol && col != 0) { curwin->w_cursor.col = col; @@ -2421,10 +2420,10 @@ buflist_findname_exp(char_u *fname) char_u *ffname; buf_T *buf = NULL; - /* First make the name into a full path name */ + // First make the name into a full path name ffname = FullName_save(fname, #ifdef UNIX - TRUE /* force expansion, get rid of symbolic links */ + TRUE // force expansion, get rid of symbolic links #else FALSE #endif @@ -2468,7 +2467,7 @@ buflist_findname_stat( #endif buf_T *buf; - /* Start at the last buffer, expect to find a match sooner. */ + // Start at the last buffer, expect to find a match sooner. for (buf = lastbuf; buf != NULL; buf = buf->b_prev) if ((buf->b_flags & BF_DUMMY) == 0 && !otherfile_buf(buf, ffname #ifdef UNIX @@ -2487,10 +2486,10 @@ buflist_findname_stat( int buflist_findpat( char_u *pattern, - char_u *pattern_end, /* pointer to first char after pattern */ - int unlisted, /* find unlisted buffers */ - int diffmode UNUSED, /* find diff-mode buffers only */ - int curtab_only) /* find buffers in current tab only */ + char_u *pattern_end, // pointer to first char after pattern + int unlisted, // find unlisted buffers + int diffmode UNUSED, // find diff-mode buffers only + int curtab_only) // find buffers in current tab only { buf_T *buf; int match = -1; @@ -2530,8 +2529,8 @@ buflist_findpat( patend = pat + STRLEN(pat) - 1; toggledollar = (patend > pat && *patend == '$'); - /* First try finding a listed buffer. If not found and "unlisted" - * is TRUE, try finding an unlisted buffer. */ + // First try finding a listed buffer. If not found and "unlisted" + // is TRUE, try finding an unlisted buffer. find_listed = TRUE; for (;;) { @@ -2539,11 +2538,11 @@ buflist_findpat( { regmatch_T regmatch; - /* may add '^' and '$' */ + // may add '^' and '$' if (toggledollar) - *patend = (attempt < 2) ? NUL : '$'; /* add/remove '$' */ + *patend = (attempt < 2) ? NUL : '$'; // add/remove '$' p = pat; - if (*p == '^' && !(attempt & 1)) /* add/remove '^' */ + if (*p == '^' && !(attempt & 1)) // add/remove '^' ++p; regmatch.regprog = vim_regcomp(p, p_magic ? RE_MAGIC : 0); if (regmatch.regprog == NULL) @@ -2561,8 +2560,8 @@ buflist_findpat( { if (curtab_only) { - /* Ignore the match if the buffer is not open in - * the current tab. */ + // Ignore the match if the buffer is not open in + // the current tab. win_T *wp; FOR_ALL_WINDOWS(wp) @@ -2571,21 +2570,21 @@ buflist_findpat( if (wp == NULL) continue; } - if (match >= 0) /* already found a match */ + if (match >= 0) // already found a match { match = -2; break; } - match = buf->b_fnum; /* remember first match */ + match = buf->b_fnum; // remember first match } vim_regfree(regmatch.regprog); - if (match >= 0) /* found one match */ + if (match >= 0) // found one match break; } - /* Only search for unlisted buffers if there was no match with - * a listed buffer. */ + // Only search for unlisted buffers if there was no match with + // a listed buffer. if (!unlisted || !find_listed || match != -1) break; find_listed = FALSE; @@ -2630,10 +2629,10 @@ ExpandBufnames( bufmatch_T *matches = NULL; #endif - *num_file = 0; /* return values in case of FAIL */ + *num_file = 0; // return values in case of FAIL *file = NULL; - /* Make a copy of "pat" and change "^" to "\(^\|[\/]\)". */ + // Make a copy of "pat" and change "^" to "\(^\|[\/]\)". if (*pat == '^') { patc = alloc(STRLEN(pat) + 11); @@ -2654,7 +2653,7 @@ ExpandBufnames( regmatch_T regmatch; if (attempt > 0 && patc == pat) - break; /* there was no anchor, no need to try again */ + break; // there was no anchor, no need to try again regmatch.regprog = vim_regcomp(patc + attempt * 11, RE_MAGIC); if (regmatch.regprog == NULL) { @@ -2672,7 +2671,7 @@ ExpandBufnames( count = 0; FOR_ALL_BUFFERS(buf) { - if (!buf->b_p_bl) /* skip unlisted buffers */ + if (!buf->b_p_bl) // skip unlisted buffers continue; p = buflist_match(®match, buf, p_wic); if (p != NULL) @@ -2698,7 +2697,7 @@ ExpandBufnames( } } } - if (count == 0) /* no match found, break here */ + if (count == 0) // no match found, break here break; if (round == 1) { @@ -2717,7 +2716,7 @@ ExpandBufnames( } } vim_regfree(regmatch.regprog); - if (count) /* match(es) found, break here */ + if (count) // match(es) found, break here break; } @@ -2757,11 +2756,11 @@ ExpandBufnames( buflist_match( regmatch_T *rmp, buf_T *buf, - int ignore_case) /* when TRUE ignore case, when FALSE use 'fic' */ + int ignore_case) // when TRUE ignore case, when FALSE use 'fic' { char_u *match; - /* First try the short file name, then the long file name. */ + // First try the short file name, then the long file name. match = fname_match(rmp, buf->b_sfname, ignore_case); if (match == NULL) match = fname_match(rmp, buf->b_ffname, ignore_case); @@ -2777,20 +2776,20 @@ buflist_match( fname_match( regmatch_T *rmp, char_u *name, - int ignore_case) /* when TRUE ignore case, when FALSE use 'fic' */ + int ignore_case) // when TRUE ignore case, when FALSE use 'fic' { char_u *match = NULL; char_u *p; if (name != NULL) { - /* Ignore case when 'fileignorecase' or the argument is set. */ + // Ignore case when 'fileignorecase' or the argument is set. rmp->rm_ic = p_fic || ignore_case; if (vim_regexec(rmp, name, (colnr_T)0)) match = name; else { - /* Replace $(HOME) with '~' and try matching again. */ + // Replace $(HOME) with '~' and try matching again. p = home_replace_save(NULL, name); if (p != NULL && vim_regexec(rmp, p, (colnr_T)0)) match = name; @@ -2831,7 +2830,7 @@ buflist_findnr(int nr) buflist_nr2name( int n, int fullname, - int helptail) /* for help buffers return tail only */ + int helptail) // for help buffers return tail only { buf_T *buf; @@ -2862,17 +2861,17 @@ buflist_setfpos( break; if (wip == NULL) { - /* allocate a new entry */ + // allocate a new entry wip = ALLOC_CLEAR_ONE(wininfo_T); if (wip == NULL) return; wip->wi_win = win; - if (lnum == 0) /* set lnum even when it's 0 */ + if (lnum == 0) // set lnum even when it's 0 lnum = 1; } else { - /* remove the entry from the list */ + // remove the entry from the list if (wip->wi_prev) wip->wi_prev->wi_next = wip->wi_next; else @@ -2894,7 +2893,7 @@ buflist_setfpos( } if (copy_options) { - /* Save the window-specific option values. */ + // Save the window-specific option values. copy_winopt(&win->w_onebuf_opt, &wip->wi_opt); #ifdef FEAT_FOLDING wip->wi_fold_manual = win->w_fold_manual; @@ -2903,7 +2902,7 @@ buflist_setfpos( wip->wi_optset = TRUE; } - /* insert the entry in front of the list */ + // insert the entry in front of the list wip->wi_next = buf->b_wininfo; buf->b_wininfo = wip; wip->wi_prev = NULL; @@ -2926,8 +2925,8 @@ wininfo_other_tab_diff(wininfo_T *wip) if (wip->wi_opt.wo_diff) { FOR_ALL_WINDOWS(wp) - /* return FALSE when it's a window in the current tab page, thus - * the buffer was in diff mode here */ + // return FALSE when it's a window in the current tab page, thus + // the buffer was in diff mode here if (wip->wi_win == wp) return FALSE; return TRUE; @@ -2958,8 +2957,8 @@ find_wininfo( ) break; - /* If no wininfo for curwin, use the first in the list (that doesn't have - * 'diff' set and is in another tab page). */ + // If no wininfo for curwin, use the first in the list (that doesn't have + // 'diff' set and is in another tab page). if (wip == NULL) { #ifdef FEAT_DIFF @@ -2996,8 +2995,8 @@ get_winopts(buf_T *buf) if (wip != NULL && wip->wi_win != NULL && wip->wi_win != curwin && wip->wi_win->w_buffer == buf) { - /* The buffer is currently displayed in the window: use the actual - * option values instead of the saved (possibly outdated) values. */ + // The buffer is currently displayed in the window: use the actual + // option values instead of the saved (possibly outdated) values. win_T *wp = wip->wi_win; copy_winopt(&wp->w_onebuf_opt, &curwin->w_onebuf_opt); @@ -3009,7 +3008,7 @@ get_winopts(buf_T *buf) } else if (wip != NULL && wip->wi_optset) { - /* the buffer was displayed in the current window earlier */ + // the buffer was displayed in the current window earlier copy_winopt(&wip->wi_opt, &curwin->w_onebuf_opt); #ifdef FEAT_FOLDING curwin->w_fold_manual = wip->wi_fold_manual; @@ -3021,7 +3020,7 @@ get_winopts(buf_T *buf) copy_winopt(&curwin->w_allbuf_opt, &curwin->w_onebuf_opt); #ifdef FEAT_FOLDING - /* Set 'foldlevel' to 'foldlevelstart' if it's not negative. */ + // Set 'foldlevel' to 'foldlevelstart' if it's not negative. if (p_fdls >= 0) curwin->w_p_fdl = p_fdls; #endif @@ -3103,7 +3102,7 @@ buflist_list(exarg_T *eap) job_running = term_job_running(buf->b_term); job_none_open = job_running && term_none_open(buf->b_term); #endif - /* skip unlisted buffers, unless ! was used */ + // skip unlisted buffers, unless ! was used if ((!buf->b_p_bl && !eap->forceit && !vim_strchr(eap->arg, 'u')) || (vim_strchr(eap->arg, 'u') && buf->b_p_bl) || (vim_strchr(eap->arg, '+') @@ -3143,8 +3142,8 @@ buflist_list(exarg_T *eap) ro_char = '?'; else ro_char = 'R'; - changed_char = ' '; /* bufIsChanged() returns TRUE to avoid - * closing, bu