From 455ce4099405e738b97b0d2a5b754b0f3f7851d6 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Sat, 16 Nov 2024 12:43:16 +0000 Subject: [PATCH] Make `GIT_WIN32` an internal declaration The `GIT_WIN32` macro should only be used internally; keep it as such. --- include/git2/common.h | 11 +++-------- src/util/git2_util.h | 4 ++++ src/util/util.h | 8 ++++---- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/include/git2/common.h b/include/git2/common.h index 56847e681..dda821c7c 100644 --- a/include/git2/common.h +++ b/include/git2/common.h @@ -73,11 +73,6 @@ typedef size_t size_t; # define GIT_FORMAT_PRINTF(a,b) /* empty */ #endif -/** Defined when building on Windows (but not via cygwin) */ -#if (defined(_WIN32)) && !defined(__CYGWIN__) -#define GIT_WIN32 1 -#endif - #ifdef __amigaos4__ #include #endif @@ -101,10 +96,10 @@ GIT_BEGIN_DECL * environment variable). A semi-colon ";" is used on Windows and * AmigaOS, and a colon ":" for all other systems. */ -#if defined(GIT_WIN32) || defined(AMIGA) -#define GIT_PATH_LIST_SEPARATOR ';' +#if (defined(_WIN32) && !defined(__CYGWIN__)) || defined(AMIGA) +# define GIT_PATH_LIST_SEPARATOR ';' #else -#define GIT_PATH_LIST_SEPARATOR ':' +# define GIT_PATH_LIST_SEPARATOR ':' #endif /** diff --git a/src/util/git2_util.h b/src/util/git2_util.h index 5bf098199..d47ce5f43 100644 --- a/src/util/git2_util.h +++ b/src/util/git2_util.h @@ -49,6 +49,10 @@ typedef struct git_str git_str; # define GIT_WARN_UNUSED_RESULT #endif +#if (defined(_WIN32)) && !defined(__CYGWIN__) +# define GIT_WIN32 1 +#endif + #include #include #include diff --git a/src/util/util.h b/src/util/util.h index 2ed005110..7053a9d49 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -7,15 +7,15 @@ #ifndef INCLUDE_util_h__ #define INCLUDE_util_h__ -#ifndef GIT_WIN32 -# include -#endif - #include "str.h" #include "git2_util.h" #include "strnlen.h" #include "thread.h" +#ifndef GIT_WIN32 +# include +#endif + #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) #define bitsizeof(x) (CHAR_BIT * sizeof(x)) #define MSB(x, bits) ((x) & (~UINT64_C(0) << (bitsizeof(x) - (bits))))