110 lines
2.9 KiB
Diff
110 lines
2.9 KiB
Diff
From a3e728c192f5dc34c9626fdcaf461e2bb0b26680 Mon Sep 17 00:00:00 2001
|
|
From: Ray Donnelly <mingw.android@gmail.com>
|
|
Date: Wed, 23 Jul 2014 22:46:32 +0100
|
|
Subject: [PATCH 12/16] Use system dirent.h on MinGW-w64
|
|
|
|
.. and rename the mingw one to dirent-mingw.h
|
|
---
|
|
compat/win32/dirent-mingw.h | 32 ++++++++++++++++++++++++++++++++
|
|
compat/win32/dirent.h | 32 --------------------------------
|
|
git-compat-util.h | 4 ++++
|
|
3 files changed, 36 insertions(+), 32 deletions(-)
|
|
create mode 100644 compat/win32/dirent-mingw.h
|
|
delete mode 100644 compat/win32/dirent.h
|
|
|
|
diff --git a/compat/win32/dirent-mingw.h b/compat/win32/dirent-mingw.h
|
|
new file mode 100644
|
|
index 0000000..6b3ddee
|
|
--- /dev/null
|
|
+++ b/compat/win32/dirent-mingw.h
|
|
@@ -0,0 +1,32 @@
|
|
+#ifndef DIRENT_H
|
|
+#define DIRENT_H
|
|
+
|
|
+#define DT_UNKNOWN 0
|
|
+#define DT_DIR 1
|
|
+#define DT_REG 2
|
|
+#define DT_LNK 3
|
|
+
|
|
+struct dirent {
|
|
+ unsigned char d_type; /* file type to prevent lstat after readdir */
|
|
+ char *d_name; /* file name */
|
|
+};
|
|
+
|
|
+/*
|
|
+ * Base DIR structure, contains pointers to readdir/closedir implementations so
|
|
+ * that opendir may choose a concrete implementation on a call-by-call basis.
|
|
+ */
|
|
+typedef struct DIR {
|
|
+ struct dirent *(*preaddir)(struct DIR *dir);
|
|
+ int (*pclosedir)(struct DIR *dir);
|
|
+} DIR;
|
|
+
|
|
+/* default dirent implementation */
|
|
+extern DIR *dirent_opendir(const char *dirname);
|
|
+
|
|
+/* current dirent implementation */
|
|
+extern DIR *(*opendir)(const char *dirname);
|
|
+
|
|
+#define readdir(dir) (dir->preaddir(dir))
|
|
+#define closedir(dir) (dir->pclosedir(dir))
|
|
+
|
|
+#endif /* DIRENT_H */
|
|
diff --git a/compat/win32/dirent.h b/compat/win32/dirent.h
|
|
deleted file mode 100644
|
|
index 6b3ddee..0000000
|
|
--- a/compat/win32/dirent.h
|
|
+++ /dev/null
|
|
@@ -1,32 +0,0 @@
|
|
-#ifndef DIRENT_H
|
|
-#define DIRENT_H
|
|
-
|
|
-#define DT_UNKNOWN 0
|
|
-#define DT_DIR 1
|
|
-#define DT_REG 2
|
|
-#define DT_LNK 3
|
|
-
|
|
-struct dirent {
|
|
- unsigned char d_type; /* file type to prevent lstat after readdir */
|
|
- char *d_name; /* file name */
|
|
-};
|
|
-
|
|
-/*
|
|
- * Base DIR structure, contains pointers to readdir/closedir implementations so
|
|
- * that opendir may choose a concrete implementation on a call-by-call basis.
|
|
- */
|
|
-typedef struct DIR {
|
|
- struct dirent *(*preaddir)(struct DIR *dir);
|
|
- int (*pclosedir)(struct DIR *dir);
|
|
-} DIR;
|
|
-
|
|
-/* default dirent implementation */
|
|
-extern DIR *dirent_opendir(const char *dirname);
|
|
-
|
|
-/* current dirent implementation */
|
|
-extern DIR *(*opendir)(const char *dirname);
|
|
-
|
|
-#define readdir(dir) (dir->preaddir(dir))
|
|
-#define closedir(dir) (dir->pclosedir(dir))
|
|
-
|
|
-#endif /* DIRENT_H */
|
|
diff --git a/git-compat-util.h b/git-compat-util.h
|
|
index 150242d..cf6ca54 100644
|
|
--- a/git-compat-util.h
|
|
+++ b/git-compat-util.h
|
|
@@ -112,7 +112,11 @@
|
|
#include <sys/param.h>
|
|
#endif
|
|
#include <sys/types.h>
|
|
+#ifdef __MINGW64_VERSION_MAJOR
|
|
#include <dirent.h>
|
|
+#else
|
|
+#include <dirent-mingw.h>
|
|
+#endif
|
|
#include <sys/time.h>
|
|
#include <time.h>
|
|
#include <signal.h>
|
|
--
|
|
2.1.2
|
|
|