]> granicus.if.org Git - check/commitdiff
* add libcompat.h with prototypes for libcompat functions
authorcpickett <cpickett@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Sun, 28 Dec 2008 20:47:06 +0000 (20:47 +0000)
committercpickett <cpickett@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Sun, 28 Dec 2008 20:47:06 +0000 (20:47 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@466 64e312b2-a51f-0410-8e61-82d0ca0eb02a

lib/Makefile.am
lib/libcompat.h [new file with mode: 0644]
lib/malloc.c
lib/realloc.c
lib/sleep.c
lib/strsignal.c
src/check_run.c

index af5113eced9e09a8454d88a9ee1a513393336b79..7d2925693b675e9d033821d9fe3dc08baeec5122 100644 (file)
@@ -1,5 +1,5 @@
 ## Process this file with automake to produce Makefile.in
 
 noinst_LTLIBRARIES = libcompat.la
-libcompat_la_SOURCES = libcompat.c
+libcompat_la_SOURCES = libcompat.c libcompat.h
 libcompat_la_LIBADD = $(LTLIBOBJS) $(LTALLOCA)
diff --git a/lib/libcompat.h b/lib/libcompat.h
new file mode 100644 (file)
index 0000000..13b9e9f
--- /dev/null
@@ -0,0 +1,22 @@
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/* defines size_t */
+#include <sys/types.h>
+
+#if !HAVE_MALLOC
+void *rpl_malloc (size_t n)
+#endif /* !HAVE_MALLOC */
+
+#if !HAVE_REALLOC
+void *rpl_realloc (void *p, size_t n)
+#endif /* !HAVE_REALLOC */
+
+#if !HAVE_SLEEP
+unsigned int sleep (unsigned int seconds);
+#endif /* !HAVE_SLEEP */
+
+#if !HAVE_STRSIGNAL
+static const char *strsignal(int sig);
+#endif /* !HAVE_STRSIGNAL */
index 1996e0f136a309452a37bab826c32eda77eed73f..9cc09dd60e4178601a5455f39ebd177fbf8e5669 100644 (file)
@@ -3,10 +3,14 @@
 #if HAVE_CONFIG_H
 #include <config.h>
 #endif
+
+/* malloc has been defined to rpl_malloc, so first undo that */
 #undef malloc
 
+/* defines size_t */
 #include <sys/types.h>
 
+/* this gives us the real malloc to use below */
 void *malloc (size_t n);
 
 /* force malloc(0) to return a valid pointer */
index d6f02e5e6da22b184575e9c257a4c91ae3934faa..e1579420f48552c2072ecbc2f0fd32cbf25560f3 100644 (file)
@@ -3,13 +3,17 @@
 #if HAVE_CONFIG_H
 #include <config.h>
 #endif
+
+/* realloc has been defined to rpl_realloc, so first undo that */
 #undef realloc
      
+/* defines size_t */
 #include <sys/types.h>
      
+/* this gives us the real realloc to use below */
 void *realloc (void *p, size_t n);
      
-/* force realloc(p, 0) to return a valid pointer */
+/* force realloc(p, 0) and realloc (NULL, n) to return a valid pointer */
 void *
 rpl_realloc (void *p, size_t n)
 {
index e8ee839ba0b441b9deb242a8431707e21f526728..45f6421143f3a9571e9b30d210d4a844be6a2667 100644 (file)
@@ -1,14 +1,4 @@
 /* This file gets included if AC_REPLACE_FUNCS([sleep]) cannot find the function. */
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-
-#if !HAVE_SLEEP
-unsigned int sleep (unsigned int seconds);
-#endif /* !HAVE_SLEEP */
-
 unsigned int
 sleep (unsigned int seconds)
 {
index ad5bf61748116cd9be59aad51ea7489451151da2..64f71d81aa22ab3284c670633a7cfaa97f158f8f 100644 (file)
@@ -1,13 +1,6 @@
 /* This file gets included if AC_REPLACE_FUNCS([strsignal]) cannot find the function. */
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
 
-#include <sys/types.h>
-
-#if !HAVE_STRSIGNAL
-static const char *strsignal(int sig);
-#endif /* !HAVE_STRSIGNAL */
+#include <stdio.h>
 
 /* Note that Gnulib has a much more advanced version of strsignal */
 static const char *
index b8b7eb7d311b8c5c9064c268963747b3c61245bc..09e508b842cdd756b5b882aa3a9b930c47c05892 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include "config.h"
+#include "lib/libcompat.h"
 #include <sys/types.h>
 #ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>