diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2020-06-23 17:03:03 +0100 |
---|---|---|
committer | Jose E. Marchesi <jose.marchesi@oracle.com> | 2020-06-23 18:39:38 +0200 |
commit | aec24341d0aac1ca57031d066503c420fb850023 (patch) | |
tree | 4eeb94bd058b421c5708e22f2b53eafc65a3c004 /include | |
parent | 855bb998c937d4b1c86a394daea8844fe87eb387 (diff) | |
download | gcc-aec24341d0aac1ca57031d066503c420fb850023.zip gcc-aec24341d0aac1ca57031d066503c420fb850023.tar.gz gcc-aec24341d0aac1ca57031d066503c420fb850023.tar.bz2 |
libiberty, include: add bsearch_r
libctf wants a bsearch that takes a void * arg pointer to avoid a
nonportable use of __thread.
bsearch_r is required, not optional, at this point because as far as I
can see this obvious-sounding function is not implemented by anyone's
libc. We can easily move it to AC_LIBOBJ later if it proves necessary
to do so.
include/
* libiberty.h (bsearch_r): New.
libiberty/
* bsearch_r.c: New file.
* Makefile.in (CFILES): Add bsearch_r.c.
(REQUIRED_OFILES): Add bsearch_r.o.
* functions.texi: Regenerate.
Diffstat (limited to 'include')
-rw-r--r-- | include/libiberty.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/libiberty.h b/include/libiberty.h index 141cb88..0bb5b81 100644 --- a/include/libiberty.h +++ b/include/libiberty.h @@ -641,6 +641,13 @@ extern int pexecute (const char *, char * const *, const char *, extern int pwait (int, int *, int); +/* Like bsearch, but takes and passes on an argument like qsort_r. */ + +extern void *bsearch_r (register const void *, const void *, + size_t, register size_t, + register int (*)(const void *, const void *, void *), + void *); + #if defined(HAVE_DECL_ASPRINTF) && !HAVE_DECL_ASPRINTF /* Like sprintf but provides a pointer to malloc'd storage, which must be freed by the caller. */ |