git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] statinfo.h: move DTYPE defines from dir.h

From
Aleajndro R Sedeño <asedeno@google.com>
Date
Jun 2, 2023, 18:45 UTC
Message-ID
<20230602184557.1445044-1-asedeno@google.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-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
Next: Alejandro Sedeño
Message 1 of 12 in “statinfo.h: move DTYPE defines from dir.h”
  1. statinfo.h: move DTYPE defines from dir.hAleajndro R Sedeño, Jun 2, 2023
  2. Alejandro SedeñoJun 2, 2023
  3. Eric SunshineJun 2, 2023
  4. Alejandro SedeñoJun 2, 2023
  5. statinfo.h: move DTYPE defines from dir.hAlejandro R Sedeño, Jun 2, 2023
  6. Elijah NewrenJun 3, 2023
  7. Junio C HamanoJun 3, 2023
  8. Elijah NewrenJun 3, 2023
  9. Junio C HamanoJun 3, 2023
  10. Alejandro SedeñoJun 3, 2023
  11. statinfo.h: move DTYPE defines from dir.hAlejandro R Sedeño, Jun 6, 2023
  12. Junio C HamanoJun 12, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.