"Vic Abell" <[EMAIL PROTECTED]> wrote:
> >   *last = t;
> >   last = &t->next
> 
> If t == NULL, won't &t->next attempt to de-reference a
> NULL pointer?

  Yes, but I didn't show all of the code I commited.

  Check the CVS version of files.c

> Isn't last (currently) supposed to point to the end
> of the chain whose head is contained in pl?

  Yes, it does, by design.  'last = &pl' means that it points to the
"end" of the chain, when 'pl == NULL'

  When it's updated, and one new entry is added, we do:

  *last = new_entry
  last = &(new_entry->next)

  And we never need to touch 'pl' again.

>  I thought last was used to help extend pl's chain.  I don't see how
> the chain whose pointer is returned in t is linked to the end of
> pl's chain via last->next.

  Because it never looks at 'last->next'.  last is a ptr to a ptr, not
a ptr.

> Perhaps I'm not seeing the full context of your change.

  Go read the code.

  Alan DeKok.

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to