Since stdlib.h versions return void *, remove unneeded casts that
the wrappers needed.

Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com>
---
 dsimple.c |   24 ------------------------
 dsimple.h |    2 --
 xprop.c   |   26 +++++++++++++++++++-------
 3 files changed, 19 insertions(+), 33 deletions(-)

diff --git a/dsimple.c b/dsimple.c
index 7c4b064..c052af4 100644
--- a/dsimple.c
+++ b/dsimple.c
@@ -59,30 +59,6 @@ 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 realloc but handles out of memory using Fatal_Error:
- */
-char *Realloc(char *mem, unsigned size)
-{
-    if (!(mem = realloc (mem, size)))
-       Fatal_Error("Out of memory!");
-
-    return mem;
-}
-
-/*
  * 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 7c02644..b9e9a66 100644
--- a/dsimple.h
+++ b/dsimple.h
@@ -56,8 +56,6 @@ extern int screen;                           /* The current 
screen */
 
     /* Declarations for functions in just_display.c */
 
-char *Malloc(unsigned);
-char *Realloc(char *,unsigned);
 char *Get_Display_Name(int *, char **);
 Display *Open_Display(const char *);
 void Setup_Display_And_Screen(int *, char **);
diff --git a/xprop.c b/xprop.c
index e7e2838..1f076fc 100644
--- a/xprop.c
+++ b/xprop.c
@@ -86,7 +86,9 @@ Create_Thunk_List (void)
 {
     thunk *tptr;
 
-    tptr = (thunk *) Malloc(sizeof(thunk));
+    tptr = malloc(sizeof(thunk));
+    if (!tptr)
+       Fatal_Error("Out of memory!");
 
     tptr->thunk_count = 0;
 
@@ -108,7 +110,7 @@ Add_Thunk (thunk *list, thunk t)
 
     i = list->thunk_count;
 
-    list = (thunk *) realloc(list, (i+1)*sizeof(thunk));
+    list = realloc(list, (i+1)*sizeof(thunk));
     if (!list)
        Fatal_Error("Out of memory!");
 
@@ -130,7 +132,9 @@ Copy_String (const char *string)
 
     length = strlen(string) + 1;
 
-    new = (char *) Malloc(length);
+    new = malloc(length);
+    if (!new)
+       Fatal_Error("Out of memory!");
     memcpy(new, string, length);
 
     return new;
@@ -736,7 +740,9 @@ Format_Len_String (const char *string, int len)
     char *data;
     const char *result;
 
-    data = (char *) Malloc(len+1);
+    data = malloc(len+1);
+    if (!data)
+       Fatal_Error("Out of memory!");
 
     memcpy(data, string, len);
     data[len] = '\0';
@@ -782,7 +788,9 @@ Format_Icons (const unsigned long *icon, int len)
        alloced += 80;                          /* For the header */
        alloced += (width*4 + 8) * height;      /* For the rows (plus padding) 
*/
        
-       result = Realloc (result, alloced);
+       result = realloc (result, alloced);
+       if (!result)
+           Fatal_Error("Out of memory!");
        tail = &result[offset];
 
        if (end - icon < width * height)
@@ -1006,7 +1014,9 @@ Format_Len_Unicode (const char *string, int len)
 
        result = Format_Len_String(string, len);
        len2 = strlen(result);
-       data = (char *) Malloc(len2+1);
+       data = malloc(len2+1);
+       if (!data)
+           Fatal_Error("Out of memory!");
        memcpy(data, result, len2+1);
 
        memcpy(_formatting_buffer, error, strlen(error)+1);
@@ -1019,7 +1029,9 @@ Format_Len_Unicode (const char *string, int len)
     if (!is_utf8_locale())
        return Format_Len_String(string, len);
 
-    data = (char *) Malloc(len+1);
+    data = malloc(len+1);
+    if (!data)
+       Fatal_Error("Out of memory!");
 
     memcpy(data, string, len);
     data[len] = '\0';
-- 
1.7.3.2

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to