6 void *malloc_nf_impl(size_t sz, const char *file, int line)
9 if(!(p = malloc(sz))) {
10 fprintf(stderr, "%s:%d failed to allocate %lu bytes\n", file, line, (unsigned long)sz);
16 void *calloc_nf_impl(size_t num, size_t sz, const char *file, int line)
19 if(!(p = calloc(num, sz))) {
20 fprintf(stderr, "%s:%d failed to allocate %lu bytes\n", file, line, (unsigned long)(sz * num));
26 void *realloc_nf_impl(void *p, size_t sz, const char *file, int line)
28 if(!(p = realloc(p, sz))) {
29 fprintf(stderr, "%s:%d failed to realloc %lu bytes\n", file, line, (unsigned long)sz);
35 char *strdup_nf_impl(const char *s, const char *file, int line)
38 if(!(res = strdup(s))) {
39 fprintf(stderr, "%s:%d failed to duplicate string\n", file, line);