]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
util: isolated some dependencies
authorYann Collet <cyan@fb.com>
Tue, 26 Nov 2019 23:16:53 +0000 (15:16 -0800)
committerYann Collet <cyan@fb.com>
Tue, 26 Nov 2019 23:16:53 +0000 (15:16 -0800)
from *.h to *.c
so that they don't get transitively included
into users of util.h.

programs/util.c
programs/util.h

index 3c541c55040113b33081d1ebc6965cd5220f0e27..5354e864d7bb7fea03df3b816346d05fbec53d4c 100644 (file)
@@ -17,9 +17,24 @@ extern "C" {
 *  Dependencies
 ******************************************/
 #include "util.h"       /* note : ensure that platform.h is included first ! */
+#include <stdlib.h>     /* malloc, realloc, free */
+#include <time.h>       /* clock_t, clock, CLOCKS_PER_SEC, nanosleep */
 #include <errno.h>
 #include <assert.h>
 
+#if defined(_WIN32)
+#  include <sys/utime.h>  /* utime */
+#  include <io.h>         /* _chmod */
+#else
+#  include <unistd.h>     /* chown, stat */
+#  if PLATFORM_POSIX_VERSION < 200809L
+#    include <utime.h>    /* utime */
+#  else
+#    include <fcntl.h>    /* AT_FDCWD */
+#    include <sys/stat.h> /* utimensat */
+#  endif
+#endif
+
 #if defined(_MSC_VER) || defined(__MINGW32__) || defined (__MSVCRT__)
 #include <direct.h>     /* needed for _mkdir in windows */
 #endif
index 27f5d5a0b774ead611f8be05e213a5ce734ce08e..53431657d1ea0dcbac84713def1e1902e4ef5d68 100644 (file)
@@ -20,25 +20,11 @@ extern "C" {
 *  Dependencies
 ******************************************/
 #include "platform.h"     /* PLATFORM_POSIX_VERSION, ZSTD_NANOSLEEP_SUPPORT, ZSTD_SETPRIORITY_SUPPORT */
-#include <stdlib.h>       /* malloc, realloc, free */
 #include <stddef.h>       /* size_t, ptrdiff_t */
 #include <stdio.h>        /* fprintf */
 #include <sys/types.h>    /* stat, utime */
 #include <sys/stat.h>     /* stat, chmod */
-#if defined(_WIN32)
-#  include <sys/utime.h>  /* utime */
-#  include <io.h>         /* _chmod */
-#else
-#  include <unistd.h>     /* chown, stat */
-#  if PLATFORM_POSIX_VERSION < 200809L
-#    include <utime.h>      /* utime */
-#  else
-#    include <fcntl.h>      /* AT_FDCWD */
-#    include <sys/stat.h>   /* utimensat */
-#  endif
-#endif
-#include <time.h>         /* clock_t, clock, CLOCKS_PER_SEC, nanosleep */
-#include "mem.h"          /* U32, U64 */
+#include "mem.h"          /* U64 */
 
 /*-************************************************************
 * Avoid fseek()'s 2GiB barrier with MSVC, macOS, *BSD, MinGW