aboutsummaryrefslogtreecommitdiff
path: root/libiberty/bsearch.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2005-03-27 05:28:42 +0000
committerDJ Delorie <dj@redhat.com>2005-03-27 05:28:42 +0000
commit9334f9c6cd576128ec4fc891b5fcf267a7fca7fb (patch)
treefda195cba89e4178623ea39866f41e6e28eb67c1 /libiberty/bsearch.c
parent8da8e0b3f397df66d6e1c03470f4e6c31a63d292 (diff)
downloadgdb-9334f9c6cd576128ec4fc891b5fcf267a7fca7fb.zip
gdb-9334f9c6cd576128ec4fc891b5fcf267a7fca7fb.tar.gz
gdb-9334f9c6cd576128ec4fc891b5fcf267a7fca7fb.tar.bz2
merge from gcc
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 */
}