diff --git a/share/man/man3/queue.3 b/share/man/man3/queue.3 index 2e2ddec0c55..15f8f6d1812 100644 --- a/share/man/man3/queue.3 +++ b/share/man/man3/queue.3 @@ -28,7 +28,7 @@ .\" @(#)queue.3 8.2 (Berkeley) 1/24/94 .\" $FreeBSD$ .\" -.Dd September 8, 2016 +.Dd October 11, 2021 .Dt QUEUE 3 .Os .Sh NAME @@ -332,10 +332,10 @@ Each head entry requires two pointers rather than one. Code size is about 15% greater and operations run about 20% slower than singly-linked lists. .El -.Pp -In the macro definitions, -.Fa TYPE -is the name of a user defined structure. +.Ss MACRO DEFINITIONS +.Bl -tag -width "CLASSTYPE" +.It Fa TYPE +The name of a user defined structure. The structure must contain a field called .Fa NAME which is of type @@ -344,9 +344,8 @@ which is of type .Li LIST_ENTRY , or .Li TAILQ_ENTRY . -In the macro definitions, -.Fa CLASSTYPE -is the name of a user defined class. +.It Fa CLASSTYPE +The name of a user defined class. The class must contain a field called .Fa NAME which is of type @@ -355,9 +354,8 @@ which is of type .Li LIST_CLASS_ENTRY , or .Li TAILQ_CLASS_ENTRY . -The argument -.Fa HEADNAME -is the name of a user defined structure that must be declared +.It Fa HEADNAME +The name of a user defined structure that must be declared using the macros .Li SLIST_HEAD , .Li SLIST_CLASS_HEAD , @@ -368,6 +366,12 @@ using the macros .Li TAILQ_HEAD , or .Li TAILQ_CLASS_HEAD . +.Pp +If +.Fa HEADNAME +is omitted, the resulting data structure will be anonymous. +.El +.Pp See the examples below for further explanation of how these macros are used. .Sh SINGLY-LINKED LISTS @@ -568,7 +572,7 @@ free(n3); SLIST_FOREACH(np, &head, entries) np-> ... /* Safe forward traversal. */ -SLIST_FOREACH_SAFE(np, &head, entries, np_temp) { +SLIST_FOREACH_SAFE(np, &head, entries, tvar) { np->do_stuff(); ... SLIST_REMOVE(&head, np, entry, entries); @@ -790,7 +794,7 @@ free(n3); STAILQ_FOREACH(np, &head, entries) np-> ... /* Safe forward traversal. */ -STAILQ_FOREACH_SAFE(np, &head, entries, np_temp) { +STAILQ_FOREACH_SAFE(np, &head, entries, tvar) { np->do_stuff(); ... STAILQ_REMOVE(&head, np, entry, entries); @@ -980,7 +984,7 @@ struct entry { ... LIST_ENTRY(entry) entries; /* List. */ ... -} *n1, *n2, *n3, *np, *np_temp; +} *n1, *n2, *n3, *np, *tvar; LIST_INIT(&head); /* Initialize the list. */ @@ -1000,7 +1004,7 @@ LIST_FOREACH(np, &head, entries) np-> ... /* Safe forward traversal. */ -LIST_FOREACH_SAFE(np, &head, entries, np_temp) { +LIST_FOREACH_SAFE(np, &head, entries, tvar) { np->do_stuff(); ... LIST_REMOVE(np, entries); @@ -1260,7 +1264,7 @@ free(n2); TAILQ_FOREACH(np, &head, entries) np-> ... /* Safe forward traversal. */ -TAILQ_FOREACH_SAFE(np, &head, entries, np_temp) { +TAILQ_FOREACH_SAFE(np, &head, entries, tvar) { np->do_stuff(); ... TAILQ_REMOVE(&head, np, entries);