]> granicus.if.org Git - check/commitdiff
libcompat: do not offer to replace setenv
authorbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Thu, 2 Jan 2014 02:42:29 +0000 (02:42 +0000)
committerbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Thu, 2 Jan 2014 02:42:29 +0000 (02:42 +0000)
if setenv is missing on the system, the only thing that is
affected are unit tests. Check itself does not need setenv.
In this case, the affected unit tests are not compiled in.

This change removed the stub setenv replacement which was
never called, even when a system did not provide it.

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

configure.ac
lib/CMakeLists.txt
lib/libcompat.h
lib/setenv.c [deleted file]

index 46a72ec39d6ff3babaf75399833ae4ea96aa6191..fc720f0692b3216a65c1cb7e3d88086fd849375b 100644 (file)
@@ -266,8 +266,13 @@ AC_FUNC_REALLOC
 # replaced with Check's replacement of these functions.
 HW_LIBRT_TIMERS
 
-AC_REPLACE_FUNCS([alarm clock_gettime gettimeofday localtime_r putenv setenv sleep strdup strsignal unsetenv])
-AC_CHECK_DECLS([alarm, clock_gettime, gettimeofday, localtime_r, putenv, setenv, sleep, strdup, strsignal, unsetenv])
+# The following checks will replace missing functions from libcompat
+AC_REPLACE_FUNCS([alarm clock_gettime gettimeofday localtime_r putenv sleep strdup strsignal unsetenv])
+AC_CHECK_DECLS([alarm, clock_gettime, gettimeofday, localtime_r, putenv, sleep, strdup, strsignal, unsetenv])
+
+# The following checks are to only detect if the functions exist, but
+# not replace them
+AC_CHECK_DECLS([setenv])
 
 AC_CHECK_FUNCS([setitimer])
 
index 53c9936072728dcfd8518210c6ed7ed4510f3470..97409d54ce458ac7241a3180d2dcb2c982db1b32 100644 (file)
@@ -48,10 +48,6 @@ if(NOT HAVE_REALLOC)
   set(SOURCES ${SOURCES} realloc.c)
 endif(NOT HAVE_REALLOC)
 
-if(NOT HAVE_DECL_SETENV)
-  set(SOURCES ${SOURCES} setenv.c)
-endif(NOT HAVE_DECL_SETENV)
-
 if(NOT HAVE_DECL_SLEEP)
   set(SOURCES ${SOURCES} sleep.c)
 endif(NOT HAVE_DECL_SLEEP)
index 601e2ac4eed2e33665574d189f73369513bacdb3..8444b1d628b94267577b5a8b31e7713c3250974c 100644 (file)
@@ -112,10 +112,6 @@ CK_DLL_EXP int putenv (const char *string);
 #define putenv _putenv;
 #endif /* HAVE_DECL_PUTENV && !HAVE__PUTENV */
 
-#if !HAVE_DECL_SETENV
-CK_DLL_EXP int setenv (const char *name, const char *value, int overwrite);
-#endif /* !HAVE_DECL_SETENV */
-
 #if !HAVE_DECL_SLEEP
 CK_DLL_EXP unsigned int sleep (unsigned int seconds);
 #endif /* !HAVE_DECL_SLEEP */
diff --git a/lib/setenv.c b/lib/setenv.c
deleted file mode 100644 (file)
index a94fefc..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "libcompat.h"
-
-int setenv (const char *name CK_ATTRIBUTE_UNUSED, const char *value CK_ATTRIBUTE_UNUSED, int overwrite CK_ATTRIBUTE_UNUSED)
-{
-    assert (0);
-    return 0;
-}