[PATCH:xlsfonts 2/3] inline Realloc() at the one place it's called
Alan Coopersmith
alan.coopersmith at oracle.com
Fri Jan 28 20:08:51 PST 2011
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
dsimple.c | 15 ---------------
dsimple.h | 1 -
xlsfonts.c | 5 +++--
3 files changed, 3 insertions(+), 18 deletions(-)
diff --git a/dsimple.c b/dsimple.c
index 3dbb180..6866afe 100644
--- a/dsimple.c
+++ b/dsimple.c
@@ -60,21 +60,6 @@ Display *dpy = NULL;
int screen = 0;
/*
- * Realloc: like realloc but handles out of memory using Fatal_Error.
- */
-char *
-Realloc(char *ptr, int size)
-{
- char *new_ptr;
-
- if (!(new_ptr = realloc(ptr, size)))
- Fatal_Error("Out of memory!");
-
- return(new_ptr);
-}
-
-
-/*
* Get_Display_Name (argc, argv) Look for -display, -d, or host:dpy (obselete)
* If found, remove it from command line. Don't go past a lone -.
*/
diff --git a/dsimple.h b/dsimple.h
index c1ccce6..6af16fd 100644
--- a/dsimple.h
+++ b/dsimple.h
@@ -58,7 +58,6 @@ extern int screen; /* The current screen */
/* Declarations for functions in dsimple.c */
-char *Realloc(char *, int);
void Setup_Display_And_Screen(int *, char **);
void Close_Display(void);
void usage(void);
diff --git a/xlsfonts.c b/xlsfonts.c
index aafca51..fbb9d9e 100644
--- a/xlsfonts.c
+++ b/xlsfonts.c
@@ -206,8 +206,9 @@ void get_list(char *pattern)
return;
}
- font_list = (FontList *)Realloc((char *)font_list,
- (font_cnt + available) * sizeof(FontList));
+ font_list = realloc(font_list, (font_cnt + available) * sizeof(FontList));
+ if (font_list == NULL)
+ Fatal_Error("Out of memory!");
for (i=0; i<available; i++) {
font_list[font_cnt].name = fonts[i];
if (long_list == L_MEDIUM)
--
1.7.3.2
More information about the xorg-devel
mailing list