]> git.ipfire.org Git - thirdparty/git.git/commitdiff
statinfo.h: move DTYPE defines from dir.h
authorAlejandro R. Sedeño <asedeno@mit.edu>
Tue, 6 Jun 2023 20:59:35 +0000 (16:59 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 12 Jun 2023 17:59:01 +0000 (10:59 -0700)
592fc5b3 (dir.h: move DTYPE defines from cache.h, 2023-04-22) moved
DTYPE macros from cache.h to dir.h, but they are still used by cache.h
to implement ce_to_dtype(); cache.h cannot include dir.h because that
would cause name-hash.c to have two different and conflicting
definitions of `struct dir_entry`. (That should be separately fixed.)

Both dir.h and cache.h include statinfo.h, and this seems a reasonable
place for these definitions.

This change fixes a broken build issue on old SunOS.

Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
Signed-off-by: Alejandro R Sedeño <asedeno@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
dir.h
statinfo.h

diff --git a/dir.h b/dir.h
index 79b85a01ee40b551268c8ad7bc675fffa66c7f51..d65a40126c5335e63aef928624f48e55ef5faedf 100644 (file)
--- a/dir.h
+++ b/dir.h
@@ -641,18 +641,4 @@ static inline int starts_with_dot_dot_slash_native(const char *const path)
        return path_match_flags(path, what | PATH_MATCH_NATIVE);
 }
 
-#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)
-#define DTYPE(de)      ((de)->d_type)
-#else
-#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
-#define DTYPE(de)      DT_UNKNOWN
-#endif
-
 #endif
index e49e3054eaaa54f9916ae2a01fa9a1ca987b339a..fe8df633a4e159850dea80efc5751b06d085a5c5 100644 (file)
@@ -21,4 +21,18 @@ struct stat_data {
        unsigned int sd_size;
 };
 
+#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)
+#define DTYPE(de)      ((de)->d_type)
+#else
+#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
+#define DTYPE(de)      DT_UNKNOWN
+#endif
+
 #endif