From 2ab428f6a8966d90ac97ce0ce0c7d73b82fade8f Mon Sep 17 00:00:00 2001 From: Davidlohr Bueso Date: Wed, 27 Oct 2010 06:14:46 -0300 Subject: sys-utils: make use xalloc wrappers Signed-off-by: Davidlohr Bueso --- sys-utils/readprofile.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'sys-utils/readprofile.c') diff --git a/sys-utils/readprofile.c b/sys-utils/readprofile.c index 52f5d8c94..91ff32951 100644 --- a/sys-utils/readprofile.c +++ b/sys-utils/readprofile.c @@ -49,6 +49,8 @@ #include #include #include + +#include "xalloc.h" #include "nls.h" #define S_LEN 128 @@ -60,22 +62,6 @@ static char defaultmap[]="/boot/System.map"; static char defaultpro[]="/proc/profile"; static char optstring[]="M:m:np:itvarVbs"; -static void * -xmalloc (size_t size) { - void *t; - - if (size == 0) - return NULL; - - t = malloc (size); - if (t == NULL) { - fprintf(stderr, _("out of memory")); - exit(1); - } - - return t; -} - static FILE * myopen(char *name, char *mode, int *flag) { int len = strlen(name); @@ -242,10 +228,7 @@ main(int argc, char **argv) { exit(1); } - if (!(buf=malloc(len))) { - fprintf(stderr,"%s: malloc(): %s\n", prgname, strerror(errno)); - exit(1); - } + buf = xmalloc(len); if (read(proFd,buf,len) != len) { fprintf(stderr,"%s: %s: %s\n",prgname,proFile,strerror(errno)); -- cgit v1.2.3-55-g7522