mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.3542: too many comments are old style
Problem: Too many comments are old style. Solution: Change comments to // style. (closes #9021)
This commit is contained in:
parent
731fba1081
commit
c5935a859e
163
src/buffer.c
163
src/buffer.c
@ -94,11 +94,9 @@ read_buffer(
|
|||||||
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(
|
retval = readfile(
|
||||||
read_stdin ? NULL : curbuf->b_ffname,
|
read_stdin ? NULL : curbuf->b_ffname,
|
||||||
@ -178,29 +176,23 @@ open_buffer(
|
|||||||
#endif
|
#endif
|
||||||
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, FALSE);
|
close_buffer(NULL, curbuf, 0, FALSE, FALSE);
|
||||||
FOR_ALL_BUFFERS(curbuf)
|
FOR_ALL_BUFFERS(curbuf)
|
||||||
if (curbuf->b_ml.ml_mfp != NULL)
|
if (curbuf->b_ml.ml_mfp != NULL)
|
||||||
break;
|
break;
|
||||||
/*
|
// If there is no memfile at all, exit.
|
||||||
* If there is no memfile at all, exit.
|
// This is OK, since there are no changes to lose.
|
||||||
* This is OK, since there are no changes to lose.
|
|
||||||
*/
|
|
||||||
if (curbuf == NULL)
|
if (curbuf == NULL)
|
||||||
{
|
{
|
||||||
emsg(_("E82: Cannot allocate any buffer, exiting..."));
|
emsg(_("E82: Cannot allocate any buffer, exiting..."));
|
||||||
@ -281,12 +273,10 @@ open_buffer(
|
|||||||
{
|
{
|
||||||
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,
|
||||||
@ -305,11 +295,10 @@ open_buffer(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Set/reset the Changed flag first, autocmds may change the buffer.
|
||||||
* Set/reset the Changed flag first, autocmds may change the buffer.
|
// Apply the automatic commands, before processing the modelines.
|
||||||
* Apply the automatic commands, before processing the modelines.
|
// So the modelines have priority over autocommands.
|
||||||
* So the modelines have priority over autocommands.
|
//
|
||||||
*/
|
|
||||||
// When reading stdin, the buffer contents always needs writing, so set
|
// When reading stdin, the buffer contents always needs writing, so set
|
||||||
// the changed flag. Unless in readonly mode: "ls | gview -".
|
// the changed flag. Unless in readonly mode: "ls | gview -".
|
||||||
// When interrupted and 'cpoptions' contains 'i' set changed flag.
|
// When interrupted and 'cpoptions' contains 'i' set changed flag.
|
||||||
@ -360,10 +349,8 @@ open_buffer(
|
|||||||
|
|
||||||
if (retval == OK)
|
if (retval == OK)
|
||||||
{
|
{
|
||||||
/*
|
// 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;
|
||||||
@ -521,11 +508,10 @@ close_buffer(
|
|||||||
int del_buf = (action == DOBUF_DEL || wipe_buf);
|
int del_buf = (action == DOBUF_DEL || wipe_buf);
|
||||||
|
|
||||||
CHECK_CURBUF;
|
CHECK_CURBUF;
|
||||||
/*
|
|
||||||
* Force unloading or deleting when 'bufhidden' says so.
|
// Force unloading or deleting when 'bufhidden' says so.
|
||||||
* The caller must take care of NOT deleting/freeing when 'bufhidden' is
|
// The caller must take care of NOT deleting/freeing when 'bufhidden' is
|
||||||
* "hide" (otherwise we could never free or delete a buffer).
|
// "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;
|
del_buf = TRUE;
|
||||||
@ -681,10 +667,9 @@ aucmd_abort:
|
|||||||
)
|
)
|
||||||
end_visual_mode();
|
end_visual_mode();
|
||||||
|
|
||||||
/*
|
// Free all things allocated for this buffer.
|
||||||
* Free all things allocated for this buffer.
|
// Also calls the "BufDelete" autocommands when del_buf is TRUE.
|
||||||
* Also calls the "BufDelete" autocommands when del_buf is TRUE.
|
//
|
||||||
*/
|
|
||||||
// Remember if we are closing the current buffer. Restore the number of
|
// Remember if we are closing the current buffer. Restore the number of
|
||||||
// windows, so that autocommands in buf_freeall() don't get confused.
|
// windows, so that autocommands in buf_freeall() don't get confused.
|
||||||
is_curbuf = (buf == curbuf);
|
is_curbuf = (buf == curbuf);
|
||||||
@ -703,13 +688,11 @@ aucmd_abort:
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
// 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;
|
||||||
|
|
||||||
@ -856,12 +839,10 @@ buf_freeall(buf_T *buf, int flags)
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
// 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;
|
||||||
#ifdef FEAT_DIFF
|
#ifdef FEAT_DIFF
|
||||||
@ -1215,11 +1196,9 @@ empty_curbuf(
|
|||||||
retval = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE,
|
retval = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE,
|
||||||
forceit ? ECMD_FORCEIT : 0, curwin);
|
forceit ? ECMD_FORCEIT : 0, curwin);
|
||||||
|
|
||||||
/*
|
// do_ecmd() may create a new buffer, then we have to delete
|
||||||
* do_ecmd() may create a new buffer, then we have to delete
|
// the old one. But do_ecmd() may have done that already, check
|
||||||
* the old one. But do_ecmd() may have done that already, check
|
// if the buffer still exists.
|
||||||
* if the buffer still exists.
|
|
||||||
*/
|
|
||||||
if (buf != curbuf && bufref_valid(&bufref) && buf->b_nwindows == 0)
|
if (buf != curbuf && bufref_valid(&bufref) && buf->b_nwindows == 0)
|
||||||
close_buffer(NULL, buf, action, FALSE, FALSE);
|
close_buffer(NULL, buf, action, FALSE, FALSE);
|
||||||
if (!close_others)
|
if (!close_others)
|
||||||
@ -1350,7 +1329,7 @@ do_buffer_ext(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* delete buffer buf from memory and/or the list
|
* delete buffer "buf" from memory and/or the list
|
||||||
*/
|
*/
|
||||||
if (unload)
|
if (unload)
|
||||||
{
|
{
|
||||||
@ -1396,21 +1375,17 @@ do_buffer_ext(
|
|||||||
if (buf == curbuf && VIsual_active)
|
if (buf == curbuf && VIsual_active)
|
||||||
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.
|
|
||||||
*/
|
|
||||||
FOR_ALL_BUFFERS(bp)
|
FOR_ALL_BUFFERS(bp)
|
||||||
if (bp->b_p_bl && bp != buf)
|
if (bp->b_p_bl && bp != buf)
|
||||||
break;
|
break;
|
||||||
if (bp == NULL && buf == curbuf)
|
if (bp == NULL && buf == curbuf)
|
||||||
return empty_curbuf(TRUE, (flags & DOBUF_FORCEIT), action);
|
return empty_curbuf(TRUE, (flags & DOBUF_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))
|
||||||
@ -1419,9 +1394,7 @@ do_buffer_ext(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// 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);
|
||||||
@ -1535,7 +1508,7 @@ do_buffer_ext(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* make buf current buffer
|
* make "buf" the current buffer
|
||||||
*/
|
*/
|
||||||
if (action == DOBUF_SPLIT) // split window first
|
if (action == DOBUF_SPLIT) // split window first
|
||||||
{
|
{
|
||||||
@ -1555,9 +1528,7 @@ do_buffer_ext(
|
|||||||
if (buf == curbuf)
|
if (buf == curbuf)
|
||||||
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, (flags & DOBUF_FORCEIT)))
|
if (action == DOBUF_GOTO && !can_abandon(curbuf, (flags & DOBUF_FORCEIT)))
|
||||||
{
|
{
|
||||||
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
|
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
|
||||||
@ -1650,21 +1621,17 @@ do_bufdel(
|
|||||||
|
|
||||||
for ( ;!got_int; ui_breakcheck())
|
for ( ;!got_int; ui_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_ext(command, DOBUF_FIRST, FORWARD, (int)bnr,
|
else if (do_buffer_ext(command, DOBUF_FIRST, FORWARD, (int)bnr,
|
||||||
DOBUF_NOPOPUP | (forceit ? DOBUF_FORCEIT : 0)) == OK)
|
DOBUF_NOPOPUP | (forceit ? DOBUF_FORCEIT : 0)) == OK)
|
||||||
++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)
|
||||||
@ -2011,7 +1978,7 @@ buflist_new(
|
|||||||
fname_expand(curbuf, &ffname, &sfname); // will allocate ffname
|
fname_expand(curbuf, &ffname, &sfname); // will allocate ffname
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If file name already exists in the list, update the entry.
|
* If the file name already exists in the list, update the entry.
|
||||||
*/
|
*/
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
// On Unix we can use inode numbers when the file exists. Works better
|
// On Unix we can use inode numbers when the file exists. Works better
|
||||||
@ -2152,9 +2119,7 @@ buflist_new(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
// put the new buffer at the end of the buffer list
|
||||||
* put new buffer at the end of the buffer list
|
|
||||||
*/
|
|
||||||
buf->b_next = NULL;
|
buf->b_next = NULL;
|
||||||
if (firstbuf == NULL) // buffer list is empty
|
if (firstbuf == NULL) // buffer list is empty
|
||||||
{
|
{
|
||||||
@ -2209,9 +2174,7 @@ buflist_new(
|
|||||||
}
|
}
|
||||||
buf_hashtab_add(buf);
|
buf_hashtab_add(buf);
|
||||||
|
|
||||||
/*
|
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2759,10 +2722,8 @@ ExpandBufnames(
|
|||||||
else
|
else
|
||||||
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)
|
||||||
{
|
{
|
||||||
regmatch_T regmatch;
|
regmatch_T regmatch;
|
||||||
@ -2777,10 +2738,8 @@ ExpandBufnames(
|
|||||||
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;
|
||||||
@ -3383,7 +3342,7 @@ setfname(
|
|||||||
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
|
||||||
*/
|
*/
|
||||||
|
@ -757,6 +757,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3542,
|
||||||
/**/
|
/**/
|
||||||
3541,
|
3541,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user