summaryrefslogtreecommitdiff
path: root/compat/mingw.h
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2009-06-13 12:50:42 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2009-06-13 12:50:42 -0700
commit95ad2a65fbb9b7f26669fed9906fe9a1a531810b (patch)
tree596412d5d138652245b1f84d7249a471cc125108 /compat/mingw.h
parentMerge branch 'cb/maint-no-double-merge' (diff)
parentcompat/ has subdirectories: do not omit them in 'make clean' (diff)
downloadtgif-95ad2a65fbb9b7f26669fed9906fe9a1a531810b.tar.xz
Merge branch 'sp/msysgit'
* sp/msysgit: compat/ has subdirectories: do not omit them in 'make clean' Fix typo in nedmalloc warning fix MinGW: Teach Makefile to detect msysgit and apply specific settings Fix warnings in nedmalloc when compiling with GCC 4.4.0 Add custom memory allocator to MinGW and MacOS builds MinGW readdir reimplementation to support d_type connect.c: Support PuTTY plink and TortoisePlink as SSH on Windows git: browsing paths with spaces when using the start command MinGW: fix warning about implicit declaration of _getch() test-chmtime: work around Windows limitation Work around a regression in Windows 7, causing erase_in_line() to crash sometimes Quiet make: do not leave Windows behind MinGW: GCC >= 4 does not need SNPRINTF_SIZE_CORR anymore Conflicts: Makefile
Diffstat (limited to 'compat/mingw.h')
-rw-r--r--compat/mingw.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/compat/mingw.h b/compat/mingw.h
index 4c50f5b1bc..4f7ba4c13f 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -235,3 +235,32 @@ int main(int argc, const char **argv) \
return mingw_main(argc, argv); \
} \
static int mingw_main(c,v)
+
+#ifndef NO_MINGW_REPLACE_READDIR
+/*
+ * A replacement of readdir, to ensure that it reads the file type at
+ * the same time. This avoid extra unneeded lstats in git on MinGW
+ */
+#undef DT_UNKNOWN
+#undef DT_DIR
+#undef DT_REG
+#undef DT_LNK
+#define DT_UNKNOWN 0
+#define DT_DIR 1
+#define DT_REG 2
+#define DT_LNK 3
+
+struct mingw_dirent
+{
+ long d_ino; /* Always zero. */
+ union {
+ unsigned short d_reclen; /* Always zero. */
+ unsigned char d_type; /* Reimplementation adds this */
+ };
+ unsigned short d_namlen; /* Length of name in d_name. */
+ char d_name[FILENAME_MAX]; /* File name. */
+};
+#define dirent mingw_dirent
+#define readdir(x) mingw_readdir(x)
+struct dirent *mingw_readdir(DIR *dir);
+#endif // !NO_MINGW_REPLACE_READDIR