Re: [PATCH][2.5] Single linked lists for Linux

Thunder from the hill (thunder@lightweight.ods.org)
Thu, 26 Sep 2002 00:42:11 -0600 (MDT)


Hi,

On Thu, 26 Sep 2002, Peter Chubb wrote:
> +/**
> + * slist_del - remove an entry from list
> + * @head: head to remove it from
> + * @entry: entry to be removed
> + */
> +#define slist_del(_head, _entry) \
> +do { \
> + (_head)->next = (_entry)->next; \
> + (_entry)->next = NULL; \
> +}

What about

#define slist_del(_head) \
do { \
typeof(_head) _entry = (_head)->next; \
(_head)->next = _entry->next; \
_entry->next = NULL; \
} while (0)

> static inline int slist_del(struct slist *head, struct slist *entry)

I don't want to inline (just like once, with list.h) because I want any
type to match here...

Thunder

-- 
assert(typeof((fool)->next) == typeof(fool));	/* wrong */

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/