lkml.org 
[lkml]   [2002]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH][2.5] Single linked lists for Linux, overly complicated v2
Hi,

On Thu, 26 Sep 2002, Rik van Riel wrote:
> On Thu, 26 Sep 2002, Thunder from the hill wrote:
> In the case of slist_del() you HAVE to know it.
>
> Think about removing a single entry from the middle of
> the list ... the entries before and after need to stay
> on the list.

2 solutions without list head:

1.
#define slist_del_next(_entry_in) \
do { \
typeof(_entry_in) _entry = (_entry_in), \
_next = (_entry)->next; \
_entry->next = _next->next; \
_next->next = NULL; \
} while (0)

2. The previous entry points to the address that _entry has. If we
copy _entry somewhere else and overwrite the old _entry with
_entry->next, we made it without knowing the list topology. The
previous->next still points to the new _entry, things are fine.

My problem is just: where to put the old _entry? Anyway, since we're
talking about list entry deletion, we could copy it nowhere and just
overwrite it with _entry->next...

Details, details...

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/

\
 
 \ /
  Last update: 2005-03-22 13:29    [W:0.182 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site