[quagga-dev 1331] Re: ospfd dies -- bug in ospf_spf_consider_nexthop

Paul Jakma paul at clubi.ie
Thu Jul 1 15:41:44 BST 2004


On Thu, 1 Jul 2004, Andrew J. Schorr wrote:

>>
>>> #define LIST_LOOP(L,V,T,N) \
>>> for ((T) = (L)->head; (N) = (T)->next), (T != NULL); (T) = (N)) \
>>> if (((V) = (T)->data) != NULL)
>>
>> Urg, no go with that either, wont work. I cant think of a way to do
>> this.
>
> Why won't that work? It looks OK to me,

(N) = (T)->next), (T != NULL)

Will blow up once it gets to last T. T will be set NULL at end of 
last loop and it will then evaluate N=T->next.

What you want is something like:

for (this = list->head;
      ((this != NULL) ? next = this->next : next = this); this = next)

but conditionals are not allowed as lvalues, so its not possible.

> it just has the problem of being incompatible with the old macro 
> (requires an additional argument).

That is a trivial problem ;)

> I guess I'm missing something...
>
> -Andy

regards,
-- 
Paul Jakma	paul at clubi.ie	paul at jakma.org	Key ID: 64A2FF6A
 	warning: do not ever send email to spam at dishone.st
Fortune:
Writing is easy; all you do is sit staring at the blank sheet of paper until
drops of blood form on your forehead.
 		-- Gene Fowler



More information about the Quagga-dev mailing list