Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F160243656
D50131.id154834.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D50131.id154834.diff
View Options
diff --git a/share/man/man3/Makefile b/share/man/man3/Makefile
--- a/share/man/man3/Makefile
+++ b/share/man/man3/Makefile
@@ -258,6 +258,7 @@
queue.3 STAILQ_REMOVE.3 \
queue.3 STAILQ_REMOVE_AFTER.3 \
queue.3 STAILQ_REMOVE_HEAD.3 \
+ queue.3 STAILQ_REVERSE.3 \
queue.3 STAILQ_SWAP.3 \
queue.3 TAILQ_CLASS_ENTRY.3 \
queue.3 TAILQ_CLASS_HEAD.3 \
diff --git a/share/man/man3/queue.3 b/share/man/man3/queue.3
--- a/share/man/man3/queue.3
+++ b/share/man/man3/queue.3
@@ -73,6 +73,7 @@
.Nm STAILQ_REMOVE ,
.Nm STAILQ_REMOVE_AFTER ,
.Nm STAILQ_REMOVE_HEAD ,
+.Nm STAILQ_REVERSE ,
.Nm STAILQ_SPLIT_AFTER ,
.Nm STAILQ_SWAP ,
.Nm LIST_CLASS_ENTRY ,
@@ -177,6 +178,7 @@
.Fn STAILQ_REMOVE "STAILQ_HEAD *head" "TYPE *elm" "TYPE" "STAILQ_ENTRY NAME"
.Fn STAILQ_REMOVE_AFTER "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
.Fn STAILQ_REMOVE_HEAD "STAILQ_HEAD *head" "STAILQ_ENTRY NAME"
+.Fn STAILQ_REVERSE "STAILQ_HEAD *head" "TYPE" "STAILQ_ENTRY NAME"
.Fn STAILQ_SPLIT_AFTER "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_HEAD *rest" "STAILQ_ENTRY NAME"
.Fn STAILQ_SWAP "STAILQ_HEAD *head1" "STAILQ_HEAD *head2" "TYPE"
.\"
@@ -791,6 +793,10 @@
high-usage code paths or to operate on long tail queues.
.Pp
The macro
+.Nm STAILQ_REVERSE
+reverses the queue in place.
+.Pp
+The macro
.Nm STAILQ_SPLIT_AFTER
splits the tail queue referenced by
.Fa head ,
diff --git a/sys/sys/queue.h b/sys/sys/queue.h
--- a/sys/sys/queue.h
+++ b/sys/sys/queue.h
@@ -564,6 +564,22 @@
(head2)->stqh_last = &STAILQ_FIRST(head2); \
} while (0)
+#define STAILQ_REVERSE(head, type, field) do { \
+ if (STAILQ_EMPTY(head)) \
+ break; \
+ QUEUE_TYPEOF(type) *_Var, *_Varp, *_Varn; \
+ for (_Var = STAILQ_FIRST(head), _Varp = NULL; \
+ _Var != NULL;) { \
+ _Varn = STAILQ_NEXT(_Var, field); \
+ STAILQ_NEXT(_Var, field) = _Varp; \
+ _Varp = _Var; \
+ _Var = _Varn; \
+ } \
+ _Var = STAILQ_LAST(head, type, field); \
+ (head)->stqh_last = &STAILQ_NEXT(STAILQ_FIRST(head), field); \
+ (head)->stqh_first = _Var; \
+} while (0)
+
#define STAILQ_END(head) NULL
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jun 23, 12:37 PM (10 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34246096
Default Alt Text
D50131.id154834.diff (2 KB)
Attached To
Mode
D50131: sys/queue.h: add STAILQ_REVERSE
Attached
Detach File
Event Timeline
Log In to Comment