- Don't rely on the default calling convention being cdecl for function pointers
[reactos.git] / reactos / lib / sdk / crt / search / lsearch.c
1 #include <stdlib.h>
2 #include <string.h>
3 #include <search.h>
4
5 /*
6 * @implemented
7 */
8 void *_lsearch(const void *key, void *base, unsigned int *nelp, unsigned int width,
9 int (__cdecl *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 memcpy((void*)((int*)base + (*nelp*width)), key, width);
17
18 (*nelp)++;
19 return base;
20 }
21
22