Project

General

Profile

Actions

Bug #852

closed

hwpmc [4/13]

Added by aoiko about 17 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

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

Actions

Also available in: Atom PDF