Mercurial > vim
comparison src/buffer.c @ 19888:435726a03481 v8.2.0500
patch 8.2.0500: using the same loop in many places
Commit: https://github.com/vim/vim/commit/aeea72151c31d686bcbb7b06d895006d7363585c
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Apr 2 18:50:46 2020 +0200
patch 8.2.0500: using the same loop in many places
Problem: Using the same loop in many places.
Solution: Define more FOR_ALL macros. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5339)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 02 Apr 2020 19:00:05 +0200 |
parents | f37028184d6a |
children | 3ff714d765ba |
comparison
equal
deleted
inserted
replaced
19887:d03edd8c7e2f | 19888:435726a03481 |
---|---|
2909 colnr_T col, | 2909 colnr_T col, |
2910 int copy_options) | 2910 int copy_options) |
2911 { | 2911 { |
2912 wininfo_T *wip; | 2912 wininfo_T *wip; |
2913 | 2913 |
2914 for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next) | 2914 FOR_ALL_BUF_WININFO(buf, wip) |
2915 if (wip->wi_win == win) | 2915 if (wip->wi_win == win) |
2916 break; | 2916 break; |
2917 if (wip == NULL) | 2917 if (wip == NULL) |
2918 { | 2918 { |
2919 // allocate a new entry | 2919 // allocate a new entry |
3002 buf_T *buf, | 3002 buf_T *buf, |
3003 int skip_diff_buffer UNUSED) | 3003 int skip_diff_buffer UNUSED) |
3004 { | 3004 { |
3005 wininfo_T *wip; | 3005 wininfo_T *wip; |
3006 | 3006 |
3007 for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next) | 3007 FOR_ALL_BUF_WININFO(buf, wip) |
3008 if (wip->wi_win == curwin | 3008 if (wip->wi_win == curwin |
3009 #ifdef FEAT_DIFF | 3009 #ifdef FEAT_DIFF |
3010 && (!skip_diff_buffer || !wininfo_other_tab_diff(wip)) | 3010 && (!skip_diff_buffer || !wininfo_other_tab_diff(wip)) |
3011 #endif | 3011 #endif |
3012 ) | 3012 ) |
3017 if (wip == NULL) | 3017 if (wip == NULL) |
3018 { | 3018 { |
3019 #ifdef FEAT_DIFF | 3019 #ifdef FEAT_DIFF |
3020 if (skip_diff_buffer) | 3020 if (skip_diff_buffer) |
3021 { | 3021 { |
3022 for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next) | 3022 FOR_ALL_BUF_WININFO(buf, wip) |
3023 if (!wininfo_other_tab_diff(wip)) | 3023 if (!wininfo_other_tab_diff(wip)) |
3024 break; | 3024 break; |
3025 } | 3025 } |
3026 else | 3026 else |
3027 #endif | 3027 #endif |
3130 buf_T **buflist_data = NULL, **p; | 3130 buf_T **buflist_data = NULL, **p; |
3131 | 3131 |
3132 if (vim_strchr(eap->arg, 't')) | 3132 if (vim_strchr(eap->arg, 't')) |
3133 { | 3133 { |
3134 ga_init2(&buflist, sizeof(buf_T *), 50); | 3134 ga_init2(&buflist, sizeof(buf_T *), 50); |
3135 for (buf = firstbuf; buf != NULL; buf = buf->b_next) | 3135 FOR_ALL_BUFFERS(buf) |
3136 { | 3136 { |
3137 if (ga_grow(&buflist, 1) == OK) | 3137 if (ga_grow(&buflist, 1) == OK) |
3138 ((buf_T **)buflist.ga_data)[buflist.ga_len++] = buf; | 3138 ((buf_T **)buflist.ga_data)[buflist.ga_len++] = buf; |
3139 } | 3139 } |
3140 | 3140 |