[ntp:hackers] singly-linked list template macros for NTP

Dave Hart davehart at gmail.com
Tue Jul 14 07:19:41 UTC 2009


On Tue, Jul 14, 2009 at 6:27 AM, Poul-Henning Kamp<phk at phk.freebsd.dk> wrote:
>
> I can *highly* recommond the BSD <sys/queue.h> macros.
>
> They provide a full set of all relevant kinds of list types, and comes
> with a manual page.

The BSD singly-linked tail queue would be ideal for the one case I
didn't convert from doubly-linked, the full receive buffer list, with
consistently cheap FIFO operation and without unneeded previous
pointers.

On the other hand, sys/queue.h SLIST_REMOVE could learn a trick from
ntp_lists.h REMOVE_SLIST_EXPR, using a pointer to a pointer to the
entry to collapse removal of the head item and other items into a
common codepath.  Feel free to borrow :)

Cheers,
Dave Hart


More information about the hackers mailing list