bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Node to first or last element of a sequential list in module list/xlist


From: Marc Nieper-Wißkirchen
Subject: Node to first or last element of a sequential list in module list/xlist
Date: Fri, 2 Apr 2021 17:52:22 +0200

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]