mirror of
https://github.com/termux/termux-packages.git
synced 2024-11-23 14:56:16 +00:00
16 lines
323 B
C
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
|