freebsd-skq/share
Ed Schouten 4170b08388 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
2012-09-12 21:03:48 +00:00
..
colldef Add lv_LV, move lt_LT to common part 2009-09-03 16:53:11 +00:00
dict
doc Don't build and install the 07.lpd doc if WITHOUT_LPR is set. 2012-08-27 17:15:14 +00:00
dtrace Remove copy/pasteo in the copyright notice. 2012-07-21 07:14:52 +00:00
examples Minor English grammar fixes. 2012-09-09 01:22:32 +00:00
i18n
info
man Implement LIST_PREV(). 2012-09-12 21:03:48 +00:00
me
misc - Add myself to calendar.freebsd 2012-09-11 13:29:50 +00:00
mk Add MK_KDUMP. 2012-09-12 14:58:07 +00:00
mklocale Add lv_LV, move lt_LT to common part 2009-09-03 17:12:45 +00:00
monetdef
msgdef Add lv_LV 2009-09-04 06:19:37 +00:00
numericdef Add lv_LV 2009-09-03 17:37:23 +00:00
security
sendmail
skel Copy recent changes from etc/root/dot.cshrc that make the defaults more 2012-04-29 22:29:48 +00:00
snmp
syscons Add a description of the Spanish Dvorak keymap added in r235251 2012-07-07 17:35:34 +00:00
tabset
termcap General mdoc(7) and typo fixes. 2012-05-12 15:08:22 +00:00
timedef
zoneinfo Officially speaking, the zoneinfo data files are contributed data. 2010-02-25 06:44:16 +00:00
Makefile Add support for our own DTrace scripts and those from the DTraceToolkit 2012-05-18 16:40:15 +00:00
Makefile.inc $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00