]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
changed ZSTD_NANOSLEEP_SUPPORT definition
authorYann Collet <cyan@fb.com>
Wed, 3 Oct 2018 22:34:41 +0000 (15:34 -0700)
committerYann Collet <cyan@fb.com>
Wed, 3 Oct 2018 22:34:41 +0000 (15:34 -0700)
to please `-Wexpansion-to-defined`

programs/platform.h
programs/util.h

index b6b3a3beac4cd149e3ee6693e6e0a448cf2ea9e7..155ebcd1eb9c8e18f9346ff59ba1d16a63b0212f 100644 (file)
@@ -50,15 +50,15 @@ extern "C" {
 /* *********************************************************
 *  Turn on Large Files support (>4GB) for 32-bit Linux/Unix
 ***********************************************************/
-#if !defined(__64BIT__) || defined(__MINGW32__)       /* No point defining Large file for 64 bit but MinGW-w64 requires it */
+#if !defined(__64BIT__) || defined(__MINGW32__)    /* No point defining Large file for 64 bit but MinGW-w64 requires it */
 #  if !defined(_FILE_OFFSET_BITS)
-#    define _FILE_OFFSET_BITS 64                      /* turn off_t into a 64-bit type for ftello, fseeko */
+#    define _FILE_OFFSET_BITS 64                   /* turn off_t into a 64-bit type for ftello, fseeko */
 #  endif
-#  if !defined(_LARGEFILE_SOURCE)                     /* obsolete macro, replaced with _FILE_OFFSET_BITS */
-#    define _LARGEFILE_SOURCE 1                       /* Large File Support extension (LFS) - fseeko, ftello */
+#  if !defined(_LARGEFILE_SOURCE)                  /* obsolete macro, replaced with _FILE_OFFSET_BITS */
+#    define _LARGEFILE_SOURCE 1                    /* Large File Support extension (LFS) - fseeko, ftello */
 #  endif
 #  if defined(_AIX) || defined(__hpux)
-#    define _LARGE_FILES                              /* Large file support on 32-bits AIX and HP-UX */
+#    define _LARGE_FILES                           /* Large file support on 32-bits AIX and HP-UX */
 #  endif
 #endif
 
@@ -181,8 +181,12 @@ static __inline int IS_CONSOLE(FILE* stdStream) {
 
 #ifndef ZSTD_NANOSLEEP_SUPPORT
    /* mandates support of nanosleep() within <time.h> : http://man7.org/linux/man-pages/man2/nanosleep.2.html */
-#  define ZSTD_NANOSLEEP_SUPPORT (defined(__linux__) && (PLATFORM_POSIX_VERSION >= 199309L)) \
-                              || (PLATFORM_POSIX_VERSION >= 200112L)
+#  if (defined(__linux__) && (PLATFORM_POSIX_VERSION >= 199309L)) \
+   || (PLATFORM_POSIX_VERSION >= 200112L)
+#     define ZSTD_NANOSLEEP_SUPPORT 1
+#  else
+#     define ZSTD_NANOSLEEP_SUPPORT 0
+#  endif
 #endif
 
 
index 596f4bbbc764d5af4543aa705ca9ec3f0ee2b569..67aa7a56b967ca29c3307f64a2023c2c8e43b653 100644 (file)
@@ -20,7 +20,7 @@ extern "C" {
 /*-****************************************
 *  Dependencies
 ******************************************/
-#include "platform.h"     /* PLATFORM_POSIX_VERSION */
+#include "platform.h"     /* PLATFORM_POSIX_VERSION, ZSTD_NANOSLEEP_SUPPORT, ZSTD_SETPRIORITY_SUPPORT */
 #include <stdlib.h>       /* malloc */
 #include <stddef.h>       /* size_t, ptrdiff_t */
 #include <stdio.h>        /* fprintf */
@@ -65,7 +65,7 @@ extern "C" {
 #elif PLATFORM_POSIX_VERSION > 0 /* Unix-like operating system */
 #  include <unistd.h>   /* sleep */
 #  define UTIL_sleep(s) sleep(s)
-#  if ZSTD_NANOSLEEP_SUPPORT
+#  if ZSTD_NANOSLEEP_SUPPORT   /* necessarily defined in platform.h */
 #      define UTIL_sleepMilli(milli) { struct timespec t; t.tv_sec=0; t.tv_nsec=milli*1000000ULL; nanosleep(&t, NULL); }
 #  else
 #      define UTIL_sleepMilli(milli) /* disabled */