[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Node to first or last element of a sequential list in module list/xl
From: |
Bruno Haible |
Subject: |
Re: Node to first or last element of a sequential list in module list/xlist |
Date: |
Sat, 03 Apr 2021 11:49:16 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-206-generic; KDE/5.18.0; x86_64; ; ) |
Marc Nieper-Wißkirchen wrote:
> > I don't understand. You want to use a list_node_t while adding nodes to
> > the list? This is invalid, since the comments in gl_list.h say:
> >
> > /* Type representing the position of an element in the list, in a way
> > that
> > is more adapted to the list implementation than a plain index.
> > Note: It is invalidated by insertions and removals! */
> > typedef struct gl_list_node_impl * gl_list_node_t;
> >
>
> It won't work with removals but it does work with insertions because
> gl_list_add_before/gl_list_add_after/... etc. all return new, valid list
> node objects.
While this may be true for the linked-list implementation, it is not true
for the array-list and other implementation. But the point of the Gnulib
list module is to allow the developer to switch to a different implementation
without changing their algorithms. [1]
Bruno
[1] https://savannah.gnu.org/forum/forum.php?forum_id=9898
- Node to first or last element of a sequential list in module list/xlist, Marc Nieper-Wißkirchen, 2021/04/02
- Re: Node to first or last element of a sequential list in module list/xlist, Bruno Haible, 2021/04/02
- Re: Node to first or last element of a sequential list in module list/xlist, Marc Nieper-Wißkirchen, 2021/04/03
- Re: Node to first or last element of a sequential list in module list/xlist,
Bruno Haible <=
- Re: Node to first or last element of a sequential list in module list/xlist, Marc Nieper-Wißkirchen, 2021/04/03
- Re: Node to first or last element of a sequential list in module list/xlist, Bruno Haible, 2021/04/03
- Re: Node to first or last element of a sequential list in module list/xlist, Marc Nieper-Wißkirchen, 2021/04/03
- Re: Node to first or last element of a sequential list in module list/xlist, Bruno Haible, 2021/04/03
- Re: Node to first or last element of a sequential list in module list/xlist, Marc Nieper-Wißkirchen, 2021/04/03
- Re: Node to first or last element of a sequential list in module list/xlist, Bruno Haible, 2021/04/03
- Message not available
- Re: Node to first or last element of a sequential list in module list/xlist, Bruno Haible, 2021/04/04
- Re: Node to first or last element of a sequential list in module list/xlist, Marc Nieper-Wißkirchen, 2021/04/05