[PATCH 1/4] Add null-terminated list interface.

Alan Coopersmith alan.coopersmith at oracle.com
Wed Aug 10 21:50:12 PDT 2011


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/

> +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?

Other than those minor nits, looks good to me.

Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>


-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list