This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: question about queue.h
- From: walter harms <wharms at bfs dot de>
- To: "Sadashiiv, Halesh" <halesh dot sadashiv at ap dot sony dot com>
- Cc: libc-help at sourceware dot org
- Date: Mon, 14 Jul 2008 14:44:02 +0200
- Subject: Re: question about queue.h
- References: <7B7EF7F090B9804A830ACC82F2CDE95D3783E6@insardxms01.ap.sony.com>
- Reply-to: wharms at bfs dot de
Sadashiiv, Halesh wrote:
> hi list,
>
> i have a question about sys/queue.h (not a bug report).
>
>
>
> sys/queue.h provides macros for links lists. the code structure looks
> like this:
>
>
>
> #define LIST_ENTRY(type)
>
> struct {
> \
>
> struct type *le_next; /* next element */
> \
>
> struct type **le_prev; /* address of previous next element */
> \
>
> }
>
>
>
>
>
> ***Comment line itself says what it is,
>
> ***struct type **le_prev; /* address of previous next element */ \
>
>
>
> ***This variable will hold address previous next element, as next
> element is pointer, so previous next element is pointer to pointer.
>
>
>
>
>
> is there any (technical) reason why (struct type **) ?
>
>
>
> the author (?) provides also a second type that look like this:
>
> #define CIRCLEQ_ENTRY(type)
> \
>
> struct {
> \
>
> struct type *cqe_next; /* next element */
> \
>
> struct type *cqe_prev; /* previous element */
> \
>
> }
>
>
>
> *** Here its pointer to only previous element.
>
>
>
> *** check the comment line.
>
why should i need a 'previous next element' ? That is the current element. IMHO that is useless.
i guess: in the beginning that was a "typo" and somebody fixed the comment.
is a fix acceptable that changes that struct type **le_prev; to struct type *le_prev; ?
i did not see any documentation about this macros in the documentation for 2.7.
re,
wh