mirror of
https://github.com/neovim/neovim.git
synced 2025-10-02 16:08:36 +00:00
vim-patch:8.2.3542: too many comments are old style (#16096)
Problem: Too many comments are old style.
Solution: Change comments to // style. (closes vim/vim#9021)
c5935a859e
This commit is contained in:
@@ -109,11 +109,9 @@ static int read_buffer(int read_stdin, exarg_T *eap, int flags)
|
|||||||
int retval = OK;
|
int retval = OK;
|
||||||
linenr_T line_count;
|
linenr_T line_count;
|
||||||
|
|
||||||
//
|
|
||||||
// Read from the buffer which the text is already filled in and append at
|
// Read from the buffer which the text is already filled in and append at
|
||||||
// the end. This makes it possible to retry when 'fileformat' or
|
// the end. This makes it possible to retry when 'fileformat' or
|
||||||
// 'fileencoding' was guessed wrong.
|
// 'fileencoding' was guessed wrong.
|
||||||
//
|
|
||||||
line_count = curbuf->b_ml.ml_line_count;
|
line_count = curbuf->b_ml.ml_line_count;
|
||||||
retval = readfile(read_stdin ? NULL : curbuf->b_ffname,
|
retval = readfile(read_stdin ? NULL : curbuf->b_ffname,
|
||||||
read_stdin ? NULL : curbuf->b_fname,
|
read_stdin ? NULL : curbuf->b_fname,
|
||||||
@@ -164,21 +162,17 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags)
|
|||||||
long old_tw = curbuf->b_p_tw;
|
long old_tw = curbuf->b_p_tw;
|
||||||
int read_fifo = false;
|
int read_fifo = false;
|
||||||
|
|
||||||
/*
|
// The 'readonly' flag is only set when BF_NEVERLOADED is being reset.
|
||||||
* The 'readonly' flag is only set when BF_NEVERLOADED is being reset.
|
// When re-entering the same buffer, it should not change, because the
|
||||||
* When re-entering the same buffer, it should not change, because the
|
// user may have reset the flag by hand.
|
||||||
* user may have reset the flag by hand.
|
|
||||||
*/
|
|
||||||
if (readonlymode && curbuf->b_ffname != NULL
|
if (readonlymode && curbuf->b_ffname != NULL
|
||||||
&& (curbuf->b_flags & BF_NEVERLOADED)) {
|
&& (curbuf->b_flags & BF_NEVERLOADED)) {
|
||||||
curbuf->b_p_ro = true;
|
curbuf->b_p_ro = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ml_open(curbuf) == FAIL) {
|
if (ml_open(curbuf) == FAIL) {
|
||||||
/*
|
// There MUST be a memfile, otherwise we can't do anything
|
||||||
* There MUST be a memfile, otherwise we can't do anything
|
// If we can't create one for the current buffer, take another buffer
|
||||||
* If we can't create one for the current buffer, take another buffer
|
|
||||||
*/
|
|
||||||
close_buffer(NULL, curbuf, 0, false);
|
close_buffer(NULL, curbuf, 0, false);
|
||||||
|
|
||||||
curbuf = NULL;
|
curbuf = NULL;
|
||||||
@@ -260,12 +254,10 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags)
|
|||||||
} else if (read_stdin) {
|
} else if (read_stdin) {
|
||||||
int save_bin = curbuf->b_p_bin;
|
int save_bin = curbuf->b_p_bin;
|
||||||
|
|
||||||
/*
|
// First read the text in binary mode into the buffer.
|
||||||
* First read the text in binary mode into the buffer.
|
// Then read from that same buffer and append at the end. This makes
|
||||||
* Then read from that same buffer and append at the end. This makes
|
// it possible to retry when 'fileformat' or 'fileencoding' was
|
||||||
* it possible to retry when 'fileformat' or 'fileencoding' was
|
// guessed wrong.
|
||||||
* guessed wrong.
|
|
||||||
*/
|
|
||||||
curbuf->b_p_bin = true;
|
curbuf->b_p_bin = true;
|
||||||
retval = readfile(NULL, NULL, (linenr_T)0,
|
retval = readfile(NULL, NULL, (linenr_T)0,
|
||||||
(linenr_T)0, (linenr_T)MAXLNUM, NULL,
|
(linenr_T)0, (linenr_T)MAXLNUM, NULL,
|
||||||
@@ -323,10 +315,8 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// The autocommands may have changed the current buffer. Apply the
|
||||||
* The autocommands may have changed the current buffer. Apply the
|
// modelines to the correct buffer, if it still exists and is loaded.
|
||||||
* modelines to the correct buffer, if it still exists and is loaded.
|
|
||||||
*/
|
|
||||||
if (bufref_valid(&old_curbuf) && old_curbuf.br_buf->b_ml.ml_mfp != NULL) {
|
if (bufref_valid(&old_curbuf) && old_curbuf.br_buf->b_ml.ml_mfp != NULL) {
|
||||||
aco_save_T aco;
|
aco_save_T aco;
|
||||||
|
|
||||||
@@ -570,13 +560,11 @@ bool close_buffer(win_T *win, buf_T *buf, int action, bool abort_if_last)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// It's possible that autocommands change curbuf to the one being deleted.
|
||||||
* It's possible that autocommands change curbuf to the one being deleted.
|
// This might cause the previous curbuf to be deleted unexpectedly. But
|
||||||
* This might cause the previous curbuf to be deleted unexpectedly. But
|
// in some cases it's OK to delete the curbuf, because a new one is
|
||||||
* in some cases it's OK to delete the curbuf, because a new one is
|
// obtained anyway. Therefore only return if curbuf changed to the
|
||||||
* obtained anyway. Therefore only return if curbuf changed to the
|
// deleted buffer.
|
||||||
* deleted buffer.
|
|
||||||
*/
|
|
||||||
if (buf == curbuf && !is_curbuf) {
|
if (buf == curbuf && !is_curbuf) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -717,12 +705,10 @@ void buf_freeall(buf_T *buf, int flags)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// It's possible that autocommands change curbuf to the one being deleted.
|
||||||
* It's possible that autocommands change curbuf to the one being deleted.
|
// This might cause curbuf to be deleted unexpectedly. But in some cases
|
||||||
* This might cause curbuf to be deleted unexpectedly. But in some cases
|
// it's OK to delete the curbuf, because a new one is obtained anyway.
|
||||||
* it's OK to delete the curbuf, because a new one is obtained anyway.
|
// Therefore only return if curbuf changed to the deleted buffer.
|
||||||
* Therefore only return if curbuf changed to the deleted buffer.
|
|
||||||
*/
|
|
||||||
if (buf == curbuf && !is_curbuf) {
|
if (buf == curbuf && !is_curbuf) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -977,12 +963,10 @@ char_u *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, int e
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (; !got_int; os_breakcheck()) {
|
for (; !got_int; os_breakcheck()) {
|
||||||
/*
|
// delete the current buffer last, otherwise when the
|
||||||
* delete the current buffer last, otherwise when the
|
// current buffer is deleted, the next buffer becomes
|
||||||
* current buffer is deleted, the next buffer becomes
|
// the current one and will be loaded, which may then
|
||||||
* the current one and will be loaded, which may then
|
// also be deleted, etc.
|
||||||
* also be deleted, etc.
|
|
||||||
*/
|
|
||||||
if (bnr == curbuf->b_fnum) {
|
if (bnr == curbuf->b_fnum) {
|
||||||
do_current = bnr;
|
do_current = bnr;
|
||||||
} else if (do_buffer(command, DOBUF_FIRST, FORWARD, bnr,
|
} else if (do_buffer(command, DOBUF_FIRST, FORWARD, bnr,
|
||||||
@@ -990,9 +974,7 @@ char_u *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, int e
|
|||||||
deleted++;
|
deleted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// find next buffer number to delete/unload
|
||||||
* find next buffer number to delete/unload
|
|
||||||
*/
|
|
||||||
if (addr_count == 2) {
|
if (addr_count == 2) {
|
||||||
if (++bnr > end_bnr) {
|
if (++bnr > end_bnr) {
|
||||||
break;
|
break;
|
||||||
@@ -1196,9 +1178,7 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
// delete buffer "buf" from memory and/or the list
|
||||||
* delete buffer buf from memory and/or the list
|
|
||||||
*/
|
|
||||||
if (unload) {
|
if (unload) {
|
||||||
int forward;
|
int forward;
|
||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
@@ -1247,10 +1227,8 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
|
|||||||
end_visual_mode();
|
end_visual_mode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// If deleting the last (listed) buffer, make it empty.
|
||||||
* If deleting the last (listed) buffer, make it empty.
|
// The last (listed) buffer cannot be unloaded.
|
||||||
* The last (listed) buffer cannot be unloaded.
|
|
||||||
*/
|
|
||||||
bp = NULL;
|
bp = NULL;
|
||||||
FOR_ALL_BUFFERS(bp2) {
|
FOR_ALL_BUFFERS(bp2) {
|
||||||
if (bp2->b_p_bl && bp2 != buf) {
|
if (bp2->b_p_bl && bp2 != buf) {
|
||||||
@@ -1262,11 +1240,9 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
|
|||||||
return empty_curbuf(true, forceit, action);
|
return empty_curbuf(true, forceit, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// If the deleted buffer is the current one, close the current window
|
||||||
* If the deleted buffer is the current one, close the current window
|
// (unless it's the only window). Repeat this so long as we end up in
|
||||||
* (unless it's the only window). Repeat this so long as we end up in
|
// a window with this buffer.
|
||||||
* a window with this buffer.
|
|
||||||
*/
|
|
||||||
while (buf == curbuf
|
while (buf == curbuf
|
||||||
&& !(curwin->w_closing || curwin->w_buffer->b_locked > 0)
|
&& !(curwin->w_closing || curwin->w_buffer->b_locked > 0)
|
||||||
&& (!ONE_WINDOW || first_tabpage->tp_next != NULL)) {
|
&& (!ONE_WINDOW || first_tabpage->tp_next != NULL)) {
|
||||||
@@ -1275,9 +1251,7 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// If the buffer to be deleted is not the current one, delete it here.
|
||||||
* If the buffer to be deleted is not the current one, delete it here.
|
|
||||||
*/
|
|
||||||
if (buf != curbuf) {
|
if (buf != curbuf) {
|
||||||
close_windows(buf, false);
|
close_windows(buf, false);
|
||||||
if (buf != curbuf && bufref_valid(&bufref) && buf->b_nwindows <= 0) {
|
if (buf != curbuf && bufref_valid(&bufref) && buf->b_nwindows <= 0) {
|
||||||
@@ -1390,9 +1364,7 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
|
|||||||
return empty_curbuf(false, forceit, action);
|
return empty_curbuf(false, forceit, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// make "buf" the current buffer
|
||||||
* 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
|
// If 'switchbuf' contains "useopen": jump to first window containing
|
||||||
// "buf" if one exists
|
// "buf" if one exists
|
||||||
@@ -1414,9 +1386,7 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Check if the current buffer may be abandoned.
|
||||||
* Check if the current buffer may be abandoned.
|
|
||||||
*/
|
|
||||||
if (action == DOBUF_GOTO && !can_abandon(curbuf, forceit)) {
|
if (action == DOBUF_GOTO && !can_abandon(curbuf, forceit)) {
|
||||||
if ((p_confirm || cmdmod.confirm) && p_write) {
|
if ((p_confirm || cmdmod.confirm) && p_write) {
|
||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
@@ -1704,11 +1674,10 @@ buf_T *buflist_new(char_u *ffname_arg, char_u *sfname_arg, linenr_T lnum, int fl
|
|||||||
|
|
||||||
fname_expand(curbuf, &ffname, &sfname); // will allocate ffname
|
fname_expand(curbuf, &ffname, &sfname); // will allocate ffname
|
||||||
|
|
||||||
/*
|
// If the file name already exists in the list, update the entry.
|
||||||
* If file name already exists in the list, update the entry.
|
|
||||||
*/
|
// We can use inode numbers when the file exists. Works better
|
||||||
/* We can use inode numbers when the file exists. Works better
|
// for hard links.
|
||||||
* for hard links. */
|
|
||||||
FileID file_id;
|
FileID file_id;
|
||||||
bool file_id_valid = (sfname != NULL
|
bool file_id_valid = (sfname != NULL
|
||||||
&& os_fileid((char *)sfname, &file_id));
|
&& os_fileid((char *)sfname, &file_id));
|
||||||
@@ -1840,9 +1809,7 @@ buf_T *buflist_new(char_u *ffname_arg, char_u *sfname_arg, linenr_T lnum, int fl
|
|||||||
top_file_num = 1;
|
top_file_num = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Always copy the options from the current buffer.
|
||||||
* Always copy the options from the current buffer.
|
|
||||||
*/
|
|
||||||
buf_copy_options(buf, BCO_ALWAYS);
|
buf_copy_options(buf, BCO_ALWAYS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2319,10 +2286,8 @@ int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options)
|
|||||||
patc = pat;
|
patc = pat;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// attempt == 0: try match with '\<', match at start of word
|
||||||
* attempt == 0: try match with '\<', match at start of word
|
// attempt == 1: try match without '\<', match anywhere
|
||||||
* attempt == 1: try match without '\<', match anywhere
|
|
||||||
*/
|
|
||||||
for (attempt = 0; attempt <= 1; attempt++) {
|
for (attempt = 0; attempt <= 1; attempt++) {
|
||||||
if (attempt > 0 && patc == pat) {
|
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
|
||||||
@@ -2337,10 +2302,8 @@ int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// round == 1: Count the matches.
|
||||||
* round == 1: Count the matches.
|
// round == 2: Build the array to keep the matches.
|
||||||
* round == 2: Build the array to keep the matches.
|
|
||||||
*/
|
|
||||||
for (round = 1; round <= 2; round++) {
|
for (round = 1; round <= 2; round++) {
|
||||||
count = 0;
|
count = 0;
|
||||||
FOR_ALL_BUFFERS(buf) {
|
FOR_ALL_BUFFERS(buf) {
|
||||||
@@ -2830,11 +2793,9 @@ int setfname(buf_T *buf, char_u *ffname_arg, char_u *sfname_arg, bool message)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// If the file name is already used in another buffer:
|
||||||
* if the file name is already used in another buffer:
|
// - if the buffer is loaded, fail
|
||||||
* - if the buffer is loaded, fail
|
// - if the buffer is not loaded, delete it from the list
|
||||||
* - if the buffer is not loaded, delete it from the list
|
|
||||||
*/
|
|
||||||
file_id_valid = os_fileid((char *)ffname, &file_id);
|
file_id_valid = os_fileid((char *)ffname, &file_id);
|
||||||
if (!(buf->b_flags & BF_DUMMY)) {
|
if (!(buf->b_flags & BF_DUMMY)) {
|
||||||
obuf = buflist_findname_file_id(ffname, &file_id, file_id_valid);
|
obuf = buflist_findname_file_id(ffname, &file_id, file_id_valid);
|
||||||
|
Reference in New Issue
Block a user