mirror of
https://github.com/videolan/vlc.git
synced 2024-12-13 19:54:18 +08:00
a2e2cf0ab0
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
20 lines
556 B
C
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;
|
|
}
|