]> granicus.if.org Git - check/commitdiff
* use HAVE_DECL_FUNCTION instead of HAVE_FUNCTION
authorcpickett <cpickett@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Tue, 30 Dec 2008 02:17:15 +0000 (02:17 +0000)
committercpickett <cpickett@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Tue, 30 Dec 2008 02:17:15 +0000 (02:17 +0000)
* add bodies for all lib/ .c files
* rely on libcompat.h to provide common #includes

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

lib/fileno.c
lib/libcompat.h
lib/localtime_r.c
lib/malloc.c
lib/realloc.c
lib/setenv.c
lib/sleep.c
lib/strdup.c
lib/strsignal.c
lib/unsetenv.c

index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..35ced77c0625ddd641b6a55ca9fe5d16fb2f130d 100644 (file)
@@ -0,0 +1,7 @@
+#include "libcompat.h"
+
+int fileno(FILE *stream CK_ATTRIBUTE_UNUSED)
+{
+  return 0;
+}
+
index 18cd5bb01ab2ea7354038ba73460945ff8b9284e..280e38964b2e67aba395ae9dd693ecb9301a2bf7 100644 (file)
@@ -7,14 +7,10 @@
 /* defines size_t */
 #include <sys/types.h>
 
-#if !HAVE_FILENO
-int fileno(FILE *stream);
-#endif /* !HAVE_FILENO */
-
-#if !HAVE_LOCALTIME_R
-struct tm *localtime_r(const time_t *clock, struct tm *result);
-#endif /* !HAVE_LOCALTIME_R */
+/* defines FILE */
+#include <stdio.h>
 
+/* replacement functions for broken originals */
 #if !HAVE_MALLOC
 void *rpl_malloc (size_t n);
 #endif /* !HAVE_MALLOC */
@@ -23,25 +19,34 @@ void *rpl_malloc (size_t n);
 void *rpl_realloc (void *p, size_t n);
 #endif /* !HAVE_REALLOC */
 
-#if !HAVE_SETENV
+/* functions that may be undeclared */
+#if !HAVE_DECL_FILENO
+int fileno(FILE *stream);
+#endif /* !HAVE_DECL_FILENO */
+
+#if !HAVE_DECL_LOCALTIME_R
+struct tm *localtime_r(const time_t *clock, struct tm *result);
+#endif /* !HAVE_DECL_LOCALTIME_R */
+
+#if !HAVE_DECL_SETENV
 int setenv(const char *name, const char *value, int overwrite);
-#endif /* !HAVE_SETENV */
+#endif /* !HAVE_DECL_SETENV */
 
-#if !HAVE_SLEEP
+#if !HAVE_DECL_SLEEP
 unsigned int sleep (unsigned int seconds);
-#endif /* !HAVE_SLEEP */
+#endif /* !HAVE_DECL_SLEEP */
 
-#if !HAVE_STRDUP
+#if !HAVE_DECL_STRDUP
 char *strdup (const char *str);
-#endif /* !HAVE_STRDUP */
+#endif /* !HAVE_DECL_STRDUP */
 
-#if !HAVE_STRSIGNAL
+#if !HAVE_DECL_STRSIGNAL
 const char *strsignal(int sig);
-#endif /* !HAVE_STRSIGNAL */
+#endif /* !HAVE_DECL_STRSIGNAL */
 
-#if !HAVE_UNSETENV
+#if !HAVE_DECL_UNSETENV
 void unsetenv(const char *name);
-#endif /* !HAVE_UNSETENV */
+#endif /* !HAVE_DECL_UNSETENV */
 
 /* silence warnings about an empty library */
 void ck_do_nothing (void);
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..aaa5edf472d1e7e6d15a54f0867a2a89a5199fcc 100644 (file)
@@ -0,0 +1,6 @@
+#include "libcompat.h"
+
+struct tm *localtime_r (const time_t *clock CK_ATTRIBUTE_UNUSED, struct tm *result CK_ATTRIBUTE_UNUSED)
+{
+  return NULL;
+}
index c9a685b67aa53ca9b31916e1c2073b2a78a29604..39b11e9a565a5a348aaf1a10716dcd741937db75 100644 (file)
@@ -6,9 +6,6 @@
 /* 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);
 
index e72a7fce1e4841ef9454f90207a5552cd8e3eb96..bbf51bb9080e88100ad603f078a2d82a4c46bfa3 100644 (file)
@@ -7,9 +7,6 @@
 /* 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);
      
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..988c81557bebfc17143029b3e2a96051d3138293 100644 (file)
@@ -0,0 +1,6 @@
+#include "libcompat.h"
+
+int setenv (const char *name CK_ATTRIBUTE_UNUSED, const char *value CK_ATTRIBUTE_UNUSED, int overwrite CK_ATTRIBUTE_UNUSED)
+{
+  return 0;
+}
index 90bd8eab539f2c1bef965b2a4186b1bcc4b9ae90..4699029e1f85852514427834fbf0f823e1830123 100644 (file)
@@ -1,6 +1,3 @@
-/* This file gets included if AC_REPLACE_FUNCS([sleep]) cannot find
-   the function. */
-
 #include "libcompat.h"
 
 unsigned int
index 3db2cda5363962bd9560dcb3b1cf4ab6bae00a97..80d068e383ef9b9b4ab9d584b0d0e9aaa0abcbb2 100644 (file)
@@ -1,13 +1,7 @@
-/* This file gets included if AC_REPLACE_FUNCS([strdup]) cannot
-   find the function. */
-
 #include "libcompat.h"
-#include <stdio.h>
 
-/* Note that Gnulib has a much more advanced version of strdup */
 char *
-strdup (const char *str)
+strdup (const char *str CK_ATTRIBUTE_UNUSED)
 {
-  /* FIXME: obviously this is broken */
   return NULL;
 }
index 1f1a9d7b710ce956debe277c0712801344be66f9..62dd140fb7bbbfa425d4306c5248b4b1ddd030ca 100644 (file)
@@ -1,10 +1,5 @@
-/* This file gets included if AC_REPLACE_FUNCS([strsignal]) cannot
-   find the function. */
-
 #include "libcompat.h"
-#include <stdio.h>
 
-/* Note that Gnulib has a much more advanced version of strsignal */
 const char *
 strsignal (int sig)
 {
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..8456eb133e4b82d57703bc91d29fec933b22822b 100644 (file)
@@ -0,0 +1,5 @@
+#include "libcompat.h"
+
+void unsetenv (const char *name CK_ATTRIBUTE_UNUSED)
+{
+}