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.)
Unfortunately queue.h won't allow this. My suggestion would be to change
#define SLIST_ENTRY(type) \
struct {
\
struct type *sle_next; /* next element */ \
}
#define SIMPLEQ_ENTRY(type) \
struct {
\
struct type *sqe_next; /* next element */ \
}
to:
#define SLIST_ENTRY(type) \
struct {
\
struct type *se_next; /* next element */ \
}
#define SIMPLEQ_ENTRY(type) \
struct {
\
struct type *se_next; /* next element */ \
}
Regards
Alex