statinfo.h: move DTYPE defines from dir.h

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>

Alejandro R. Sedeño committed Jun 6, 2023 at 16:59 UTC 03bf92b9bfee808667588e65645c5427114a5634
2 files changed +14 -14
dir.h
-14
@@ -641,18 +641,4 @@ static inline int starts_with_dot_dot_slash_native(const char *const path)
641 return path_match_flags(path, what | PATH_MATCH_NATIVE);
642 }
643
644 -#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)
645 -#define DTYPE(de) ((de)->d_type)
646 -#else
647 -#undef DT_UNKNOWN
648 -#undef DT_DIR
649 -#undef DT_REG
650 -#undef DT_LNK
651 -#define DT_UNKNOWN 0
652 -#define DT_DIR 1
653 -#define DT_REG 2
654 -#define DT_LNK 3
655 -#define DTYPE(de) DT_UNKNOWN
656 -#endif
657 -
644 #endif
statinfo.h
+14
@@ -21,4 +21,18 @@ struct stat_data {
21 unsigned int sd_size;
22 };
23
24 +#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)
25 +#define DTYPE(de) ((de)->d_type)
26 +#else
27 +#undef DT_UNKNOWN
28 +#undef DT_DIR
29 +#undef DT_REG
30 +#undef DT_LNK
31 +#define DT_UNKNOWN 0
32 +#define DT_DIR 1
33 +#define DT_REG 2
34 +#define DT_LNK 3
35 +#define DTYPE(de) DT_UNKNOWN
36 +#endif
37 +
38 #endif