[PATCH 1/4] Add null-terminated list interface.
Peter Hutterer
peter.hutterer at who-t.net
Wed Aug 10 23:43:20 PDT 2011
On Wed, Aug 10, 2011 at 09:50:12PM -0700, Alan Coopersmith wrote:
> On 08/10/11 20:20, Peter Hutterer wrote:
> > +/**
> > + * Delete the entry from the list by iterating through the list and
> > + * removing any references from the list to the entry.
>
> Should that be "any reference" (no "s") since there can't be more than one?
> (You stop after finding the first one, which makes sense, since otherwise
> you've got a list that loops back on itself.)
>
> > + * Example:
> > + * struct foo *elem = <assing to right element>
>
> assign?
>
> > + * nt_list_del(elem, list, struct foo, next);
> > + *
> > + * @param entry The entry to delete from the list. entry is always
> > + * re-ininitialized as a null-terminated list.
>
> s/ininit/init/
ok, I admit it, those bits of documentation got squashed in just before the
mail, sorry. will proof-read next time.
> > +static void
> > +test_nt_list_append(void)
> > +{
> > + int i = 1;
> > + struct foo *foo = calloc(10, sizeof(struct foo));
> > + struct foo *item;
> > +
> > + for (item = foo, i = 1; i <= 10; i++, item++)
>
> You don't need to initialize i to 1 in both places do you?
>
> > +static void
> > +test_nt_list_insert(void)
> > +{
> > + int i = 1;
> > +
> > + for (item = &foo[1], i = 9; i > 0; i--, item++)
>
> Or here, where they're initialized to different values?
yeah, copy/paste error, will amend locally
>
> Other than those minor nits, looks good to me.
>
> Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
thanks.
Cheers,
Peter
More information about the xorg-devel
mailing list