diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-04-06 22:13:01 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-04-06 22:13:01 +0200 |
commit | 00d253e2b2f435a5386582c3f857008e7ac355c2 (patch) | |
tree | 71bbea4e4c6efa593a85266e445d82377a65f454 /src/time.c | |
parent | ee4e0c1e9a81cb5d96e0060203a9033c2f28588e (diff) |
patch 8.2.0523: loops are repeatedv8.2.0523
Problem: Loops are repeated.
Solution: Use FOR_ALL_ macros. (Yegappan Lakshmanan, closes #5882)
Diffstat (limited to 'src/time.c')
-rw-r--r-- | src/time.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/time.c b/src/time.c index 2706ac22da..bf6801f679 100644 --- a/src/time.c +++ b/src/time.c @@ -21,6 +21,9 @@ static char tz_cache[64]; #endif +#define FOR_ALL_TIMERS(t) \ + for ((t) = first_timer; (t) != NULL; (t) = (t)->tr_next) + /* * Call either localtime(3) or localtime_r(3) from POSIX libc time.h, with the * latter version preferred for reentrancy. @@ -583,7 +586,7 @@ find_timer(long id) if (id >= 0) { - for (timer = first_timer; timer != NULL; timer = timer->tr_next) + FOR_ALL_TIMERS(timer) if (timer->tr_id == id) return timer; } @@ -659,7 +662,7 @@ add_timer_info_all(typval_T *rettv) { timer_T *timer; - for (timer = first_timer; timer != NULL; timer = timer->tr_next) + FOR_ALL_TIMERS(timer) if (timer->tr_id != -1) add_timer_info(rettv, timer); } |