summaryrefslogtreecommitdiffstats
path: root/libc/misc/search/lsearch.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/search/lsearch.c')
-rw-r--r--libc/misc/search/lsearch.c50
1 files changed, 4 insertions, 46 deletions
diff --git a/libc/misc/search/lsearch.c b/libc/misc/search/lsearch.c
index 4071cf1ab..1e632975f 100644
--- a/libc/misc/search/lsearch.c
+++ b/libc/misc/search/lsearch.c
@@ -1,50 +1,8 @@
/*
- * This file lifted in toto from 'Dlibs' on the atari ST (RdeBath)
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
- *
- * Dale Schumacher 399 Beacon Ave.
- * (alias: Dalnefre') St. Paul, MN 55104
- * dal@syntel.UUCP United States of America
- * "It's not reality that's important, but how you perceive things."
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include <string.h>
-#include <stdio.h>
-#include <search.h>
-
-#ifdef L_lfind
-
-void attribute_hidden *__lfind(const void *key, const void *base, size_t *nmemb,
- size_t size, int (*compar)(const void *, const void *))
-{
- register int n = *nmemb;
-
- while (n--) {
- if ((*compar) (base, key) == 0)
- return ((void*)base);
- base += size;
- }
- return (NULL);
-}
-strong_alias(__lfind,lfind)
-
-#endif
-
-#ifdef L_lsearch
-
-extern void *__lfind (__const void *__key, __const void *__base,
- size_t *__nmemb, size_t __size, __compar_fn_t __compar) attribute_hidden;
-
-void *lsearch(const void *key, void *base, size_t *nmemb,
- size_t size, int (*compar)(const void *, const void *))
-{
- register char *p;
-
- if ((p = __lfind(key, base, nmemb, size, compar)) == NULL) {
- p = __memcpy((base + (size * (*nmemb))), key, size);
- ++(*nmemb);
- }
- return (p);
-}
-
-#endif
+#define L_lsearch
+#include "_lsearch.c"