mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
FOR_ALL_BUFFERS use locally declared buffer pointer
This commit is contained in:
parent
8cf45786b1
commit
888a31ba45
@ -115,9 +115,13 @@ open_buffer (
|
|||||||
* 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);
|
||||||
FOR_ALL_BUFFERS(curbuf) {
|
|
||||||
if (curbuf->b_ml.ml_mfp != NULL)
|
curbuf = NULL;
|
||||||
|
FOR_ALL_BUFFERS(buf) {
|
||||||
|
if (buf->b_ml.ml_mfp != NULL) {
|
||||||
|
curbuf = buf;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -262,8 +266,6 @@ open_buffer (
|
|||||||
*/
|
*/
|
||||||
int buf_valid(buf_T *buf)
|
int buf_valid(buf_T *buf)
|
||||||
{
|
{
|
||||||
buf_T *bp;
|
|
||||||
|
|
||||||
FOR_ALL_BUFFERS(bp) {
|
FOR_ALL_BUFFERS(bp) {
|
||||||
if (bp == buf) {
|
if (bp == buf) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -950,8 +952,10 @@ do_buffer (
|
|||||||
* 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) {
|
bp = NULL;
|
||||||
if (bp->b_p_bl && bp != buf) {
|
FOR_ALL_BUFFERS(bp2) {
|
||||||
|
if (bp2->b_p_bl && bp2 != buf) {
|
||||||
|
bp = bp2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1053,8 +1057,9 @@ do_buffer (
|
|||||||
if (buf == NULL) /* No loaded buffer, use unloaded one */
|
if (buf == NULL) /* No loaded buffer, use unloaded one */
|
||||||
buf = bp;
|
buf = bp;
|
||||||
if (buf == NULL) { /* No loaded buffer, find listed one */
|
if (buf == NULL) { /* No loaded buffer, find listed one */
|
||||||
FOR_ALL_BUFFERS(buf) {
|
FOR_ALL_BUFFERS(buf2) {
|
||||||
if (buf->b_p_bl && buf != curbuf) {
|
if (buf2->b_p_bl && buf2 != curbuf) {
|
||||||
|
buf = buf2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1677,8 +1682,6 @@ buf_T *buflist_findname(char_u *ffname)
|
|||||||
static buf_T *buflist_findname_file_id(char_u *ffname, FileID *file_id,
|
static buf_T *buflist_findname_file_id(char_u *ffname, FileID *file_id,
|
||||||
bool file_id_valid)
|
bool file_id_valid)
|
||||||
{
|
{
|
||||||
buf_T *buf;
|
|
||||||
|
|
||||||
FOR_ALL_BUFFERS(buf) {
|
FOR_ALL_BUFFERS(buf) {
|
||||||
if ((buf->b_flags & BF_DUMMY) == 0
|
if ((buf->b_flags & BF_DUMMY) == 0
|
||||||
&& !otherfile_buf(buf, ffname, file_id, file_id_valid)) {
|
&& !otherfile_buf(buf, ffname, file_id, file_id_valid)) {
|
||||||
@ -1702,7 +1705,6 @@ buflist_findpat (
|
|||||||
int curtab_only /* find buffers in current tab only */
|
int curtab_only /* find buffers in current tab only */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
buf_T *buf;
|
|
||||||
regprog_T *prog;
|
regprog_T *prog;
|
||||||
int match = -1;
|
int match = -1;
|
||||||
int find_listed;
|
int find_listed;
|
||||||
@ -1807,7 +1809,6 @@ buflist_findpat (
|
|||||||
int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options)
|
int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
buf_T *buf;
|
|
||||||
int round;
|
int round;
|
||||||
char_u *p;
|
char_u *p;
|
||||||
int attempt;
|
int attempt;
|
||||||
@ -1929,10 +1930,10 @@ static char_u *fname_match(regprog_T *prog, char_u *name)
|
|||||||
*/
|
*/
|
||||||
buf_T *buflist_findnr(int nr)
|
buf_T *buflist_findnr(int nr)
|
||||||
{
|
{
|
||||||
buf_T *buf;
|
if (nr == 0) {
|
||||||
|
|
||||||
if (nr == 0)
|
|
||||||
nr = curwin->w_alt_fnum;
|
nr = curwin->w_alt_fnum;
|
||||||
|
}
|
||||||
|
|
||||||
FOR_ALL_BUFFERS(buf) {
|
FOR_ALL_BUFFERS(buf) {
|
||||||
if (buf->b_fnum == nr) {
|
if (buf->b_fnum == nr) {
|
||||||
return buf;
|
return buf;
|
||||||
@ -2354,8 +2355,6 @@ int buflist_add(char_u *fname, int flags)
|
|||||||
*/
|
*/
|
||||||
void buflist_slash_adjust(void)
|
void buflist_slash_adjust(void)
|
||||||
{
|
{
|
||||||
buf_T *bp;
|
|
||||||
|
|
||||||
FOR_ALL_BUFFERS(bp) {
|
FOR_ALL_BUFFERS(bp) {
|
||||||
if (bp->b_ffname != NULL)
|
if (bp->b_ffname != NULL)
|
||||||
slash_adjust(bp->b_ffname);
|
slash_adjust(bp->b_ffname);
|
||||||
@ -4202,7 +4201,6 @@ int read_viminfo_bufferlist(vir_T *virp, int writing)
|
|||||||
|
|
||||||
void write_viminfo_bufferlist(FILE *fp)
|
void write_viminfo_bufferlist(FILE *fp)
|
||||||
{
|
{
|
||||||
buf_T *buf;
|
|
||||||
win_T *win;
|
win_T *win;
|
||||||
tabpage_T *tp;
|
tabpage_T *tp;
|
||||||
char_u *line;
|
char_u *line;
|
||||||
@ -4498,13 +4496,11 @@ void buf_delete_signs(buf_T *buf)
|
|||||||
*/
|
*/
|
||||||
void buf_delete_all_signs(void)
|
void buf_delete_all_signs(void)
|
||||||
{
|
{
|
||||||
buf_T *buf; /* buffer we are checking for signs */
|
FOR_ALL_BUFFERS(buf) {
|
||||||
|
if (buf->b_signlist != NULL) {
|
||||||
FOR_ALL_BUFFERS(buf) {
|
buf_delete_signs(buf);
|
||||||
if (buf->b_signlist != NULL) {
|
|
||||||
buf_delete_signs(buf);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3434,8 +3434,8 @@ static int ins_compl_get_exp(pos_T *ini)
|
|||||||
int set_match_pos;
|
int set_match_pos;
|
||||||
|
|
||||||
if (!compl_started) {
|
if (!compl_started) {
|
||||||
FOR_ALL_BUFFERS(ins_buf) {
|
FOR_ALL_BUFFERS(buf) {
|
||||||
ins_buf->b_scanned = 0;
|
buf->b_scanned = 0;
|
||||||
}
|
}
|
||||||
found_all = FALSE;
|
found_all = FALSE;
|
||||||
ins_buf = curbuf;
|
ins_buf = curbuf;
|
||||||
|
@ -5399,7 +5399,6 @@ static int list_join(garray_T *gap, list_T *l, char_u *sep, int echo_style, int
|
|||||||
int garbage_collect(void)
|
int garbage_collect(void)
|
||||||
{
|
{
|
||||||
int copyID;
|
int copyID;
|
||||||
buf_T *buf;
|
|
||||||
win_T *wp;
|
win_T *wp;
|
||||||
funccall_T *fc, **pfc;
|
funccall_T *fc, **pfc;
|
||||||
int did_free;
|
int did_free;
|
||||||
@ -7208,13 +7207,15 @@ static buf_T *find_buffer(typval_T *avar)
|
|||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
/* No full path name match, try a match with a URL or a "nofile"
|
/* No full path name match, try a match with a URL or a "nofile"
|
||||||
* buffer, these don't use the full path. */
|
* buffer, these don't use the full path. */
|
||||||
FOR_ALL_BUFFERS(buf) {
|
FOR_ALL_BUFFERS(bp) {
|
||||||
if (buf->b_fname != NULL
|
if (bp->b_fname != NULL
|
||||||
&& (path_with_url(buf->b_fname)
|
&& (path_with_url(bp->b_fname)
|
||||||
|| bt_nofile(buf)
|
|| bt_nofile(bp)
|
||||||
)
|
)
|
||||||
&& STRCMP(buf->b_fname, avar->vval.v_string) == 0)
|
&& STRCMP(bp->b_fname, avar->vval.v_string) == 0) {
|
||||||
|
buf = bp;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10617,7 +10618,6 @@ static void f_keys(typval_T *argvars, typval_T *rettv)
|
|||||||
static void f_last_buffer_nr(typval_T *argvars, typval_T *rettv)
|
static void f_last_buffer_nr(typval_T *argvars, typval_T *rettv)
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
buf_T *buf;
|
|
||||||
|
|
||||||
FOR_ALL_BUFFERS(buf) {
|
FOR_ALL_BUFFERS(buf) {
|
||||||
if (n < buf->b_fnum) {
|
if (n < buf->b_fnum) {
|
||||||
|
@ -1211,7 +1211,6 @@ do_shell (
|
|||||||
int flags /* may be SHELL_DOOUT when output is redirected */
|
int flags /* may be SHELL_DOOUT when output is redirected */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
buf_T *buf;
|
|
||||||
int save_nwr;
|
int save_nwr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1748,7 +1747,6 @@ static void do_viminfo(FILE *fp_in, FILE *fp_out, int flags)
|
|||||||
static int read_viminfo_up_to_marks(vir_T *virp, int forceit, int writing)
|
static int read_viminfo_up_to_marks(vir_T *virp, int forceit, int writing)
|
||||||
{
|
{
|
||||||
int eof;
|
int eof;
|
||||||
buf_T *buf;
|
|
||||||
|
|
||||||
prepare_viminfo_history(forceit ? 9999 : 0, writing);
|
prepare_viminfo_history(forceit ? 9999 : 0, writing);
|
||||||
eof = viminfo_readline(virp);
|
eof = viminfo_readline(virp);
|
||||||
@ -2358,7 +2356,6 @@ void ex_wnext(exarg_T *eap)
|
|||||||
*/
|
*/
|
||||||
void do_wqall(exarg_T *eap)
|
void do_wqall(exarg_T *eap)
|
||||||
{
|
{
|
||||||
buf_T *buf;
|
|
||||||
int error = 0;
|
int error = 0;
|
||||||
int save_forceit = eap->forceit;
|
int save_forceit = eap->forceit;
|
||||||
|
|
||||||
@ -5675,7 +5672,6 @@ void ex_sign(exarg_T *eap)
|
|||||||
int idx;
|
int idx;
|
||||||
sign_T *sp;
|
sign_T *sp;
|
||||||
sign_T *sp_prev;
|
sign_T *sp_prev;
|
||||||
buf_T *buf;
|
|
||||||
|
|
||||||
/* Parse the subcommand. */
|
/* Parse the subcommand. */
|
||||||
p = skiptowhite(arg);
|
p = skiptowhite(arg);
|
||||||
@ -5915,6 +5911,8 @@ void ex_sign(exarg_T *eap)
|
|||||||
* Check for line={lnum} name={name} and file={fname} or buffer={nr}.
|
* Check for line={lnum} name={name} and file={fname} or buffer={nr}.
|
||||||
* Leave "arg" pointing to {fname}.
|
* Leave "arg" pointing to {fname}.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
buf_T *buf = NULL;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (STRNCMP(arg, "line=", 5) == 0)
|
if (STRNCMP(arg, "line=", 5) == 0)
|
||||||
|
@ -1044,10 +1044,10 @@ int autowrite(buf_T *buf, int forceit)
|
|||||||
*/
|
*/
|
||||||
void autowrite_all(void)
|
void autowrite_all(void)
|
||||||
{
|
{
|
||||||
buf_T *buf;
|
if (!(p_aw || p_awa) || !p_write) {
|
||||||
|
|
||||||
if (!(p_aw || p_awa) || !p_write)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FOR_ALL_BUFFERS(buf) {
|
FOR_ALL_BUFFERS(buf) {
|
||||||
if (bufIsChanged(buf) && !buf->b_p_ro) {
|
if (bufIsChanged(buf) && !buf->b_p_ro) {
|
||||||
(void)buf_write_all(buf, FALSE);
|
(void)buf_write_all(buf, FALSE);
|
||||||
@ -1071,7 +1071,6 @@ int check_changed(buf_T *buf, int flags)
|
|||||||
&& ((flags & CCGD_MULTWIN) || buf->b_nwindows <= 1)
|
&& ((flags & CCGD_MULTWIN) || buf->b_nwindows <= 1)
|
||||||
&& (!(flags & CCGD_AW) || autowrite(buf, forceit) == FAIL)) {
|
&& (!(flags & CCGD_AW) || autowrite(buf, forceit) == FAIL)) {
|
||||||
if ((p_confirm || cmdmod.confirm) && p_write) {
|
if ((p_confirm || cmdmod.confirm) && p_write) {
|
||||||
buf_T *buf2;
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
if (flags & CCGD_ALLBUF)
|
if (flags & CCGD_ALLBUF)
|
||||||
@ -1112,7 +1111,6 @@ dialog_changed (
|
|||||||
{
|
{
|
||||||
char_u buff[DIALOG_MSG_SIZE];
|
char_u buff[DIALOG_MSG_SIZE];
|
||||||
int ret;
|
int ret;
|
||||||
buf_T *buf2;
|
|
||||||
exarg_T ea;
|
exarg_T ea;
|
||||||
|
|
||||||
dialog_msg(buff, _("Save changes to \"%s\"?"),
|
dialog_msg(buff, _("Save changes to \"%s\"?"),
|
||||||
@ -1202,7 +1200,6 @@ check_changed_any (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
int ret = FALSE;
|
int ret = FALSE;
|
||||||
buf_T *buf;
|
|
||||||
int save;
|
int save;
|
||||||
int i;
|
int i;
|
||||||
int bufnum = 0;
|
int bufnum = 0;
|
||||||
@ -1237,6 +1234,7 @@ check_changed_any (
|
|||||||
add_bufnum(bufnrs, &bufnum, buf->b_fnum);
|
add_bufnum(bufnrs, &bufnum, buf->b_fnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buf_T *buf = NULL;
|
||||||
for (i = 0; i < bufnum; ++i) {
|
for (i = 0; i < bufnum; ++i) {
|
||||||
buf = buflist_findnr(bufnrs[i]);
|
buf = buflist_findnr(bufnrs[i]);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
@ -1821,7 +1819,6 @@ void ex_listdo(exarg_T *eap)
|
|||||||
int i;
|
int i;
|
||||||
win_T *wp;
|
win_T *wp;
|
||||||
tabpage_T *tp;
|
tabpage_T *tp;
|
||||||
buf_T *buf;
|
|
||||||
int next_fnum = 0;
|
int next_fnum = 0;
|
||||||
char_u *save_ei = NULL;
|
char_u *save_ei = NULL;
|
||||||
char_u *p_shm_save;
|
char_u *p_shm_save;
|
||||||
@ -1886,7 +1883,7 @@ void ex_listdo(exarg_T *eap)
|
|||||||
/* Remember the number of the next listed buffer, in case
|
/* Remember the number of the next listed buffer, in case
|
||||||
* ":bwipe" is used or autocommands do something strange. */
|
* ":bwipe" is used or autocommands do something strange. */
|
||||||
next_fnum = -1;
|
next_fnum = -1;
|
||||||
for (buf = curbuf->b_next; buf != NULL; buf = buf->b_next)
|
for (buf_T *buf = curbuf->b_next; buf != NULL; buf = buf->b_next)
|
||||||
if (buf->b_p_bl) {
|
if (buf->b_p_bl) {
|
||||||
next_fnum = buf->b_fnum;
|
next_fnum = buf->b_fnum;
|
||||||
break;
|
break;
|
||||||
@ -1901,14 +1898,18 @@ void ex_listdo(exarg_T *eap)
|
|||||||
/* Done? */
|
/* Done? */
|
||||||
if (next_fnum < 0)
|
if (next_fnum < 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Check if the buffer still exists. */
|
/* Check if the buffer still exists. */
|
||||||
FOR_ALL_BUFFERS(buf) {
|
bool buf_still_exists = false;
|
||||||
if (buf->b_fnum == next_fnum) {
|
FOR_ALL_BUFFERS(bp) {
|
||||||
|
if (bp->b_fnum == next_fnum) {
|
||||||
|
buf_still_exists = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (buf == NULL)
|
if (buf_still_exists) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Go to the next buffer. Clear 'shm' to avoid that the file
|
/* Go to the next buffer. Clear 'shm' to avoid that the file
|
||||||
* message overwrites any output from the command. */
|
* message overwrites any output from the command. */
|
||||||
|
@ -7871,7 +7871,6 @@ makeopens (
|
|||||||
char_u *dirnow /* Current directory name */
|
char_u *dirnow /* Current directory name */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
buf_T *buf;
|
|
||||||
int only_save_windows = TRUE;
|
int only_save_windows = TRUE;
|
||||||
int nr;
|
int nr;
|
||||||
int cnr = 1;
|
int cnr = 1;
|
||||||
|
@ -4359,7 +4359,6 @@ static int make_bom(char_u *buf, char_u *name)
|
|||||||
void shorten_fnames(int force)
|
void shorten_fnames(int force)
|
||||||
{
|
{
|
||||||
char_u dirname[MAXPATHL];
|
char_u dirname[MAXPATHL];
|
||||||
buf_T *buf;
|
|
||||||
char_u *p;
|
char_u *p;
|
||||||
|
|
||||||
os_dirname(dirname, MAXPATHL);
|
os_dirname(dirname, MAXPATHL);
|
||||||
@ -6123,7 +6122,6 @@ void ex_doautoall(exarg_T *eap)
|
|||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
aco_save_T aco;
|
aco_save_T aco;
|
||||||
buf_T *buf;
|
|
||||||
char_u *arg = eap->arg;
|
char_u *arg = eap->arg;
|
||||||
int call_do_modelines = check_nomodeline(&arg);
|
int call_do_modelines = check_nomodeline(&arg);
|
||||||
|
|
||||||
|
@ -557,7 +557,7 @@ EXTERN buf_T *lastbuf INIT(= NULL); /* last buffer */
|
|||||||
EXTERN buf_T *curbuf INIT(= NULL); /* currently active buffer */
|
EXTERN buf_T *curbuf INIT(= NULL); /* currently active buffer */
|
||||||
|
|
||||||
// Iterates over all buffers in the buffer list.
|
// Iterates over all buffers in the buffer list.
|
||||||
# define FOR_ALL_BUFFERS(buf) for (buf = firstbuf; buf != NULL; buf = buf->b_next)
|
# define FOR_ALL_BUFFERS(buf) for (buf_T *buf = firstbuf; buf != NULL; buf = buf->b_next)
|
||||||
|
|
||||||
/* Flag that is set when switching off 'swapfile'. It means that all blocks
|
/* Flag that is set when switching off 'swapfile'. It means that all blocks
|
||||||
* are to be loaded into memory. Shouldn't be global... */
|
* are to be loaded into memory. Shouldn't be global... */
|
||||||
|
@ -744,7 +744,6 @@ main_loop (
|
|||||||
/* Exit properly */
|
/* Exit properly */
|
||||||
void getout(int exitval)
|
void getout(int exitval)
|
||||||
{
|
{
|
||||||
buf_T *buf;
|
|
||||||
win_T *wp;
|
win_T *wp;
|
||||||
tabpage_T *tp, *next_tp;
|
tabpage_T *tp, *next_tp;
|
||||||
|
|
||||||
@ -772,7 +771,7 @@ void getout(int exitval)
|
|||||||
if (wp->w_buffer == NULL)
|
if (wp->w_buffer == NULL)
|
||||||
/* Autocmd must have close the buffer already, skip. */
|
/* Autocmd must have close the buffer already, skip. */
|
||||||
continue;
|
continue;
|
||||||
buf = wp->w_buffer;
|
buf_T *buf = wp->w_buffer;
|
||||||
if (buf->b_changedtick != -1) {
|
if (buf->b_changedtick != -1) {
|
||||||
apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname,
|
apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname,
|
||||||
buf->b_fname, FALSE, buf);
|
buf->b_fname, FALSE, buf);
|
||||||
|
@ -1337,7 +1337,6 @@ int removable(char_u *name)
|
|||||||
int write_viminfo_marks(FILE *fp_out)
|
int write_viminfo_marks(FILE *fp_out)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
buf_T *buf;
|
|
||||||
int is_mark_set;
|
int is_mark_set;
|
||||||
int i;
|
int i;
|
||||||
win_T *win;
|
win_T *win;
|
||||||
@ -1346,8 +1345,9 @@ int write_viminfo_marks(FILE *fp_out)
|
|||||||
/*
|
/*
|
||||||
* Set b_last_cursor for the all buffers that have a window.
|
* Set b_last_cursor for the all buffers that have a window.
|
||||||
*/
|
*/
|
||||||
FOR_ALL_TAB_WINDOWS(tp, win)
|
FOR_ALL_TAB_WINDOWS(tp, win) {
|
||||||
set_last_cursor(win);
|
set_last_cursor(win);
|
||||||
|
}
|
||||||
|
|
||||||
fputs(_("\n# History of marks within files (newest to oldest):\n"), fp_out);
|
fputs(_("\n# History of marks within files (newest to oldest):\n"), fp_out);
|
||||||
count = 0;
|
count = 0;
|
||||||
@ -1467,11 +1467,14 @@ void copy_viminfo_marks(vir_T *virp, FILE *fp_out, int count, int eof, int flags
|
|||||||
}
|
}
|
||||||
} else { /* fp_out != NULL */
|
} else { /* fp_out != NULL */
|
||||||
/* This is slow if there are many buffers!! */
|
/* This is slow if there are many buffers!! */
|
||||||
FOR_ALL_BUFFERS(buf) {
|
buf = NULL;
|
||||||
if (buf->b_ffname != NULL) {
|
FOR_ALL_BUFFERS(bp) {
|
||||||
home_replace(NULL, buf->b_ffname, name_buf, LSIZE, TRUE);
|
if (bp->b_ffname != NULL) {
|
||||||
if (fnamecmp(str, name_buf) == 0)
|
home_replace(NULL, bp->b_ffname, name_buf, LSIZE, TRUE);
|
||||||
|
if (fnamecmp(str, name_buf) == 0) {
|
||||||
|
buf = bp;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,7 +613,6 @@ static bhdr_T *mf_release(memfile_T *mfp, int page_count)
|
|||||||
{
|
{
|
||||||
bhdr_T *hp;
|
bhdr_T *hp;
|
||||||
int need_release;
|
int need_release;
|
||||||
buf_T *buf;
|
|
||||||
|
|
||||||
/* don't release while in mf_close_file() */
|
/* don't release while in mf_close_file() */
|
||||||
if (mf_dont_release)
|
if (mf_dont_release)
|
||||||
@ -632,13 +631,16 @@ static bhdr_T *mf_release(memfile_T *mfp, int page_count)
|
|||||||
*/
|
*/
|
||||||
if (mfp->mf_fd < 0 && need_release && p_uc) {
|
if (mfp->mf_fd < 0 && need_release && p_uc) {
|
||||||
/* find for which buffer this memfile is */
|
/* find for which buffer this memfile is */
|
||||||
FOR_ALL_BUFFERS(buf) {
|
buf_T *buf = NULL;
|
||||||
if (buf->b_ml.ml_mfp == mfp) {
|
FOR_ALL_BUFFERS(bp) {
|
||||||
|
if (bp->b_ml.ml_mfp == mfp) {
|
||||||
|
buf = bp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (buf != NULL && buf->b_may_swap)
|
if (buf != NULL && buf->b_may_swap) {
|
||||||
ml_open_file(buf);
|
ml_open_file(buf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -688,7 +690,6 @@ static bhdr_T *mf_release(memfile_T *mfp, int page_count)
|
|||||||
*/
|
*/
|
||||||
int mf_release_all(void)
|
int mf_release_all(void)
|
||||||
{
|
{
|
||||||
buf_T *buf;
|
|
||||||
memfile_T *mfp;
|
memfile_T *mfp;
|
||||||
bhdr_T *hp;
|
bhdr_T *hp;
|
||||||
int retval = FALSE;
|
int retval = FALSE;
|
||||||
|
@ -466,8 +466,6 @@ void ml_setname(buf_T *buf)
|
|||||||
*/
|
*/
|
||||||
void ml_open_files(void)
|
void ml_open_files(void)
|
||||||
{
|
{
|
||||||
buf_T *buf;
|
|
||||||
|
|
||||||
FOR_ALL_BUFFERS(buf) {
|
FOR_ALL_BUFFERS(buf) {
|
||||||
if (!buf->b_p_ro || buf->b_changed) {
|
if (!buf->b_p_ro || buf->b_changed) {
|
||||||
ml_open_file(buf);
|
ml_open_file(buf);
|
||||||
@ -586,8 +584,6 @@ void ml_close(buf_T *buf, int del_file)
|
|||||||
*/
|
*/
|
||||||
void ml_close_all(int del_file)
|
void ml_close_all(int del_file)
|
||||||
{
|
{
|
||||||
buf_T *buf;
|
|
||||||
|
|
||||||
FOR_ALL_BUFFERS(buf) {
|
FOR_ALL_BUFFERS(buf) {
|
||||||
ml_close(buf, del_file && ((buf->b_flags & BF_PRESERVED) == 0
|
ml_close(buf, del_file && ((buf->b_flags & BF_PRESERVED) == 0
|
||||||
|| vim_strchr(p_cpo, CPO_PRESERVE) == NULL));
|
|| vim_strchr(p_cpo, CPO_PRESERVE) == NULL));
|
||||||
@ -602,8 +598,6 @@ void ml_close_all(int del_file)
|
|||||||
*/
|
*/
|
||||||
void ml_close_notmod(void)
|
void ml_close_notmod(void)
|
||||||
{
|
{
|
||||||
buf_T *buf;
|
|
||||||
|
|
||||||
FOR_ALL_BUFFERS(buf) {
|
FOR_ALL_BUFFERS(buf) {
|
||||||
if (!bufIsChanged(buf)) {
|
if (!bufIsChanged(buf)) {
|
||||||
ml_close(buf, TRUE); /* close all not-modified buffers */
|
ml_close(buf, TRUE); /* close all not-modified buffers */
|
||||||
@ -1622,8 +1616,6 @@ static int recov_file_names(char_u **names, char_u *path, int prepend_dot)
|
|||||||
*/
|
*/
|
||||||
void ml_sync_all(int check_file, int check_char)
|
void ml_sync_all(int check_file, int check_char)
|
||||||
{
|
{
|
||||||
buf_T *buf;
|
|
||||||
|
|
||||||
FOR_ALL_BUFFERS(buf) {
|
FOR_ALL_BUFFERS(buf) {
|
||||||
if (buf->b_ml.ml_mfp == NULL || buf->b_ml.ml_mfp->mf_fname == NULL)
|
if (buf->b_ml.ml_mfp == NULL || buf->b_ml.ml_mfp->mf_fname == NULL)
|
||||||
continue; /* no file */
|
continue; /* no file */
|
||||||
|
@ -3329,8 +3329,6 @@ void prepare_to_exit(void)
|
|||||||
*/
|
*/
|
||||||
void preserve_exit(void)
|
void preserve_exit(void)
|
||||||
{
|
{
|
||||||
buf_T *buf;
|
|
||||||
|
|
||||||
// Prevent repeated calls into this method.
|
// Prevent repeated calls into this method.
|
||||||
if (really_exiting) {
|
if (really_exiting) {
|
||||||
exit(2);
|
exit(2);
|
||||||
|
@ -4977,7 +4977,7 @@ set_bool_option (
|
|||||||
char_u hash[UNDO_HASH_SIZE];
|
char_u hash[UNDO_HASH_SIZE];
|
||||||
buf_T *save_curbuf = curbuf;
|
buf_T *save_curbuf = curbuf;
|
||||||
|
|
||||||
FOR_ALL_BUFFERS(curbuf) {
|
for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next) {
|
||||||
/* When 'undofile' is set globally: for every buffer, otherwise
|
/* When 'undofile' is set globally: for every buffer, otherwise
|
||||||
* only for the current buffer: Try to read in the undofile,
|
* only for the current buffer: Try to read in the undofile,
|
||||||
* if one exists, the buffer wasn't changed and the buffer was
|
* if one exists, the buffer wasn't changed and the buffer was
|
||||||
@ -7694,7 +7694,6 @@ static void paste_option_changed(void)
|
|||||||
static int save_ru = 0;
|
static int save_ru = 0;
|
||||||
static int save_ri = 0;
|
static int save_ri = 0;
|
||||||
static int save_hkmap = 0;
|
static int save_hkmap = 0;
|
||||||
buf_T *buf;
|
|
||||||
|
|
||||||
if (p_paste) {
|
if (p_paste) {
|
||||||
/*
|
/*
|
||||||
|
@ -4139,7 +4139,6 @@ void spell_delete_wordlist(void)
|
|||||||
void spell_free_all(void)
|
void spell_free_all(void)
|
||||||
{
|
{
|
||||||
slang_T *slang;
|
slang_T *slang;
|
||||||
buf_T *buf;
|
|
||||||
|
|
||||||
// Go through all buffers and handle 'spelllang'. <VN>
|
// Go through all buffers and handle 'spelllang'. <VN>
|
||||||
FOR_ALL_BUFFERS(buf) {
|
FOR_ALL_BUFFERS(buf) {
|
||||||
|
@ -1608,7 +1608,7 @@ int set_termname(char_u *term)
|
|||||||
* loaded.
|
* loaded.
|
||||||
*/
|
*/
|
||||||
buf_T *old_curbuf = curbuf;
|
buf_T *old_curbuf = curbuf;
|
||||||
FOR_ALL_BUFFERS(curbuf) {
|
for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next) {
|
||||||
if (curbuf->b_ml.ml_mfp != NULL)
|
if (curbuf->b_ml.ml_mfp != NULL)
|
||||||
apply_autocmds(EVENT_TERMCHANGED, NULL, NULL, FALSE,
|
apply_autocmds(EVENT_TERMCHANGED, NULL, NULL, FALSE,
|
||||||
curbuf);
|
curbuf);
|
||||||
|
@ -3571,7 +3571,6 @@ win_free (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
buf_T *buf;
|
|
||||||
wininfo_T *wip;
|
wininfo_T *wip;
|
||||||
|
|
||||||
handle_unregister_window(wp);
|
handle_unregister_window(wp);
|
||||||
@ -3584,13 +3583,6 @@ win_free (
|
|||||||
* gui_mch_destroy_scrollbar() may trigger a FocusGained event. */
|
* gui_mch_destroy_scrollbar() may trigger a FocusGained event. */
|
||||||
block_autocmds();
|
block_autocmds();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
clear_winopt(&wp->w_onebuf_opt);
|
clear_winopt(&wp->w_onebuf_opt);
|
||||||
clear_winopt(&wp->w_allbuf_opt);
|
clear_winopt(&wp->w_allbuf_opt);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user