From: brarcher Date: Thu, 2 Jan 2014 02:42:33 +0000 (+0000) Subject: libcompat: remove putenv replacement X-Git-Tag: 0.10.0~230 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2b182aa6dca0776ce287b7c4ef98d47a19b13099;p=check libcompat: remove putenv replacement 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 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e2e512..7bdd693 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/configure.ac b/configure.ac index fc720f0..9639f3f 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 97409d5..26b0ab2 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -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) diff --git a/lib/libcompat.h b/lib/libcompat.h index 8444b1d..6ee9d99 100644 --- a/lib/libcompat.h +++ b/lib/libcompat.h @@ -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 index efd788e..0000000 --- a/lib/putenv.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "libcompat.h" - -int -putenv (const char *string CK_ATTRIBUTE_UNUSED) -{ - assert (0); - return 0; -}