freebsd-nq/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
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
monetdef Fix the number of decimal digits used for Swiss Francs (0 -> 2). Found by the libc++ test suite. If there is some locale test suite somewhere, it might be worth running it... 2011-11-12 14:39:20 +00:00
msgdef
numericdef
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
Makefile Add support for our own DTrace scripts and those from the DTraceToolkit 2012-05-18 16:40:15 +00:00
Makefile.inc