This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: question about queue.h



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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]