mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
Centralize the include of windows.h in git-compat-util.h, turn on WIN32_LEAN_AND_MEAN to avoid including plenty of other header files which is not needed in Git. Also ensure we load winsock2.h first, so we don't load the older winsock definitions at a later stage, since they contain duplicate definitions. When moving windows.h into git-compat-util.h, we need to protect the definition of struct pollfd in mingw.h, since this file is used by both MinGW and MSVC, and the latter defines this struct in winsock2.h. We need to keep the windows.h include in compat/win32.h, since its shared by both MinGW and Cygwin, and we're not touching Cygwin in this commit. The include in git-compat-util.h is protected with an ifdef WIN32, which is not the case when compiling for Cygwin. Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
49 lines
1.0 KiB
C
49 lines
1.0 KiB
C
#ifndef __MSVC__HEAD
|
|
#define __MSVC__HEAD
|
|
|
|
#include <direct.h>
|
|
#include <process.h>
|
|
#include <malloc.h>
|
|
|
|
/* porting function */
|
|
#define inline __inline
|
|
#define __inline__ __inline
|
|
#define __attribute__(x)
|
|
#define va_copy(dst, src) ((dst) = (src))
|
|
|
|
static __inline int strcasecmp (const char *s1, const char *s2)
|
|
{
|
|
int size1 = strlen(s1);
|
|
int sisz2 = strlen(s2);
|
|
return _strnicmp(s1, s2, sisz2 > size1 ? sisz2 : size1);
|
|
}
|
|
|
|
#undef ERROR
|
|
#undef stat
|
|
#undef _stati64
|
|
#include "compat/mingw.h"
|
|
#undef stat
|
|
#define stat _stati64
|
|
#define _stat64(x,y) mingw_lstat(x,y)
|
|
|
|
/*
|
|
Even though _stati64 is normally just defined at _stat64
|
|
on Windows, we specify it here as a proper struct to avoid
|
|
compiler warnings about macro redefinition due to magic in
|
|
mingw.h. Struct taken from ReactOS (GNU GPL license).
|
|
*/
|
|
struct _stati64 {
|
|
_dev_t st_dev;
|
|
_ino_t st_ino;
|
|
unsigned short st_mode;
|
|
short st_nlink;
|
|
short st_uid;
|
|
short st_gid;
|
|
_dev_t st_rdev;
|
|
__int64 st_size;
|
|
time_t st_atime;
|
|
time_t st_mtime;
|
|
time_t st_ctime;
|
|
};
|
|
#endif
|