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