Bug #852
closedhwpmc [4/13]
0%
Description
Add safe iterator for STAILQ. Required for hwpmc, freebsd firewire code,
other imports will probably need it in the future. Freebsd names these
macros as "_SAFE".
Obtained-from: FreeBSD
Index: sys/queue.h
===================================================================
retrieving revision 1.8
diff u -p -r1.8 queue.h sys/queue.h
--
+++ sys/queue.h@ -103,7 +103,7
@
* _PREV - - - + +
* _LAST - - + + +
* _FOREACH + + + +
- * _FOREACH_MUTABLE - + - + -
* _FOREACH_MUTABLE - + + + -
* _FOREACH_REVERSE - - - + +
* _INSERT_HEAD + + + + +
* _INSERT_BEFORE - + - + +@ -215,6 +215,11
@ struct { \
(var); \
(var) = STAILQ_NEXT((var), field))
#define STAILQ_FOREACH_MUTABLE(var, head, field, nvar) \
for((var) = STAILQ_FIRST((head)); \
+ (var) && ((nvar) = STAILQ_NEXT((var), field), 1); \
+ (var) = (nvar))
+
#define STAILQ_INIT(head) do { \
STAILQ_FIRST((head)) = NULL; \
(head)->stqh_last = &STAILQ_FIRST((head)); \