]> git.proxmox.com Git - wasi-libc.git/blob - libc-bottom-half/sources/reallocarray.c
Enable support for `utimes` and `futimesat`.
[wasi-libc.git] / libc-bottom-half / sources / reallocarray.c
1 #include <stdlib.h>
2 #include <errno.h>
3
4 void *__reallocarray(void *ptr, size_t nmemb, size_t size) {
5 size_t bytes;
6 if (__builtin_umull_overflow(nmemb, size, &bytes)) {
7 errno = ENOMEM;
8 return NULL;
9 }
10 return realloc(ptr, bytes);
11 }
12
13 void *reallocarray(void *ptr, size_t nmemb, size_t size)
14 __attribute__((__weak__, __alias__("__reallocarray")));