diff options
author | Alejandro R. Sedeño <asedeno@mit.edu> | 2023-06-06 23:59:35 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-06-12 20:59:01 +0300 |
commit | 03bf92b9bfee808667588e65645c5427114a5634 (patch) | |
tree | 3e171f3376c1a15bd68ede9641e9e69618d8a3e7 | |
parent | e3a3f5edf52c7f6161b167058b4d7c3a31dc0c3b (diff) |
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>
-rw-r--r-- | dir.h | 14 | ||||
-rw-r--r-- | statinfo.h | 14 |
2 files changed, 14 insertions, 14 deletions
@@ -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 diff --git a/statinfo.h b/statinfo.h index e49e3054ea..fe8df633a4 100644 --- a/statinfo.h +++ b/statinfo.h @@ -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 |