[libc-commits] [PATCH] D136492: [libc.search] [PATCH 6/6] add `hsearch(_r)`, `hdelete(_r_)` and `hcreate(_r)` implementation

Schrodinger ZHU Yifan via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Oct 21 13:32:42 PDT 2022


SchrodingerZhu created this revision.
Herald added projects: libc-project, All.
Herald added a subscriber: libc-commits.
SchrodingerZhu requested review of this revision.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136492

Files:
  libc/config/linux/x86_64/entrypoints.txt
  libc/src/CMakeLists.txt
  libc/src/search/CMakeLists.txt
  libc/src/search/hashtable/CMakeLists.txt
  libc/src/search/hashtable/global.cpp
  libc/src/search/hashtable/global.h
  libc/src/search/hashtable/search_impl.h
  libc/src/search/hashtable/utils.h
  libc/src/search/hcreate.cpp
  libc/src/search/hcreate.h
  libc/src/search/hcreate_r.cpp
  libc/src/search/hcreate_r.h
  libc/src/search/hdestroy.cpp
  libc/src/search/hdestroy.h
  libc/src/search/hdestroy_r.cpp
  libc/src/search/hdestroy_r.h
  libc/src/search/hsearch.cpp
  libc/src/search/hsearch.h
  libc/src/search/hsearch_r.cpp
  libc/src/search/hsearch_r.h
  libc/test/src/CMakeLists.txt
  libc/test/src/search/CMakeLists.txt
  libc/test/src/search/hsearch_test.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136492.469752.patch
Type: text/x-patch
Size: 24415 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20221021/384268ae/attachment-0001.bin>


More information about the libc-commits mailing list