diff options
| author | Alejandro Colomar <colomar.6.4.3@gmail.com> | 2020-10-22 14:38:20 +0200 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2020-10-22 19:31:24 +0200 |
| commit | 22f12126ded39d4284e3d76925efe6ac5a06d061 (patch) | |
| tree | 66be1deb785649f72921f13ce8d6fbe0ce85928b /man3 | |
| parent | bb8164dec0c436db3b07988c82b2286ce0aaa30d (diff) | |
| download | man-pages-22f12126ded39d4284e3d76925efe6ac5a06d061.tar.gz | |
slist.3: Add details
Add remaining details to complete the page.
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Diffstat (limited to 'man3')
| -rw-r--r-- | man3/slist.3 | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/man3/slist.3 b/man3/slist.3 index d97b745a01..7a8078de05 100644 --- a/man3/slist.3 +++ b/man3/slist.3 @@ -48,6 +48,7 @@ SLIST_REMOVE, .\"SLIST_REMOVE_AFTER, SLIST_REMOVE_HEAD .\"SLIST_SWAP +\- implementation of a singly-linked list .SH SYNOPSIS .nf .B #include <sys/queue.h> @@ -87,6 +88,8 @@ SLIST_REMOVE_HEAD .\".BI "void SLIST_SWAP(SLIST_HEAD *" head1 ", SLIST_HEAD *" head2 ", SLIST_ENTRY " NAME ");" .fi .SH DESCRIPTION +These macros define and operate on doubly-linked lists. +.PP In the macro definitions, .I TYPE is the name of a user-defined structure, @@ -259,11 +262,38 @@ from the list. .\" and .\" .IR head2 . .SH RETURN VALUE +.BR SLIST_EMPTY () +returns non-zero if the list is empty, +and zero if the list contains at least one entry. +.PP +.BR SLIST_FIRST (), +and +.BR SLIST_NEXT () +return a pointer to the first or next +.I SLIST_ENTRY +structure, respectively. +.PP +.BR SLIST_HEAD_INITIALIZER () +returns an initializer that can be assigned to the list +.IR head . .SH CONFORMING TO Not in POSIX.1, POSIX.1-2001 or POSIX.1-2008. Present on the BSDs (SLIST macros first appeared in 4.4BSD). .SH BUGS +The macro +.BR SLIST_FOREACH () +doesn't allow +.I var +to be removed or freed within the loop, +as it would interfere with the traversal. +The macro +.BR SLIST_FOREACH_SAFE (), +which is present on the BSDs but is not present in glibc, +fixes this limitation by allowing +.I var +to safely be removed from the list and freed from within the loop +without interfering with the traversal. .SH EXAMPLES .EX #include <stddef.h> @@ -321,3 +351,5 @@ main(void) } .EE .SH SEE ALSO +.BR insque (3), +.BR queue (3) |
