#include "libbb.h"
-#ifndef DMALLOC
extern void *xmalloc(size_t size)
{
void *ptr = malloc(size);
if (ptr == NULL && size != 0)
- error_msg_and_die(memory_exhausted);
+ perror_msg_and_die("malloc");
return ptr;
}
{
ptr = realloc(ptr, size);
if (ptr == NULL && size != 0)
- error_msg_and_die(memory_exhausted);
+ perror_msg_and_die("realloc");
return ptr;
}
{
void *ptr = calloc(nmemb, size);
if (ptr == NULL && nmemb != 0 && size != 0)
- error_msg_and_die(memory_exhausted);
+ perror_msg_and_die("calloc");
return ptr;
}
t = strdup (s);
if (t == NULL)
- error_msg_and_die(memory_exhausted);
+ perror_msg_and_die("strdup");
return t;
}
-#endif
extern char * xstrndup (const char *s, int n) {
char *t;
error_msg_and_die("xstrndup bug");
t = xmalloc(++n);
-
+
return safe_strncpy(t,s,n);
}
return fp;
}
-/* Stupid gcc always includes its own builtin strlen()... */
-#undef strlen
-size_t xstrlen(const char *string)
-{
- return(strlen(string));
-}
-
/* END CODE */
/*
Local Variables: