mirror of
https://code.videolan.org/videolan/vlc
synced 2024-07-25 09:41:30 +02:00
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;
|
|
}
|