Merge pull request #6940 from libgit2/ethomson/win32

Make `GIT_WIN32` an internal declaration
This commit is contained in:
Edward Thomson
2024-12-10 07:57:49 +00:00
committed by GitHub
4 changed files with 12 additions and 19 deletions

View File

@@ -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 <netinet/in.h>
#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
/**

View File

@@ -213,15 +213,9 @@ int git_mempack_new(git_odb_backend **out)
int git_mempack_object_count(size_t *out, git_odb_backend *_backend)
{
struct memory_packer_db *db = (struct memory_packer_db *)_backend;
uint32_t count;
GIT_ASSERT_ARG(_backend);
count = git_odb_mempack_oidmap_size(&db->objects);
if (count < 0)
return count;
*out = (size_t)count;
*out = (size_t)git_odb_mempack_oidmap_size(&db->objects);
return 0;
}

View File

@@ -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 <assert.h>
#include <errno.h>
#include <limits.h>

View File

@@ -7,15 +7,15 @@
#ifndef INCLUDE_util_h__
#define INCLUDE_util_h__
#ifndef GIT_WIN32
# include <ctype.h>
#endif
#include "str.h"
#include "git2_util.h"
#include "strnlen.h"
#include "thread.h"
#ifndef GIT_WIN32
# include <ctype.h>
#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))))