diff options
author | Scott Soule Cheloha <cheloha@cvs.openbsd.org> | 2021-12-08 22:06:29 +0000 |
---|---|---|
committer | Scott Soule Cheloha <cheloha@cvs.openbsd.org> | 2021-12-08 22:06:29 +0000 |
commit | b6288ade839f9de0cd569d091510068f0e78bb51 (patch) | |
tree | 1d3c5df431b162298feb34ef2b6b1bbbe334cb2b /usr.bin/true | |
parent | 26ded6b71c98a0c1f740fa6c91f43c9704dc7347 (diff) |
lsearch(3): reimplement using lfind(3)
lsearch(3) is really just lfind(3) with an additional branch to append
the key if lfind(3) fails. If we get rid of the underlying
linear_base() function and move the search portion into lfind(3) and
the key-copying portion into lsearch(3) we get smaller and simpler
code.
Misc. notes:
- We do not need to keep the historical comment about errno. lsearch(3)
is pure computation and does not set errno. That's really all you
need to know. The specification reserves no errors, either.
- We are using lfind(3) internally now, so it switches from
PROTO_DEPRECATED to PROTO_NORMAL in hidden/search.h and needs
DEF_WEAK in stdlib/lsearch.c.
With advice from guenther@ on symbol housekeeping in libc.
Thread: https://marc.info/?l=openbsd-tech&m=163885187632449&w=2
ok millert@
Diffstat (limited to 'usr.bin/true')
0 files changed, 0 insertions, 0 deletions