diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2014-08-19 23:49:25 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-08-19 23:49:25 -0400 |
commit | e1c330a486c184152cb48d637c6d04caba5290bd (patch) | |
tree | b2379cae30ea446456681d1dc62d80ef95345f69 /src/nvim/mark.c | |
parent | 0b7bff5bb71ddc2e9c41863ec41b9aea74d0fe75 (diff) | |
parent | 888a31ba454cf9c054527a26459c112593efa54b (diff) | |
download | rneovim-e1c330a486c184152cb48d637c6d04caba5290bd.tar.gz rneovim-e1c330a486c184152cb48d637c6d04caba5290bd.tar.bz2 rneovim-e1c330a486c184152cb48d637c6d04caba5290bd.zip |
Merge pull request #1024 from war1025/dev/for_all_buffers
Add FOR_ALL_BUFFERS helper
Diffstat (limited to 'src/nvim/mark.c')
-rw-r--r-- | src/nvim/mark.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/nvim/mark.c b/src/nvim/mark.c index 90abbb6fbb..43469cab45 100644 --- a/src/nvim/mark.c +++ b/src/nvim/mark.c @@ -1337,7 +1337,6 @@ int removable(char_u *name) int write_viminfo_marks(FILE *fp_out) { int count; - buf_T *buf; int is_mark_set; int i; win_T *win; @@ -1346,12 +1345,13 @@ int write_viminfo_marks(FILE *fp_out) /* * Set b_last_cursor for the all buffers that have a window. */ - FOR_ALL_TAB_WINDOWS(tp, win) - set_last_cursor(win); + FOR_ALL_TAB_WINDOWS(tp, win) { + set_last_cursor(win); + } fputs(_("\n# History of marks within files (newest to oldest):\n"), fp_out); count = 0; - for (buf = firstbuf; buf != NULL; buf = buf->b_next) { + FOR_ALL_BUFFERS(buf) { /* * Only write something if buffer has been loaded and at least one * mark is set. @@ -1467,12 +1467,16 @@ void copy_viminfo_marks(vir_T *virp, FILE *fp_out, int count, int eof, int flags } } else { /* fp_out != NULL */ /* This is slow if there are many buffers!! */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) - if (buf->b_ffname != NULL) { - home_replace(NULL, buf->b_ffname, name_buf, LSIZE, TRUE); - if (fnamecmp(str, name_buf) == 0) + buf = NULL; + FOR_ALL_BUFFERS(bp) { + if (bp->b_ffname != NULL) { + home_replace(NULL, bp->b_ffname, name_buf, LSIZE, TRUE); + if (fnamecmp(str, name_buf) == 0) { + buf = bp; break; + } } + } /* * copy marks if the buffer has not been loaded |