summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
diff options
context:
space:
mode:
authordrochner <drochner@NetBSD.org>2005-07-06 15:47:15 +0000
committerdrochner <drochner@NetBSD.org>2005-07-06 15:47:15 +0000
commitecef4b3d3fa59bb227afd61c2a839bf118fcb5de (patch)
treefbcb968e306e992f7b309ee39ef7f4d1948dc0ac /lib/libc/stdlib
parente866f2794bb798fa732f329e49161d9c83446011 (diff)
The source array of lsearch() shouldn't be "const".
Being here, cleanup the const castaway stuff.
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r--lib/libc/stdlib/lsearch.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libc/stdlib/lsearch.c b/lib/libc/stdlib/lsearch.c
index b895056e8f2..063d47e98af 100644
--- a/lib/libc/stdlib/lsearch.c
+++ b/lib/libc/stdlib/lsearch.c
@@ -35,7 +35,7 @@
#if 0
static char sccsid[] = "@(#)lsearch.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: lsearch.c,v 1.1 2005/07/06 14:43:24 drochner Exp $");
+__RCSID("$NetBSD: lsearch.c,v 1.2 2005/07/06 15:47:15 drochner Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -47,12 +47,13 @@ __RCSID("$NetBSD: lsearch.c,v 1.1 2005/07/06 14:43:24 drochner Exp $");
#include <search.h>
typedef int (*cmp_fn_t) __P((const void *, const void *));
-static void *linear_base __P((const void *, const void *, size_t *, size_t,
+static void *linear_base __P((const void *, void *, size_t *, size_t,
cmp_fn_t, int));
void *
lsearch(key, base, nelp, width, compar)
- const void *key, *base;
+ const void *key;
+ void *base;
size_t *nelp, width;
cmp_fn_t compar;
{
@@ -75,12 +76,13 @@ lfind(key, base, nelp, width, compar)
_DIAGASSERT(base != NULL);
_DIAGASSERT(compar != NULL);
- return(linear_base(key, base, nelp, width, compar, 0));
+ return(linear_base(key, __UNCONST(base), nelp, width, compar, 0));
}
static void *
linear_base(key, base, nelp, width, compar, add_flag)
- const void *key, *base;
+ const void *key;
+ void *base;
size_t *nelp, width;
cmp_fn_t compar;
int add_flag;
@@ -91,9 +93,7 @@ linear_base(key, base, nelp, width, compar, add_flag)
_DIAGASSERT(base != NULL);
_DIAGASSERT(compar != NULL);
- /* LINTED const castaway */
end = (char *)base + *nelp * width;
- /* LINTED const castaway */
for (element = (char *)base; element < end; element += width)
if (!compar(element, key)) /* key found */
return element;