Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: "Alejandro R Sedeño" <asedeno@google.com>
To: asedeno@google.com
Cc: asedeno@mit.edu, git@vger.kernel.org, gitster@pobox.com,
	newren@gmail.com, sunshine@sunshineco.com
Subject: [PATCH] statinfo.h: move DTYPE defines from dir.h
Date: Fri,  2 Jun 2023 15:27:00 -0400	[thread overview]
Message-ID: <20230602192700.1548636-1-asedeno@google.com> (raw)
In-Reply-To: <CALVMLfLw4P=VnBOYA-WbHRNPZiAiO05h4k+cSvPJuaqkjgp5ew@mail.gmail.com>

From: Alejandro R. Sedeño <asedeno@mit.edu>

These definitions are used in cache.h, which can't include dir.h
without causing name-hash.c 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


  reply	other threads:[~2023-06-02 19:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-02 18:45 [PATCH] statinfo.h: move DTYPE defines from dir.h Aleajndro R Sedeño
2023-06-02 18:50 ` Alejandro Sedeño
2023-06-02 19:06 ` Eric Sunshine
2023-06-02 19:21   ` Alejandro Sedeño
2023-06-02 19:27     ` Alejandro R Sedeño [this message]
2023-06-03  1:47       ` Elijah Newren
2023-06-03  1:56       ` Junio C Hamano
2023-06-03  2:04         ` Elijah Newren
2023-06-03  2:30           ` Junio C Hamano
2023-06-03  3:02         ` Alejandro Sedeño
2023-06-06 20:59         ` Alejandro R Sedeño
2023-06-12 18:00           ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230602192700.1548636-1-asedeno@google.com \
    --to=asedeno@google.com \
    --cc=asedeno@mit.edu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).