0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-05-10 02:15:29 +00:00
Files
termux-packages/x11-packages/foot/reallocarray.c
2025-03-18 00:53:07 +05:30

16 lines
323 B
C

#if defined __ANDROID__ && __ANDROID_API__ < 29
#include <stdlib.h>
#include <errno.h>
static void *
reallocarray(void *ptr, size_t nmemb, size_t size)
{
size_t res;
if (__builtin_mul_overflow(nmemb, size, &res)) {
errno = ENOMEM;
return NULL;
}
return realloc(ptr, nmemb * size);
}
#endif