diff options
author | Matthew Dempsky <matthew@cvs.openbsd.org> | 2011-07-03 16:08:41 +0000 |
---|---|---|
committer | Matthew Dempsky <matthew@cvs.openbsd.org> | 2011-07-03 16:08:41 +0000 |
commit | fb4a823d92ba09457cf76befa7f6ea5387b4c6d3 (patch) | |
tree | ff150111c73a0d29ffd282da6dec0eb3fcc3c567 | |
parent | cf51fdce33cceb21f045884bd8ac674d82bb7fa5 (diff) |
Add a SIMPLEQ_REMOVE_NEXT() macro analogous to SLIST_REMOVE_NEXT().
ok krw@
-rw-r--r-- | share/man/man3/Makefile | 5 | ||||
-rw-r--r-- | share/man/man3/queue.3 | 12 | ||||
-rw-r--r-- | sys/sys/queue.h | 8 |
3 files changed, 20 insertions, 5 deletions
diff --git a/share/man/man3/Makefile b/share/man/man3/Makefile index f4fef38f6b0..89cc82c79d3 100644 --- a/share/man/man3/Makefile +++ b/share/man/man3/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.21 2010/02/18 18:28:18 jmc Exp $ +# $OpenBSD: Makefile,v 1.22 2011/07/03 16:08:40 matthew Exp $ # @(#)Makefile 8.2 (Berkeley) 12/13/93 MAN= assert.3 bitstring.3 CMSG_DATA.3 dlfcn.3 dl_iterate_phdr.3 end.3 \ @@ -33,7 +33,8 @@ MLINKS+=queue.3 SIMPLEQ_ENTRY.3 queue.3 SIMPLEQ_HEAD.3 \ queue.3 SIMPLEQ_EMPTY.3 queue.3 SIMPLEQ_FOREACH.3 \ queue.3 SIMPLEQ_INIT.3 \ queue.3 SIMPLEQ_INSERT_HEAD.3 queue.3 SIMPLEQ_INSERT_TAIL.3 \ - queue.3 SIMPLEQ_INSERT_AFTER.3 queue.3 SIMPLEQ_REMOVE_HEAD.3 + queue.3 SIMPLEQ_INSERT_AFTER.3 queue.3 SIMPLEQ_REMOVE_HEAD.3 \ + queue.3 SIMPLEQ_REMOVE_NEXT.3 MLINKS+=queue.3 TAILQ_ENTRY.3 queue.3 TAILQ_HEAD.3 \ queue.3 TAILQ_HEAD_INITIALIZER.3 queue.3 TAILQ_FIRST.3 \ queue.3 TAILQ_NEXT.3 queue.3 TAILQ_END.3 queue.3 TAILQ_LAST.3 \ diff --git a/share/man/man3/queue.3 b/share/man/man3/queue.3 index fb5e77f7c09..aae708f1360 100644 --- a/share/man/man3/queue.3 +++ b/share/man/man3/queue.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: queue.3,v 1.49 2009/03/01 10:28:55 jmc Exp $ +.\" $OpenBSD: queue.3,v 1.50 2011/07/03 16:08:40 matthew Exp $ .\" $NetBSD: queue.3,v 1.4 1995/07/03 00:25:36 mycroft Exp $ .\" .\" Copyright (c) 1993 The Regents of the University of California. @@ -30,7 +30,7 @@ .\" .\" @(#)queue.3 8.1 (Berkeley) 12/13/93 .\" -.Dd $Mdocdate: March 1 2009 $ +.Dd $Mdocdate: July 3 2011 $ .Dt QUEUE 3 .Os .Sh NAME @@ -76,6 +76,7 @@ .Nm SIMPLEQ_INSERT_TAIL , .Nm SIMPLEQ_INSERT_AFTER , .Nm SIMPLEQ_REMOVE_HEAD , +.Nm SIMPLEQ_REMOVE_NEXT , .Nm TAILQ_ENTRY , .Nm TAILQ_HEAD , .Nm TAILQ_HEAD_INITIALIZER , @@ -189,6 +190,8 @@ .Fn SIMPLEQ_INSERT_AFTER "SIMPLEQ_HEAD *head" "struct TYPE *listelm" "struct TYPE *elm" "SIMPLEQ_ENTRY NAME" .Ft void .Fn SIMPLEQ_REMOVE_HEAD "SIMPLEQ_HEAD *head" "SIMPLEQ_ENTRY NAME" +.Ft void +.Fn SIMPLEQ_REMOVE_NEXT "SIMPLEQ_HEAD *head" "struct TYPE *elm" "SIMPLEQ_ENTRY NAME" .Pp .Fn TAILQ_ENTRY "TYPE" .Fn TAILQ_HEAD "HEADNAME" "TYPE" @@ -734,6 +737,11 @@ macro removes the first element from the queue. .Pp The +.Fn SIMPLEQ_REMOVE_NEXT +macro removes the queue element immediately following +.Fa elm . +.Pp +The .Fn SIMPLEQ_FIRST and .Fn SIMPLEQ_NEXT diff --git a/sys/sys/queue.h b/sys/sys/queue.h index 38130e08152..7f961edaa28 100644 --- a/sys/sys/queue.h +++ b/sys/sys/queue.h @@ -1,4 +1,4 @@ -/* $OpenBSD: queue.h,v 1.32 2007/04/30 18:42:34 pedro Exp $ */ +/* $OpenBSD: queue.h,v 1.33 2011/07/03 16:08:40 matthew Exp $ */ /* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */ /* @@ -300,6 +300,12 @@ struct { \ (head)->sqh_last = &(head)->sqh_first; \ } while (0) +#define SIMPLEQ_REMOVE_NEXT(head, elm, field) do { \ + if (((elm)->field.sqe_next = (elm)->field.sqe_next->field.sqe_next) \ + == NULL) \ + (head)->sqh_last = &(elm)->field.sqe_next; \ +} while (0) + /* * Tail queue definitions. */ |