mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
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 #5339)
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user