]> granicus.if.org Git - check/commitdiff
* add prototypes for rpl_malloc and rpl_realloc
authorcpickett <cpickett@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Thu, 20 Mar 2008 23:19:16 +0000 (23:19 +0000)
committercpickett <cpickett@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Thu, 20 Mar 2008 23:19:16 +0000 (23:19 +0000)
* fix prototypes for malloc and realloc
* document AC_FUNC_MALLOC / AC_FUNC_REALLOC madness

git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@423 64e312b2-a51f-0410-8e61-82d0ca0eb02a

src/check.c

index 1f244f1e8e58459ac409a68e4a994d214ece25a2..526de36e060eb4a271069ab60e6e4e847eedd423 100644 (file)
@@ -55,8 +55,11 @@ static void tcase_free (TCase *tc);
 
 #include <sys/types.h>
 
-void *malloc ();
-void *realloc ();
+void *malloc (size_t n);
+void *realloc (void *p, size_t n);
+
+void *rpl_malloc (size_t n);
+void *rpl_realloc (void *p, size_t n);
 
 /* Allocate an N-byte block of memory from the heap. If N is zero,
    allocate a 1-byte block. */
@@ -68,7 +71,14 @@ rpl_malloc (size_t n)
   return malloc (n);
 } 
 
-/* configure defines realloc to rpl_realloc if realloc(0,0) is NULL */
+/* AC_FUNC_REALLOC in configure defines realloc to rpl_realloc if
+   realloc(0,0) is NULL to make it GNU compatible and always return a
+   valid pointer, same for AC_FUNC_MALLOC, malloc, and rpl_malloc.
+   rpl means `replacement'.
+
+   If this ever turns out to be a problem, it might be easiest to just
+   kill the configure macro calls.
+ */
 void *
 rpl_realloc (void *p, size_t n)
 {