utils: remove unused recalloc and related macros
authorRan Benita <ran234@gmail.com>
Wed, 6 Jun 2012 07:44:22 +0000 (10:44 +0300)
committerRan Benita <ran234@gmail.com>
Sat, 9 Jun 2012 10:21:21 +0000 (13:21 +0300)
Their use is superseded by darray everywhere now.

Signed-off-by: Ran Benita <ran234@gmail.com>
src/utils.c
src/utils.h

index fcdc75d..57b4905 100644 (file)
 
 #include "utils.h"
 
-void *
-recalloc(void *ptr, size_t old_size, size_t new_size)
-{
-    char *rtrn;
-
-    if (ptr == NULL)
-        return calloc(1, new_size);
-
-    rtrn = realloc(ptr, new_size);
-    if (rtrn && new_size > old_size)
-        memset(&rtrn[old_size], 0, new_size - old_size);
-
-    return rtrn;
-}
-
 static FILE *errorFile = NULL;
 static int outCount = 0;
 static char *preMsg = NULL;
index 7239d6c..27d74fd 100644 (file)
@@ -35,9 +35,6 @@
 
 #include <X11/Xfuncproto.h>
 
-extern void *
-recalloc(void *ptr, size_t old_size, size_t new_size);
-
 /*
  * We sometimes malloc strings and then expose them as const char*'s. This
  * macro is used when we free these strings in order to avoid -Wcast-qual
@@ -47,8 +44,6 @@ recalloc(void *ptr, size_t old_size, size_t new_size);
 
 #define uTypedAlloc(t)              ((t*)malloc(sizeof(t)))
 #define uTypedCalloc(n, t)          ((t*)calloc((n), sizeof(t)))
-#define uTypedRealloc(pO, n, t)     ((t*)realloc((pO), (n) * sizeof(t)))
-#define uTypedRecalloc(pO, o, n, t) ((t*)recalloc((pO), (o) * sizeof(t), (n) * sizeof(t)))
 
 #define uDupString(s)          ((s) ? strdup(s) : NULL)
 #define uStringText(s)         ((s) == NULL ? "<NullString>" : (s))