From d1dbba01539a89e1d56ca261e18ae2e31f075cfe Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 28 Jan 2011 19:57:52 -0800 Subject: Remove unneeded Malloc function The only place it was called was in Realloc, if the initial pointer was NULL, but ANSI C89 already guarantees realloc(NULL, size) will be handled as malloc(size), so we don't need to handle that case ourselves. Signed-off-by: Alan Coopersmith Reviewed-by: Julien Cristau --- dsimple.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'dsimple.c') diff --git a/dsimple.c b/dsimple.c index 744a3d6..3dbb180 100644 --- a/dsimple.c +++ b/dsimple.c @@ -60,31 +60,13 @@ Display *dpy = NULL; int screen = 0; /* - * Malloc: like malloc but handles out of memory using Fatal_Error. - */ -char * -Malloc(unsigned size) -{ - char *data; - - if (!(data = malloc(size))) - Fatal_Error("Out of memory!"); - - return(data); -} - - -/* - * Realloc: like Malloc except for realloc, handles NULL using Malloc. + * Realloc: like realloc but handles out of memory using Fatal_Error. */ char * Realloc(char *ptr, int size) { char *new_ptr; - if (!ptr) - return(Malloc(size)); - if (!(new_ptr = realloc(ptr, size))) Fatal_Error("Out of memory!"); -- cgit v1.2.3