summaryrefslogtreecommitdiff
path: root/lib/queue.h
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-09-08 21:04:54 -0400
committerGitHub <noreply@github.com>2018-09-08 21:04:54 -0400
commit4bb7d4482d7b22fea694d7b387c2090fdc32ce83 (patch)
tree7e1a052104bf9d5e8756281c601e0450fad2f5ed /lib/queue.h
parent714e135429aaca467bd2ed654edfe977b5cd1a9c (diff)
parente10cfdaf51fd5662309eda11ff37dfac1d94abdf (diff)
Merge pull request #2994 from opensourcerouting/sa-warnings
fix remaining SA warnings
Diffstat (limited to 'lib/queue.h')
-rw-r--r--lib/queue.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/queue.h b/lib/queue.h
index 04fbeee700..11e28b4c91 100644
--- a/lib/queue.h
+++ b/lib/queue.h
@@ -72,4 +72,17 @@
#include "freebsd-queue.h"
#endif /* defined(__OpenBSD__) && !defined(STAILQ_HEAD) */
+#ifndef TAILQ_POP_FIRST
+#define TAILQ_POP_FIRST(head, field) \
+ ({ typeof((head)->tqh_first) _elm = TAILQ_FIRST(head); \
+ if (_elm) { \
+ if ((TAILQ_NEXT((_elm), field)) != NULL) \
+ TAILQ_NEXT((_elm), field)->field.tqe_prev = \
+ &TAILQ_FIRST(head); \
+ else \
+ (head)->tqh_last = &TAILQ_FIRST(head); \
+ TAILQ_FIRST(head) = TAILQ_NEXT((_elm), field); \
+ }; _elm; })
+#endif
+
#endif /* _FRR_QUEUE_H */