update for HEAD-2003091401
[reactos.git] / lib / crtdll / search / lsearch.c
1 #include <msvcrt/search.h>
2 #include <msvcrt/stdlib.h>
3 #include <msvcrt/string.h>
4
5 /*
6  * @implemented
7  */
8 void *_lsearch(const void *key, void *base, size_t *nelp, size_t width,
9          int (*compar)(const void *, const void *))
10 {
11   void *ret_find = _lfind(key,base,nelp,width,compar);
12
13   if (ret_find != NULL)
14     return ret_find;
15
16 #ifdef __GNUC__
17   memcpy(base + (*nelp*width), key, width);
18 #else
19   memcpy((int*)base + (*nelp*width), key, width);
20 #endif
21   (*nelp)++;
22   return base;
23 }
24