summaryrefslogtreecommitdiff
path: root/libc/misc/search/lsearch.c
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2005-12-08 14:44:48 +0000
committerPeter S. Mazinger <ps.m@gmx.net>2005-12-08 14:44:48 +0000
commit960acb5e3248b2ba657f65ea011703c57539c5a8 (patch)
tree4a3b0d42a1b25c614074f4b7635aa15e9abefba6 /libc/misc/search/lsearch.c
parentc6023f4908ee819063fdbbd5d51a5a51548ed573 (diff)
Implement __tfind/__lfind and use them
Diffstat (limited to 'libc/misc/search/lsearch.c')
-rw-r--r--libc/misc/search/lsearch.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libc/misc/search/lsearch.c b/libc/misc/search/lsearch.c
index 4bc45ca36..4071cf1ab 100644
--- a/libc/misc/search/lsearch.c
+++ b/libc/misc/search/lsearch.c
@@ -14,7 +14,7 @@
#ifdef L_lfind
-void *lfind(const void *key, const void *base, size_t *nmemb,
+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;
@@ -26,17 +26,21 @@ void *lfind(const void *key, const void *base, size_t *nmemb,
}
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) {
+ if ((p = __lfind(key, base, nmemb, size, compar)) == NULL) {
p = __memcpy((base + (size * (*nmemb))), key, size);
++(*nmemb);
}