Convert FOR_ALL_WINDOWS to use a locally declared pointer

This commit is contained in:
Wayne Rowcliffe
2014-08-20 18:35:07 -05:00
parent 3f5482d325
commit fe99930c46
12 changed files with 138 additions and 154 deletions

View File

@@ -500,7 +500,6 @@ void fmarks_check_names(buf_T *buf)
{
char_u *name;
int i;
win_T *wp;
if (buf->b_ffname == NULL)
return;
@@ -512,10 +511,10 @@ void fmarks_check_names(buf_T *buf)
for (i = 0; i < NMARKS + EXTRA_MARKS; ++i)
fmarks_check_one(&namedfm[i], name, buf);
FOR_ALL_WINDOWS(wp)
{
for (i = 0; i < wp->w_jumplistlen; ++i)
FOR_ALL_WINDOWS(wp) {
for (i = 0; i < wp->w_jumplistlen; ++i) {
fmarks_check_one(&wp->w_jumplist[i], name, buf);
}
}
free(name);
@@ -1042,7 +1041,6 @@ void mark_col_adjust(linenr_T lnum, colnr_T mincol, long lnum_amount, long col_a
{
int i;
int fnum = curbuf->b_fnum;
win_T *win;
pos_T *posp;
if ((col_amount == 0L && lnum_amount == 0L) || cmdmod.lockmarks)
@@ -1085,22 +1083,26 @@ void mark_col_adjust(linenr_T lnum, colnr_T mincol, long lnum_amount, long col_a
/*
* Adjust items in all windows related to the current buffer.
*/
FOR_ALL_WINDOWS(win)
{
FOR_ALL_WINDOWS(win) {
/* marks in the jumplist */
for (i = 0; i < win->w_jumplistlen; ++i)
if (win->w_jumplist[i].fmark.fnum == fnum)
for (i = 0; i < win->w_jumplistlen; ++i) {
if (win->w_jumplist[i].fmark.fnum == fnum) {
col_adjust(&(win->w_jumplist[i].fmark.mark));
}
}
if (win->w_buffer == curbuf) {
/* marks in the tag stack */
for (i = 0; i < win->w_tagstacklen; i++)
if (win->w_tagstack[i].fmark.fnum == fnum)
for (i = 0; i < win->w_tagstacklen; i++) {
if (win->w_tagstack[i].fmark.fnum == fnum) {
col_adjust(&(win->w_tagstack[i].fmark.mark));
}
}
/* cursor position for other windows with the same buffer */
if (win != curwin)
if (win != curwin) {
col_adjust(&win->w_cursor);
}
}
}
}
@@ -1526,10 +1528,7 @@ void copy_viminfo_marks(vir_T *virp, FILE *fp_out, int count, int eof, int flags
fputs((char *)line, fp_out);
}
if (load_marks) {
win_T *wp;
FOR_ALL_WINDOWS(wp)
{
FOR_ALL_WINDOWS(wp) {
if (wp->w_buffer == curbuf)
wp->w_changelistidx = curbuf->b_changelistlen;
}