diff options
-rw-r--r-- | src/autocmd.c | 17 | ||||
-rw-r--r-- | src/beval.c | 17 | ||||
-rw-r--r-- | src/blob.c | 2 | ||||
-rw-r--r-- | src/blowfish.c | 46 | ||||
-rw-r--r-- | src/buffer.c | 915 | ||||
-rw-r--r-- | src/change.c | 12 | ||||
-rw-r--r-- | src/channel.c | 545 | ||||
-rw-r--r-- | src/charset.c | 277 | ||||
-rw-r--r-- | src/cindent.c | 6 | ||||
-rw-r--r-- | src/crypt.c | 73 | ||||
-rw-r--r-- | src/crypt_zip.c | 8 | ||||
-rw-r--r-- | src/version.c | 2 |
12 files changed, 959 insertions, 961 deletions
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 "<buffer=X>" */ + char_u buflocal_pat[25]; // for "<buffer=X>" 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 = b |