diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2018-09-08 19:25:00 +0200 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2018-09-08 20:34:32 +0200 |
| commit | a43ad4fef85196592e59665fa9b69eddb30592e0 (patch) | |
| tree | 943b674a163f17a9e6a83ab7871dd1845bac9beb /lib/queue.h | |
| parent | 6317894ef3c5f5a21cca00c3a851f13b2d81541b (diff) | |
lib, ldpd: fix SA warnings from TAILQ oddness
Add a TAILQ_POP_FIRST so Clang understands it's the same item that is
getting removed from the list.
Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'lib/queue.h')
| -rw-r--r-- | lib/queue.h | 13 |
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 */ |
