]> granicus.if.org Git - check/commitdiff
libcompat: remove replacement for sleep()
authorbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Thu, 2 Jan 2014 02:42:40 +0000 (02:42 +0000)
committerbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Thu, 2 Jan 2014 02:42:40 +0000 (02:42 +0000)
Before working on MSVC support, the replacement sleep() call
only called assert(). Instead, it was assumed that the related
code would not be called, as the only platform that did not
provide a sleep() call also did not provide fork() (e.g. Windows),
so the related code never got executed.

As we still do not provide a fork(), the sleep() replacement is
unnecessary as it is never called. If, in the future, Check
provides a fork() replacement, then a sleep() replacement will
make sense.

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

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

index 90ae92cf013b54fb59a0136571528260c31b1530..d05e452551dd6bbef003cd4a29d04a6ce5fb04ef 100644 (file)
@@ -104,7 +104,6 @@ check_function_exists(malloc HAVE_MALLOC)
 check_function_exists(realloc HAVE_REALLOC)
 check_function_exists(setenv HAVE_DECL_SETENV)
 check_function_exists(sigaction HAVE_SIGACTION)
-check_function_exists(sleep HAVE_DECL_SLEEP)
 check_function_exists(snprintf HAVE_SNPRINTF)
 check_function_exists(strdup HAVE_DECL_STRDUP)
 check_function_exists(strerror HAVE_STRERROR)
index 8760502f97648fc760e2f6d35c9b96615be48a4d..083691d06b119433ce2c7ae7dcce129c854f6b78 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 sleep strdup strsignal])
-AC_CHECK_DECLS([alarm, clock_gettime, gettimeofday, localtime_r, sleep, strdup, strsignal])
+AC_REPLACE_FUNCS([alarm clock_gettime gettimeofday localtime_r strdup strsignal])
+AC_CHECK_DECLS([alarm, clock_gettime, gettimeofday, localtime_r, strdup, strsignal])
 
 # The following checks are to only detect if the functions exist, but
 # not replace them
index 4270039a14afbf6751d00eabc286b59c3ce26a34..66b565452a95917220a733ff4dffc593f854dc27 100644 (file)
@@ -44,10 +44,6 @@ if(NOT HAVE_REALLOC)
   set(SOURCES ${SOURCES} realloc.c)
 endif(NOT HAVE_REALLOC)
 
-if(NOT HAVE_DECL_SLEEP)
-  set(SOURCES ${SOURCES} sleep.c)
-endif(NOT HAVE_DECL_SLEEP)
-
 if(NOT HAVE_SNPRINTF AND NOT HAVE__SNPRINTF)
     set(SOURCES ${SOURCES} snprintf.c)
     add_definitions(-Dsnprintf=rpl_snprintf)
index 7a842e0f90e0ec41554656e2dc91824a9c70c859..38105603fb67300cdea4bc332ea4d0210e5c68e5 100644 (file)
@@ -106,10 +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_SLEEP
-CK_DLL_EXP unsigned int sleep (unsigned int seconds);
-#endif /* !HAVE_DECL_SLEEP */
-
 #if !HAVE_DECL_STRDUP && !HAVE__STRDUP
 CK_DLL_EXP char *strdup (const char *str);
 #elif !HAVE_DECL_STRDUP && HAVE__STRDUP
diff --git a/lib/sleep.c b/lib/sleep.c
deleted file mode 100644 (file)
index 1e2dfde..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#include "libcompat.h"
-
-#if _MSC_VER
-#include <windows.h> /* Sleep() */
-#endif
-
-unsigned int sleep (unsigned int seconds CK_ATTRIBUTE_UNUSED)
-{
-#if _MSC_VER
-    DWORD millisecs = seconds * 1000;
-    Sleep(millisecs);
-#else
-    assert (0);
-#endif
-    return 0;
-}