From: Thunder from the hill <thunder@lightweight.ods.org>
To: Rik van Riel <riel@conectiva.com.br>
Cc: "Andreas Räcker" <patch@luckynet.dynu.com>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][2.5] Single linked lists for Linux, overly complicated v2
Date: Thu, 26 Sep 2002 12:26:40 -0600 (MDT) [thread overview]
Message-ID: <Pine.LNX.4.44.0209261213360.7827-100000@hawkeye.luckynet.adm> (raw)
In-Reply-To: <Pine.LNX.4.44L.0209261445450.1837-100000@duckman.distro.conectiva>
Hi,
On Thu, 26 Sep 2002, Rik van Riel wrote:
> INIT_SLIST_HEAD still has the old behaviour...
I'm now after both behaviors...
#define INIT_SLIST_HEAD(name) \
(name->next = NULL)
#define INIT_SLIST_LOOP(name) \
(name->next = name)
> > +#define slist_add_front(_new_in, _head_in) \
>
> > +#define slist_add(_new_in, _head_in) \
>
> These two seem to be exactly the same, surely you only need one ?
No, they're not.
(tab-width=8)
slist_add
|-------------------------------|
| head -> after |
| |
| new |
|-------------------------------| new->next = head->next
| head -> after |
| ^ |
| new |
|-------------------------------| head->next = new
| head -> new -> after |
|-------------------------------|
slist_add_front
|-------------------------------|
| head -> after |
| |
| new |
|-------------------------------| new->next = head
| new -> head -> after |
|-------------------------------| head = new
| head -> next -> after |
|-------------------------------|
(Just to have something drawn...)
> > +#define slist_del(_entry_in) \
>
> And what happens when you try to remove an entry from the middle
> of the list ?
Well, I can only try to preserve the pointer target, since I don't have a
previous entry. (Thus the overly complicated slist_del.)
> Also, how do you know which list the entry is removed from ?
It's the one which previously contained it...
I don't know whether I should like the list header aproach.
It's not bad for either circular lists or such which will have to be gone
through only once, as using slist_pop().
> Not having the head of the list in a known place (ie. a fixed
> list head) can make a list very hard to find.
But you see we have the problem that there is no such thing as a
predeclared structure for it. The only thing we can rely on is a chain of
structures which alltogether have a ->next field pointing to another
structure of presumably the same type.
> You forgot to rename this define.
Yes, I've forgotten two things there. They are fixed in my file, which I
won't post right now (in order not to pollute the list too much with
patches. It's that fix plus a forgotten _in.)
> > If you have any objections (apart from who I am), tell me
> ^^^^^^^^^^^^^^^^^^^
> I guess that's why we have whois ;)
Oh, that was just for Jes Soerensen, who kept asking.
Thunder
--
assert(typeof((fool)->next) == typeof(fool)); /* wrong */
next prev parent reply other threads:[~2002-09-26 18:20 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-26 17:41 [PATCH][2.5] Single linked lists for Linux, overly complicated v2 Lightweight Patch Manager
2002-09-26 17:53 ` Rik van Riel
2002-09-26 18:26 ` Thunder from the hill [this message]
[not found] <20020926142547.N13817@bitchcake.off.net>
2002-09-26 18:45 ` Thunder from the hill
2002-09-26 19:29 ` Rik van Riel
2002-09-26 19:43 ` Thunder from the hill
2002-09-26 20:00 ` Rik van Riel
2002-09-26 20:10 ` Thunder from the hill
2002-09-26 21:13 ` Thunder from the hill
2002-09-26 21:19 ` Thunder from the hill
2002-09-27 0:57 ` Zach Brown
2002-09-27 20:08 ` Thunder from the hill
2002-09-27 20:39 ` Zach Brown
2002-09-27 20:52 ` Thunder from the hill
2002-09-28 9:45 ` Thunder from the hill
2002-09-30 19:37 ` Daniel Phillips
2002-09-30 20:04 ` Zach Brown
[not found] ` <E17w7N8-0005px-00@starship>
2002-09-30 20:50 ` Zach Brown
2002-10-01 16:05 ` Daniel Phillips
2002-09-26 19:49 ` David B. Stevens
[not found] <924963807@toto.iv>
2002-09-27 3:56 ` Peter Chubb
2002-09-27 7:27 ` Arnaldo Carvalho de Melo
2002-09-27 14:56 ` Thunder from the hill
2002-09-30 19:48 ` Daniel Phillips
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=Pine.LNX.4.44.0209261213360.7827-100000@hawkeye.luckynet.adm \
--to=thunder@lightweight.ods.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patch@luckynet.dynu.com \
--cc=riel@conectiva.com.br \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).