Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-3]: src/lib/libc/stdlib Pull up revision 1.2 (requested by drochn...
details: https://anonhg.NetBSD.org/src/rev/5aee6e860f15
branches: netbsd-3
changeset: 576831:5aee6e860f15
user: tron <tron%NetBSD.org@localhost>
date: Thu Aug 04 17:34:59 2005 +0000
description:
Pull up revision 1.2 (requested by drochner in ticket #632):
The source array of lsearch() shouldn't be "const".
Being here, cleanup the const castaway stuff.
diffstat:
lib/libc/stdlib/lsearch.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diffs (54 lines):
diff -r a102d50faca2 -r 5aee6e860f15 lib/libc/stdlib/lsearch.c
--- a/lib/libc/stdlib/lsearch.c Thu Aug 04 17:33:23 2005 +0000
+++ b/lib/libc/stdlib/lsearch.c Thu Aug 04 17:34:59 2005 +0000
@@ -35,7 +35,7 @@
#if 0
static char sccsid[] = "@(#)lsearch.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: lsearch.c,v 1.4.2.2 2005/08/04 17:33:23 tron Exp $");
+__RCSID("$NetBSD: lsearch.c,v 1.4.2.3 2005/08/04 17:34:59 tron Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -47,12 +47,13 @@
#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 @@
_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 @@
_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;
Home |
Main Index |
Thread Index |
Old Index