Re: [PATCH] statinfo.h: move DTYPE defines from dir.h
- From
Alejandro Sedeño <asedeno@google.com>
- Date
- Jun 2, 2023, 18:50 UTC
- Message-ID
- <CALVMLfJt7n_KxMY7x6d8VMtYY83ai24cwJPTEbeJwH+up17woA@mail.gmail.com>
- In-Reply-To
- <20230602184557.1445044-1-asedeno@google.com>
And today is the day I notice I misspelled my name in my git sendmail config at work. Cool. (Fixed.)
-Alejandro
On Fri, Jun 2, 2023 at 2:46 PM Aleajndro R Sedeño <asedeno@google.com> wrote:
Show 68 quoted lines
>
> From: Alejandro R. Sedeño <asedeno@mit.edu>
>
> These definitions are used in cache.h, which can't include dir.h
> without causing name-info.cc to have two definitions of
> `struct dir_entry`.
>
> 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>
> ---
> dir.h | 14 --------------
> statinfo.h | 14 ++++++++++++++
> 2 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/dir.h b/dir.h
> index 79b85a01ee..d65a40126c 100644
> --- 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
> 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
> --
> 2.41.0.rc2.161.g9c6817b8e7-goog
>