bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* Node to first or last element of a sequential list in module list/xlist
@ 2021-04-02 15:52 Marc Nieper-Wißkirchen
  2021-04-02 22:49 ` Bruno Haible
  0 siblings, 1 reply; 12+ messages in thread
From: Marc Nieper-Wißkirchen @ 2021-04-02 15:52 UTC (permalink / raw)
  To: bug-gnulib

[-- Attachment #1: Type: text/plain, Size: 758 bytes --]

Hi!

At the moment, there does not seem to be an easy way to retrieve the node
of the first or the last element in a list.

This is useful if the list has to be traversed while nodes are added
because an iterator cannot be used here.

What is currently possible is to use get_first/set_first (and
get_last/set_last) to get hold of the first (and last) node but this is
clearly a hack.

Another way to get hold of the first node is to create an iterator and to
call its next procedure just once. But this is overkill if the iterator
isn't used afterward.

What I want to propose is to allow the NULL value in
gl_next_node/gl_previous_node. In this case, gl_next_node shall return the
first node and gl_previous_node shall return the last node.

Thanks,

Marc

[-- Attachment #2: Type: text/html, Size: 1810 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-04-05 10:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-02 15:52 Node to first or last element of a sequential list in module list/xlist Marc Nieper-Wißkirchen
2021-04-02 22:49 ` Bruno Haible
2021-04-03  7:03   ` Marc Nieper-Wißkirchen
2021-04-03  9:49     ` Bruno Haible
2021-04-03 10:00       ` Marc Nieper-Wißkirchen
2021-04-03 10:14         ` Bruno Haible
2021-04-03 10:26           ` Marc Nieper-Wißkirchen
2021-04-03 16:28             ` Bruno Haible
2021-04-03 16:46               ` Marc Nieper-Wißkirchen
2021-04-03 16:55                 ` Bruno Haible
     [not found]               ` <CAEYrNrTatLc1QcBPzhbs9b64Dv5P5J7HuR+Tj8o6QKh91u1jZw@mail.gmail.com>
2021-04-04 23:30                 ` Bruno Haible
2021-04-05 10:20                   ` Marc Nieper-Wißkirchen

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 read-only IMAP folder(s) and NNTP newsgroup(s).