aboutsummaryrefslogtreecommitdiff
path: root/libiberty/bsearch.c
diff options
context:
space:
mode:
Diffstat (limited to 'libiberty/bsearch.c')
-rw-r--r--libiberty/bsearch.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/libiberty/bsearch.c b/libiberty/bsearch.c
index b3283f9..bb5555e 100644
--- a/libiberty/bsearch.c
+++ b/libiberty/bsearch.c
@@ -67,16 +67,13 @@ is respectively less than, matching, or greater than the array member.
* look at item 3.
*/
void *
-bsearch(key, base0, nmemb, size, compar)
- register void *key;
- void *base0;
- size_t nmemb;
- register size_t size;
- register int (*compar)();
+bsearch (register const void *key, const void *base0,
+ size_t nmemb, register size_t size,
+ register int (*compar)(const void *, const void *))
{
- register char *base = base0;
+ register const char *base = (const char *) base0;
register int lim, cmp;
- register void *p;
+ register const void *p;
for (lim = nmemb; lim != 0; lim >>= 1) {
p = base + (lim >> 1) * size;
@@ -84,7 +81,7 @@ bsearch(key, base0, nmemb, size, compar)
if (cmp == 0)
return (p);
if (cmp > 0) { /* key > p: move right */
- base = (char *)p + size;
+ base = (const char *)p + size;
lim--;
} /* else move left */
}