This is an archive of the discontinued LLVM Phabricator instance.

[libc.search] [PATCH 6/6] add `hsearch(_r)`, `hdelete(_r_)` and `hcreate(_r)` implementation
Needs ReviewPublic

Authored by SchrodingerZhu on Oct 21 2022, 1:32 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

This patch adds hsearch(_r), hdelete(_r_) and hcreate(_r) to libc.
The underlying hashtable is swisstable, and the wyhash is the chosen hash function
for byte strings.

By now, the random seed of the hashtable is only utilizes limited random source.
This is because using system entropy pool can introduce other errors and
getrandom is not portable while hsearch is within the POSIX standard.

Diff Detail