vlc/compat/lfind.c
Alexandre Janniaux a2e2cf0ab0 compat: lfind: fix warnings
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
2020-02-20 10:02:47 +01:00

20 lines
556 B
C

/*****************************************************************************
* lfind.c : implement lfind
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
void *lfind(const void *key, const void *base, size_t *nmemb,
size_t size, int(*cmp)(const void *, const void *))
{
for (size_t i = 0; i < *nmemb; ++i)
{
const void *elem = (const char*)base + i * size;
if (!cmp(key, elem))
return (void*)elem;
}
return NULL;
}