[PATCH:xlsfonts 1/3] Remove unneeded Malloc function
Alan Coopersmith
alan.coopersmith at oracle.com
Fri Jan 28 20:08:50 PST 2011
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 <alan.coopersmith at oracle.com>
---
dsimple.c | 20 +-------------------
dsimple.h | 1 -
2 files changed, 1 insertions(+), 20 deletions(-)
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!");
diff --git a/dsimple.h b/dsimple.h
index e49837c..c1ccce6 100644
--- a/dsimple.h
+++ b/dsimple.h
@@ -58,7 +58,6 @@ extern int screen; /* The current screen */
/* Declarations for functions in dsimple.c */
-char *Malloc(unsigned);
char *Realloc(char *, int);
void Setup_Display_And_Screen(int *, char **);
void Close_Display(void);
--
1.7.3.2
More information about the xorg-devel
mailing list