Skip to content

Commit 03bf92b

Browse files
asedenogitster
authored andcommitted
statinfo.h: move DTYPE defines from dir.h
592fc5b (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 <[email protected]> Signed-off-by: Alejandro R Sedeño <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e3a3f5e commit 03bf92b

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

dir.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -641,18 +641,4 @@ static inline int starts_with_dot_dot_slash_native(const char *const path)
641641
return path_match_flags(path, what | PATH_MATCH_NATIVE);
642642
}
643643

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-
658644
#endif

statinfo.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,18 @@ struct stat_data {
2121
unsigned int sd_size;
2222
};
2323

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+
2438
#endif

0 commit comments

Comments
 (0)