Bug #852

hwpmc [4/13]

Added by aoiko almost 7 years ago. Updated over 4 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

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)); \

History

#1 Updated by alexh over 4 years ago

See Issue1714.

Also available in: Atom PDF