aboutsummaryrefslogtreecommitdiffstats
path: root/man3
diff options
context:
space:
mode:
authorAlejandro Colomar <colomar.6.4.3@gmail.com>2020-10-22 14:38:16 +0200
committerMichael Kerrisk <mtk.manpages@gmail.com>2020-10-22 19:30:54 +0200
commit8d526f6322409abbc0f060340e0eb2a4299e8a97 (patch)
tree6c6d1627f08aff5a597c32fd5b09d762dd77693c /man3
parent36eac952da673d602d033e727535cf53c75fde7f (diff)
downloadman-pages-8d526f6322409abbc0f060340e0eb2a4299e8a97.tar.gz
queue.3, slist.3: DESCRIPTION: Move slist specific code from queue.3 to slist.3
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/queue.3155
-rw-r--r--man3/slist.3155
2 files changed, 155 insertions, 155 deletions
diff --git a/man3/queue.3 b/man3/queue.3
index 3f8ca65f28..cf5ab60b23 100644
--- a/man3/queue.3
+++ b/man3/queue.3
@@ -322,161 +322,6 @@ or
.Li CIRCLEQ_HEAD .
See the examples below for further explanation of how these
macros are used.
-.Ss Singly-linked lists
-A singly-linked list is headed by a structure defined by the
-.Nm SLIST_HEAD
-macro.
-This structure contains a single pointer to the first element
-on the list.
-The elements are singly linked for minimum space and pointer manipulation
-overhead at the expense of O(n) removal for arbitrary elements.
-New elements can be added to the list after an existing element or
-at the head of the list.
-An
-.Fa SLIST_HEAD
-structure is declared as follows:
-.Bd -literal -offset indent
-SLIST_HEAD(HEADNAME, TYPE) head;
-.Ed
-.Pp
-where
-.Fa HEADNAME
-is the name of the structure to be defined, and
-.Fa TYPE
-is the type of the elements to be linked into the list.
-A pointer to the head of the list can later be declared as:
-.Bd -literal -offset indent
-struct HEADNAME *headp;
-.Ed
-.Pp
-(The names
-.Li head
-and
-.Li headp
-are user selectable.)
-.Pp
-The macro
-.Nm SLIST_HEAD_INITIALIZER
-evaluates to an initializer for the list
-.Fa head .
-.Pp
-The macro
-.Nm SLIST_EMPTY
-evaluates to true if there are no elements in the list.
-.Pp
-The macro
-.Nm SLIST_ENTRY
-declares a structure that connects the elements in
-the list.
-.Pp
-The macro
-.Nm SLIST_FIRST
-returns the first element in the list or NULL if the list is empty.
-.Pp
-The macro
-.Nm SLIST_FOREACH
-traverses the list referenced by
-.Fa head
-in the forward direction, assigning each element in
-turn to
-.Fa var .
-.\" .Pp
-.\" The macro
-.\" .Nm SLIST_FOREACH_FROM
-.\" behaves identically to
-.\" .Nm SLIST_FOREACH
-.\" when
-.\" .Fa var
-.\" is NULL, else it treats
-.\" .Fa var
-.\" as a previously found SLIST element and begins the loop at
-.\" .Fa var
-.\" instead of the first element in the SLIST referenced by
-.\" .Fa head .
-.\" .Pp
-.\" The macro
-.\" .Nm SLIST_FOREACH_SAFE
-.\" traverses the list referenced by
-.\" .Fa head
-.\" in the forward direction, assigning each element in
-.\" turn to
-.\" .Fa var .
-.\" However, unlike
-.\" .Fn SLIST_FOREACH
-.\" here it is permitted to both remove
-.\" .Fa var
-.\" as well as free it from within the loop safely without interfering with the
-.\" traversal.
-.\" .Pp
-.\" The macro
-.\" .Nm SLIST_FOREACH_FROM_SAFE
-.\" behaves identically to
-.\" .Nm SLIST_FOREACH_SAFE
-.\" when
-.\" .Fa var
-.\" is NULL, else it treats
-.\" .Fa var
-.\" as a previously found SLIST element and begins the loop at
-.\" .Fa var
-.\" instead of the first element in the SLIST referenced by
-.\" .Fa head .
-.Pp
-The macro
-.Nm SLIST_INIT
-initializes the list referenced by
-.Fa head .
-.Pp
-The macro
-.Nm SLIST_INSERT_HEAD
-inserts the new element
-.Fa elm
-at the head of the list.
-.Pp
-The macro
-.Nm SLIST_INSERT_AFTER
-inserts the new element
-.Fa elm
-after the element
-.Fa listelm .
-.Pp
-The macro
-.Nm SLIST_NEXT
-returns the next element in the list.
-.\" .Pp
-.\" The macro
-.\" .Nm SLIST_REMOVE_AFTER
-.\" removes the element after
-.\" .Fa elm
-.\" from the list.
-.\" Unlike
-.\" .Fa SLIST_REMOVE ,
-.\" this macro does not traverse the entire list.
-.Pp
-The macro
-.Nm SLIST_REMOVE_HEAD
-removes the element
-.Fa elm
-from the head of the list.
-For optimum efficiency,
-elements being removed from the head of the list should explicitly use
-this macro instead of the generic
-.Fa SLIST_REMOVE
-macro.
-.Pp
-The macro
-.Nm SLIST_REMOVE
-removes the element
-.Fa elm
-from the list.
-.\" .Pp
-.\" The macro
-.\" .Nm SLIST_SWAP
-.\" swaps the contents of
-.\" .Fa head1
-.\" and
-.\" .Fa head2 .
-.Pp
-See the EXAMPLES section below for an example program using a singly-linked list.
.Ss Singly-linked tail queues
A singly-linked tail queue is headed by a structure defined by the
.Nm STAILQ_HEAD
diff --git a/man3/slist.3 b/man3/slist.3
index 48bce3dc44..e29953a1d0 100644
--- a/man3/slist.3
+++ b/man3/slist.3
@@ -68,6 +68,161 @@
.\" .Fn SLIST_SWAP "SLIST_HEAD *head1" "SLIST_HEAD *head2" "SLIST_ENTRY NAME"
.\"
.SH DESCRIPTION
+.Ss Singly-linked lists
+A singly-linked list is headed by a structure defined by the
+.Nm SLIST_HEAD
+macro.
+This structure contains a single pointer to the first element
+on the list.
+The elements are singly linked for minimum space and pointer manipulation
+overhead at the expense of O(n) removal for arbitrary elements.
+New elements can be added to the list after an existing element or
+at the head of the list.
+An
+.Fa SLIST_HEAD
+structure is declared as follows:
+.Bd -literal -offset indent
+SLIST_HEAD(HEADNAME, TYPE) head;
+.Ed
+.Pp
+where
+.Fa HEADNAME
+is the name of the structure to be defined, and
+.Fa TYPE
+is the type of the elements to be linked into the list.
+A pointer to the head of the list can later be declared as:
+.Bd -literal -offset indent
+struct HEADNAME *headp;
+.Ed
+.Pp
+(The names
+.Li head
+and
+.Li headp
+are user selectable.)
+.Pp
+The macro
+.Nm SLIST_HEAD_INITIALIZER
+evaluates to an initializer for the list
+.Fa head .
+.Pp
+The macro
+.Nm SLIST_EMPTY
+evaluates to true if there are no elements in the list.
+.Pp
+The macro
+.Nm SLIST_ENTRY
+declares a structure that connects the elements in
+the list.
+.Pp
+The macro
+.Nm SLIST_FIRST
+returns the first element in the list or NULL if the list is empty.
+.Pp
+The macro
+.Nm SLIST_FOREACH
+traverses the list referenced by
+.Fa head
+in the forward direction, assigning each element in
+turn to
+.Fa var .
+.\" .Pp
+.\" The macro
+.\" .Nm SLIST_FOREACH_FROM
+.\" behaves identically to
+.\" .Nm SLIST_FOREACH
+.\" when
+.\" .Fa var
+.\" is NULL, else it treats
+.\" .Fa var
+.\" as a previously found SLIST element and begins the loop at
+.\" .Fa var
+.\" instead of the first element in the SLIST referenced by
+.\" .Fa head .
+.\" .Pp
+.\" The macro
+.\" .Nm SLIST_FOREACH_SAFE
+.\" traverses the list referenced by
+.\" .Fa head
+.\" in the forward direction, assigning each element in
+.\" turn to
+.\" .Fa var .
+.\" However, unlike
+.\" .Fn SLIST_FOREACH
+.\" here it is permitted to both remove
+.\" .Fa var
+.\" as well as free it from within the loop safely without interfering with the
+.\" traversal.
+.\" .Pp
+.\" The macro
+.\" .Nm SLIST_FOREACH_FROM_SAFE
+.\" behaves identically to
+.\" .Nm SLIST_FOREACH_SAFE
+.\" when
+.\" .Fa var
+.\" is NULL, else it treats
+.\" .Fa var
+.\" as a previously found SLIST element and begins the loop at
+.\" .Fa var
+.\" instead of the first element in the SLIST referenced by
+.\" .Fa head .
+.Pp
+The macro
+.Nm SLIST_INIT
+initializes the list referenced by
+.Fa head .
+.Pp
+The macro
+.Nm SLIST_INSERT_HEAD
+inserts the new element
+.Fa elm
+at the head of the list.
+.Pp
+The macro
+.Nm SLIST_INSERT_AFTER
+inserts the new element
+.Fa elm
+after the element
+.Fa listelm .
+.Pp
+The macro
+.Nm SLIST_NEXT
+returns the next element in the list.
+.\" .Pp
+.\" The macro
+.\" .Nm SLIST_REMOVE_AFTER
+.\" removes the element after
+.\" .Fa elm
+.\" from the list.
+.\" Unlike
+.\" .Fa SLIST_REMOVE ,
+.\" this macro does not traverse the entire list.
+.Pp
+The macro
+.Nm SLIST_REMOVE_HEAD
+removes the element
+.Fa elm
+from the head of the list.
+For optimum efficiency,
+elements being removed from the head of the list should explicitly use
+this macro instead of the generic
+.Fa SLIST_REMOVE
+macro.
+.Pp
+The macro
+.Nm SLIST_REMOVE
+removes the element
+.Fa elm
+from the list.
+.\" .Pp
+.\" The macro
+.\" .Nm SLIST_SWAP
+.\" swaps the contents of
+.\" .Fa head1
+.\" and
+.\" .Fa head2 .
+.Pp
+See the EXAMPLES section below for an example program using a singly-linked list.
.SH RETURN VALUE
.SH CONFORMING TO
.SH BUGS