45 #include <sys/types.h> 64 fprintf(stderr,
"WALLOC: failed to malloc %zu bytes\n",size);
84 p = realloc(ptr, size);
86 if ((p ==
NULL) && (size != 0))
88 fprintf(stderr,
"WREALLOC: failed to malloc %zu bytes\n",size);
102 if (num == 0 || size == 0) {
105 p = calloc(num, size);
110 fprintf(stderr,
"WCALLOC: failed to calloc %zu elements of %zu bytes each\n",num, size);
119 size_t strsize=strlen(s);
120 if (strsize < SIZE_MAX) {
123 fprintf(stderr,
"String is not null terminated! (too long)\n");
127 memcpy(t, s, strsize);
char * wstrdup(const char *s)
void * safe_walloc(size_t size)
void * safe_wrealloc(void *ptr, size_t size)
void * safe_wcalloc(size_t num, size_t size)