aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-07-11 15:49:29 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-07-12 15:18:17 +0100
commit78ddedc88187b5a028c2f0ef649577cb33b19d24 (patch)
tree596ed79fb3326d2447405400e51d7d50638a8248 /contrib
parent72042e8114b7097a84dfbd9d2c5c3253dd1c9eb9 (diff)
downloadrspamd-78ddedc88187b5a028c2f0ef649577cb33b19d24.tar.gz
rspamd-78ddedc88187b5a028c2f0ef649577cb33b19d24.zip
[Project] Add linked list reversal procedure
Diffstat (limited to 'contrib')
-rw-r--r--contrib/uthash/utlist.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/contrib/uthash/utlist.h b/contrib/uthash/utlist.h
index e4d9a4c23..6c72b9fb2 100644
--- a/contrib/uthash/utlist.h
+++ b/contrib/uthash/utlist.h
@@ -365,6 +365,15 @@ do {
} \
} while (0)
+#define LL_REVERSE2(head,next) do { \
+ LDECLTYPE(head) _cur = (head), _p = NULL, _n = NULL; \
+ while(_cur != NULL) { _n = _cur->next; _cur->next = _p; _p = _cur; _cur = _n; } \
+ (head) = _p; \
+} while (0)
+
+#define LL_REVERSE(head) \
+ LL_REVERSE2(head,next)
+
/* Here are VS2008 replacements for LL_APPEND and LL_DELETE */
#define LL_APPEND_VS2008(head,add) \
LL_APPEND2_VS2008(head,add,next)