On Tue, Aug 09, 2005 at 11:38:38AM +0200, Alexander Farber wrote: > Hi, > > what I dislike about OpenBSD's queue.h is that you can't take an > element from a SLIST and put it into a SIMPLEQ and vice versa. > > For example in an iterative server I'm programming: > > For each client I have a SIMPLEQ for outgoing messages > (coming from the server and the other clients) which I writev() out. > > And the messages I don't malloc() each time, but keep them > in a SLIST and reuse them - similar to newnv() in OpenBSD's > /usr/src/usr.sbin/config/util.c (I don't need SIMPLEQ for this memory > pool, because the messages are taken/put back to/from the head.) >
Why? SIMPLEQ is a superset of SLIST. Just use the SIMPLEQ "functions" SIMPLEQ_INSERT_HEAD an SIMPLEQ_REMOVE_HEAD. Why should we change the emlement entries of SLIST and SIMPLEQ with the result that suddenly somebody starts to use SLIST macros on something that is actually a SIMPLEQ. This results in corrupted queues and strange bugs. So don't do it. -- :wq Claudio