summaryrefslogtreecommitdiffstats
path: root/share/man/man3/Makefile
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2012-09-12 21:03:48 +0000
committered <ed@FreeBSD.org>2012-09-12 21:03:48 +0000
commit0fa239bbd777d6f3e2661e7e950511e42bf4e720 (patch)
tree21ddf8747134de5ee163c996ea89454f7b339af6 /share/man/man3/Makefile
parentb1b3e5df41b151728fdfd1f334b1e8f6ce9067ed (diff)
downloadFreeBSD-src-0fa239bbd777d6f3e2661e7e950511e42bf4e720.zip
FreeBSD-src-0fa239bbd777d6f3e2661e7e950511e42bf4e720.tar.gz
Implement LIST_PREV().
Regular LISTs have been implemented in such a way that the prev-pointer does not point to the previous element, but to the next-pointer stored in the previous element. This is done to simplify LIST_REMOVE(). This macro can be implemented without knowing the address of the list head. Unfortunately this makes it harder to implement LIST_PREV(), which is why this macro was never here. Still, it is possible to implement this macro. If the prev-pointer points to the list head, we return NULL. Otherwise we simply subtract the offset of the prev-pointer within the structure. It's not as efficient as traversing forward of course, but in practice it shouldn't be that bad. In almost all use cases, people will want to compare the value returned by LIST_PREV() against NULL, so an optimizing compiler will not emit code that does more branching than TAILQs. While there, make the code a bit more readable by introducing __member2struct(). This makes STAILQ_LAST() far more readable. MFC after: 1 month
Diffstat (limited to 'share/man/man3/Makefile')
-rw-r--r--share/man/man3/Makefile1
1 files changed, 1 insertions, 0 deletions
diff --git a/share/man/man3/Makefile b/share/man/man3/Makefile
index 7979e0e..ccdc549 100644
--- a/share/man/man3/Makefile
+++ b/share/man/man3/Makefile
@@ -76,6 +76,7 @@ MLINKS+= queue.3 LIST_EMPTY.3 \
queue.3 LIST_INSERT_BEFORE.3 \
queue.3 LIST_INSERT_HEAD.3 \
queue.3 LIST_NEXT.3 \
+ queue.3 LIST_PREV.3 \
queue.3 LIST_REMOVE.3 \
queue.3 LIST_SWAP.3 \
queue.3 SLIST_EMPTY.3 \
OpenPOWER on IntegriCloud