This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/5223] tsearch returns node instead of key
- From: "alex at crivat dot eu" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Tue, 18 Sep 2018 03:55:31 +0000
- Subject: [Bug libc/5223] tsearch returns node instead of key
- Auto-submitted: auto-generated
- References: <bug-5223-131@http.sourceware.org/bugzilla/>
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.