From 666dd36f8d47f29d4270bb6ab8ba1c2ffe2e6dff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Pettersson?= Date: Sun, 12 Oct 2014 12:58:45 +0200 Subject: [PATCH] Added twc_list_foreach_reverse. --- src/twc-list.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/twc-list.h b/src/twc-list.h index 80e0ae7..6d602b9 100644 --- a/src/twc-list.h +++ b/src/twc-list.h @@ -84,5 +84,10 @@ twc_list_get(struct t_twc_list *list, size_t index); item; \ item = item->next_item, ++index) +#define twc_list_foreach_reverse(list, index, item) \ + for (item = list->tail, index = list->count - 1; \ + item; \ + item = item->prev_item, --index) + #endif // TOX_WEECHAT_LIST_H