Bug 192267 - queue(3) doesn't note that HEADNAME argument in *_HEAD macro is optional/creates anonymous structs
Summary: queue(3) doesn't note that HEADNAME argument in *_HEAD macro is optional/crea...
Status: Open
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2014-07-30 05:07 UTC by Enji Cooper
Modified: 2021-10-11 19:18 UTC (History)
2 users (show)

See Also:


Attachments
queue(3) patch (2.84 KB, patch)
2021-10-11 19:16 UTC, Felix Johnson
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Enji Cooper freebsd_committer freebsd_triage 2014-07-30 05:07:39 UTC
Some of the code in the tree uses the data structures in a one-off manner, such that specifying the HEADNAME value for the *_HEAD macro isn't required. What omitting HEADNAME does is creates an anonymous structure for describing the data structure/pointers, whereas specifying HEADNAME creates a named structure for describing the data structure/pointers, i.e.

149 #define SLIST_HEAD(name, type)                                          \
150 struct name {                                                           \
151         struct type *slh_first; /* first element */                     \
152 }
...
242 #define STAILQ_HEAD(name, type)                                         \
243 struct name {                                                           \
244         struct type *stqh_first;/* first element */                     \
245         struct type **stqh_last;/* addr of last next element */         \
246 }
...
363 #define LIST_HEAD(name, type)                                           \
364 struct name {                                                           \
365         struct type *lh_first;  /* first element */                     \
366 }
...
491 #define TAILQ_HEAD(name, type)                                          \
492 struct name {                                                           \
493         struct type *tqh_first; /* first element */                     \
494         struct type **tqh_last; /* addr of last next element */         \
495         TRACEBUF                                                        \
496 }
Comment 1 Felix Johnson 2021-10-11 19:16:59 UTC
Created attachment 228599 [details]
queue(3) patch

Convert macro definitions to subsection.
Document that if HEADNAME is omitted, the resulting structure will be anonymous.
Change np_temp function argument to tvar to match macro implementation
(bug #192266).