[Bug libc/5223] tsearch returns node instead of key
alex at crivat dot eu
sourceware-bugzilla@sourceware.org
Tue Sep 18 03:55:00 GMT 2018
https://sourceware.org/bugzilla/show_bug.cgi?id=5223
Alex Crivat <alex at crivat dot eu> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |alex at crivat dot eu
--- Comment #2 from Alex Crivat <alex at crivat dot eu> ---
(In reply to Andreas Schwab from comment #1)
> It returns a pointer to the element (node), not the key (which is the first
> pointer in the node).
In this case shouldn't the documentation reflect this fact??
https://www.gnu.org/software/libc/manual/html_node/Tree-Search-Function.html
"The return value is a pointer to the matching element in the tree. If a new
element was created the pointer points to the new data (which is in fact key).
If an entry had to be created and the program ran out of space NULL is
returned."
If a new value is created tsearch returns a pointer to node_t which is a
structure internal to glibc.
This is not a proper interface.
Cheers,
Alex
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list