]> granicus.if.org Git - check/commitdiff
libcompat: remove putenv replacement
authorbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Thu, 2 Jan 2014 02:42:33 +0000 (02:42 +0000)
committerbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Thu, 2 Jan 2014 02:42:33 +0000 (02:42 +0000)
the putenv replacement did nothing except call abort().
There is no platform (yet) which did not have putenv()
but did have fork(). For this reason, the assert()
has yet to be hit, meaning that the stub itself is
pointless.

If in the future a platform is found to have fork() but
not putenv(), then the related tests need to be disabled
at compile time using something like
  #if defined(HAVE_DECL_PUTENV)
along with a related AC_CHECK_DECLS check.

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

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

index 9e2e512d830f3c3b78b9e0b0b4273724b3182b57..7bdd6934c3d9241589c1934dd1d24509f598c921 100644 (file)
@@ -101,7 +101,6 @@ check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
 check_function_exists(localtime_r HAVE_DECL_LOCALTIME_R)
 check_function_exists(localtime_s HAVE_LOCALTIME_S)
 check_function_exists(malloc HAVE_MALLOC)
-check_function_exists(putenv HAVE_DECL_PUTENV)
 check_function_exists(realloc HAVE_REALLOC)
 check_function_exists(setenv HAVE_DECL_SETENV)
 check_function_exists(sigaction HAVE_SIGACTION)
@@ -113,7 +112,6 @@ check_function_exists(strsignal HAVE_DECL_STRSIGNAL)
 check_function_exists(unsetenv HAVE_DECL_UNSETENV)
 check_function_exists(_getpid HAVE__GETPID)
 check_function_exists(_localtime64_s HAVE__LOCALTIME64_S)
-check_function_exists(_putenv HAVE__PUTENV)
 check_function_exists(_strdup HAVE__STRDUP)
 
 if(HAVE_FORK)
index fc720f0692b3216a65c1cb7e3d88086fd849375b..9639f3f379ebac1304bf2804cbf40d412294479c 100644 (file)
@@ -267,8 +267,8 @@ AC_FUNC_REALLOC
 HW_LIBRT_TIMERS
 
 # 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])
+AC_REPLACE_FUNCS([alarm clock_gettime gettimeofday localtime_r sleep strdup strsignal unsetenv])
+AC_CHECK_DECLS([alarm, clock_gettime, gettimeofday, localtime_r, sleep, strdup, strsignal, unsetenv])
 
 # The following checks are to only detect if the functions exist, but
 # not replace them
index 97409d54ce458ac7241a3180d2dcb2c982db1b32..26b0ab24517b1bd37b4b118b8a22f2ee0c95ba99 100644 (file)
@@ -40,10 +40,6 @@ if(NOT HAVE_MALLOC)
   set(SOURCES ${SOURCES} malloc.c)
 endif(NOT HAVE_MALLOC)
 
-if(NOT HAVE_DECL_PUTENV AND NOT HAVE__PUTENV)
-  set(SOURCES ${SOURCES} putenv.c)
-endif(NOT HAVE_DECL_PUTENV AND NOT HAVE__PUTENV)
-
 if(NOT HAVE_REALLOC)
   set(SOURCES ${SOURCES} realloc.c)
 endif(NOT HAVE_REALLOC)
index 8444b1d628b94267577b5a8b31e7713c3250974c..6ee9d995316b08785ce8bca23f6279b66e1b3da7 100644 (file)
@@ -106,12 +106,6 @@ CK_DLL_EXP struct tm *localtime_r (const time_t *clock, struct tm *result);
 #endif
 #endif /* !HAVE_DECL_LOCALTIME_R */
 
-#if !HAVE_DECL_PUTENV && !HAVE__PUTENV
-CK_DLL_EXP int putenv (const char *string);
-#elif !HAVE_DECL_PUTENV && HAVE__PUTENV
-#define putenv _putenv;
-#endif /* HAVE_DECL_PUTENV && !HAVE__PUTENV */
-
 #if !HAVE_DECL_SLEEP
 CK_DLL_EXP unsigned int sleep (unsigned int seconds);
 #endif /* !HAVE_DECL_SLEEP */
diff --git a/lib/putenv.c b/lib/putenv.c
deleted file mode 100644 (file)
index efd788e..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "libcompat.h"
-
-int
-putenv (const char *string CK_ATTRIBUTE_UNUSED)
-{
-    assert (0);
-    return 0;
-}