1
0
mirror of https://github.com/termux/termux-packages synced 2024-06-16 21:47:05 +00:00
termux-packages/x11-packages/kitty/reallocarray.c
2022-11-08 10:35:46 +00:00

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