diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-04-02 18:50:46 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-04-02 18:50:46 +0200 |
commit | aeea72151c31d686bcbb7b06d895006d7363585c (patch) | |
tree | 500d487503a1a82cecc8f2a3e9bf89b50638fe5a /src/terminal.c | |
parent | f10806b25090879fdc1a86cc0da2f4f34fd21921 (diff) | |
download | vim-git-aeea72151c31d686bcbb7b06d895006d7363585c.tar.gz |
patch 8.2.0500: using the same loop in many placesv8.2.0500
Problem: Using the same loop in many places.
Solution: Define more FOR_ALL macros. (Yegappan Lakshmanan, closes #5339)
Diffstat (limited to 'src/terminal.c')
-rw-r--r-- | src/terminal.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/terminal.c b/src/terminal.c index 2ff697acf..d7d23cc25 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -183,6 +183,9 @@ static BOOL has_conpty = FALSE; #define MAX_ROW 999999 // used for tl_dirty_row_end to update all rows #define KEY_BUF_LEN 200 +#define FOR_ALL_TERMS(term) \ + for ((term) = first_term; (term) != NULL; (term) = (term)->tl_next) + /* * Functions with separate implementation for MS-Windows and Unix-like systems. */ @@ -626,8 +629,7 @@ term_start( listitem_T *item; ga_init2(&ga, 1, 100); - for (item = argvar->vval.v_list->lv_first; - item != NULL; item = item->li_next) + FOR_ALL_LIST_ITEMS(argvar->vval.v_list, item) { char_u *s = tv_get_string_chk(&item->li_tv); char_u *p; @@ -1892,7 +1894,7 @@ term_check_timers(int next_due_arg, proftime_T *now) term_T *term; int next_due = next_due_arg; - for (term = first_term; term != NULL; term = term->tl_next) + FOR_ALL_TERMS(term) { if (term->tl_timer_set && !term->tl_normal_mode) { @@ -2175,7 +2177,7 @@ term_paste_register(int prev_c UNUSED) if (l != NULL) { type = get_reg_type(c, ®len); - for (item = l->lv_first; item != NULL; item = item->li_next) + FOR_ALL_LIST_ITEMS(l, item) { char_u *s = tv_get_string(&item->li_tv); #ifdef MSWIN @@ -5701,7 +5703,7 @@ f_term_list(typval_T *argvars UNUSED, typval_T *rettv) return; l = rettv->vval.v_list; - for (tp = first_term; tp != NULL; tp = tp->tl_next) + FOR_ALL_TERMS(tp) if (tp != NULL && tp->tl_buffer != NULL) if (list_append_number(l, (varnumber_T)tp->tl_buffer->b_fnum) == FAIL) @@ -6077,7 +6079,7 @@ term_send_eof(channel_T *ch) { term_T *term; - for (term = first_term; term != NULL; term = term->tl_next) + FOR_ALL_TERMS(term) if (term->tl_job == ch->ch_job) { if (term->tl_eof_chars != NULL) |