linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikita Danilov <Nikita@Namesys.COM>
To: Lightweight Patch Manager <patch@luckynet.dynu.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Rik van Riel <riel@connectiva.com.br>
Subject: Re: [PATCH][2.5] Single linked lists for Linux, overly complicated but working
Date: Thu, 26 Sep 2002 20:13:16 +0400	[thread overview]
Message-ID: <15763.12828.613912.98830@laputa.namesys.com> (raw)
In-Reply-To: <20020926160028.C221C3@hawkeye.luckynet.adm>

Lightweight Patch Manager writes:
 > This is an overly complicated version,  I guess I'll have a better one
 > once I've got my noodles in. Wait an hour, I'll be back.
 > 
 > And BTW, I got the luckynet address fixed, you can send me again...
 > 
 > --- /dev/null	Wed Dec 31 17:00:00 1969
 > +++ slist-2.5/include/linux/slist.h	Thu Sep 26 09:57:25 2002
 > @@ -0,0 +1,139 @@
 > +#ifdef __KERNEL__
 > +#ifndef _LINUX_SLIST_H
 > +#define _LINUX_SLIST_H
 > +
 > +#include <asm/processor.h>
 > +
 > +/*
 > + * Type-safe single linked list helper-functions.
 > + * (originally taken from list.h)
 > + *
 > + * Thomas 'Dent' Mirlacher, Daniel Phillips,
 > + * Andreas Bogk, Thunder from the hill
 > + */
 > +
 > +#define INIT_SLIST_HEAD(name)			\
 > +	(name->next = name)
 > +
 > +#define SLIST_HEAD_INIT(name)			\
 > +	name
 > +
 > +#define SLIST_HEAD(type,name)			\
 > +	typeof(type) name = INIT_SLIST_HEAD(name)
 > +
 > +/**
 > + * slist_add_front - add a new entry at the first slot, moving the old head
 > + *		     to the second slot
 > + * @new:	new entry to be added
 > + * @head:	head of the single linked list
 > + *
 > + * Insert a new entry before the specified head.
 > + * This is good for implementing stacks.
 > + */
 > +
 > +#define slist_add_front(_new, _head)		\
 > +do {						\
 > +	(_new)->next = (_head);			\
 > +	(_head) = (_new);			\
 > +} while (0)

Can these macros be updated to only evaluate their arguments once? By
use of "typeof" maybe? Otherwise, slist_add_front(foo++, bar()) is going
to lead to strange things.

 > +
 > +/**
 > + * slist_add - add a new entry

[...]

Nikita.

      reply	other threads:[~2002-09-26 16:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-26 16:00 Lightweight Patch Manager
2002-09-26 16:13 ` Nikita Danilov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15763.12828.613912.98830@laputa.namesys.com \
    --to=nikita@namesys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patch@luckynet.dynu.com \
    --cc=riel@connectiva.com.br \
    --subject='Re: [PATCH][2.5] Single linked lists for Linux, overly complicated but working' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).