Git 1.7.3 rc1
[git/mingw/4msysgit/kblees.git] / compat / msvc.h
blob023aba0238c844f79f2662a4b885058acbfc91fd
1 #ifndef __MSVC__HEAD
2 #define __MSVC__HEAD
4 #include <direct.h>
5 #include <process.h>
6 #include <malloc.h>
8 /* porting function */
9 #define inline __inline
10 #define __inline__ __inline
11 #define __attribute__(x)
12 #define va_copy(dst, src) ((dst) = (src))
13 #define strncasecmp _strnicmp
14 #define ftruncate _chsize
16 static __inline int strcasecmp (const char *s1, const char *s2)
18 int size1 = strlen(s1);
19 int sisz2 = strlen(s2);
20 return _strnicmp(s1, s2, sisz2 > size1 ? sisz2 : size1);
23 #undef ERROR
25 /* Use mingw_lstat() instead of lstat()/stat() and mingw_fstat() instead
26 * of fstat(). We add the declaration of these functions here, suppressing
27 * the corresponding declarations in mingw.h, so that we can use the
28 * appropriate structure type (and function) names from the msvc headers.
30 #define stat _stat64
31 int mingw_lstat(const char *file_name, struct stat *buf);
32 int mingw_fstat(int fd, struct stat *buf);
33 #define fstat mingw_fstat
34 #define lstat mingw_lstat
35 #define _stat64(x,y) mingw_lstat(x,y)
36 #define ALREADY_DECLARED_STAT_FUNCS
38 #include "compat/mingw.h"
40 #undef ALREADY_DECLARED_STAT_FUNCS
42 #endif