aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-04-29 09:13:36 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-08-01 18:16:11 +0200
commit5bbebae38be8c2250e0fcc7f7b803d45a714eb30 (patch)
treed98384699461a46490a724ea70d2937d9afe42bc
parent5fc204f2ec2d3ec038848db3f3bdb9fead782b4c (diff)
downloadsparse-5bbebae38be8c2250e0fcc7f7b803d45a714eb30.tar.gz
fix build on Hurd which doesn't define PATH_MAX
Hurd doesn't define PATH_MAX but is needed by pre-process.c and sindex.c. pre-process.c had already its local define but sindex doesn't. So, allow sindex to build on Hurd and avoid possible problems with some future tools by moving the default define of 4096 for it to lib.h where it will be visible for all code. Reported-by: Uwe Kleine-König <uwe@kleine-koenig.org> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--lib.h4
-rw-r--r--pre-process.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib.h b/lib.h
index 5458fa71..b35debc8 100644
--- a/lib.h
+++ b/lib.h
@@ -44,6 +44,10 @@
#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
#endif
+#ifndef PATH_MAX
+#define PATH_MAX 4096 // Hurd doesn't define this
+#endif
+
struct position {
unsigned int type:6,
diff --git a/pre-process.c b/pre-process.c
index ee0e9954..7a1478f6 100644
--- a/pre-process.c
+++ b/pre-process.c
@@ -890,10 +890,6 @@ static void set_stream_include_path(struct stream *stream)
includepath[0] = path;
}
-#ifndef PATH_MAX
-#define PATH_MAX 4096 // for Hurd where it's not defined
-#endif
-
static int try_include(struct position pos, const char *path, const char *filename, int flen, struct token **where, const char **next_path)
{
int fd;