Changeset View
Changeset View
Standalone View
Standalone View
libexec/rtld-elf/xmalloc.c
Show All 27 Lines | |||||
*/ | */ | ||||
#include <stddef.h> | #include <stddef.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
#include "rtld.h" | #include "rtld.h" | ||||
#include "rtld_printf.h" | #include "rtld_printf.h" | ||||
#include "rtld_malloc.h" | |||||
void * | void * | ||||
xcalloc(size_t number, size_t size) | xcalloc(size_t number, size_t size) | ||||
{ | { | ||||
void *p; | void *p; | ||||
p = calloc(number, size); | p = __crt_calloc(number, size); | ||||
if (p == NULL) { | if (p == NULL) { | ||||
rtld_fdputstr(STDERR_FILENO, "Out of memory\n"); | rtld_fdputstr(STDERR_FILENO, "Out of memory\n"); | ||||
_exit(1); | _exit(1); | ||||
} | } | ||||
return (p); | return (p); | ||||
} | } | ||||
void * | void * | ||||
xmalloc(size_t size) | xmalloc(size_t size) | ||||
{ | { | ||||
void *p = malloc(size); | |||||
void *p; | |||||
p = __crt_malloc(size); | |||||
if (p == NULL) { | if (p == NULL) { | ||||
rtld_fdputstr(STDERR_FILENO, "Out of memory\n"); | rtld_fdputstr(STDERR_FILENO, "Out of memory\n"); | ||||
_exit(1); | _exit(1); | ||||
} | } | ||||
return p; | return (p); | ||||
} | } | ||||
char * | char * | ||||
xstrdup(const char *str) | xstrdup(const char *str) | ||||
{ | { | ||||
char *copy; | char *copy; | ||||
size_t len; | size_t len; | ||||
Show All 33 Lines |