From 4d3bf7838f555f4da67c59f3b302750ac3a87ae8 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 5 Aug 2024 01:04:13 -0700 Subject: [PATCH] Omit unused PATH_MAX code * src/makeint.h (GET_PATH_MAX, PATH_VAR): Simplify, since PATH_MAX is always defined here. (NEED_GET_PATH_MAX): Remove. * src/misc.c (get_path_max) [NEED_GET_PATH_MAX]: Remove. --- src/makeint.h | 11 ++--------- src/misc.c | 19 ------------------- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/src/makeint.h b/src/makeint.h index 5a553093..61c78229 100644 --- a/src/makeint.h +++ b/src/makeint.h @@ -149,15 +149,8 @@ extern int errno; # endif #endif -#ifdef PATH_MAX -# define GET_PATH_MAX PATH_MAX -# define PATH_VAR(var) char var[PATH_MAX+1] -#else -# define NEED_GET_PATH_MAX 1 -# define GET_PATH_MAX (get_path_max ()) -# define PATH_VAR(var) char *var = alloca (GET_PATH_MAX+1) -unsigned int get_path_max (void); -#endif +#define GET_PATH_MAX PATH_MAX +#define PATH_VAR(var) char var[PATH_MAX+1] #ifndef CHAR_BIT # define CHAR_BIT 8 diff --git a/src/misc.c b/src/misc.c index 1914aa22..9e41a546 100644 --- a/src/misc.c +++ b/src/misc.c @@ -948,25 +948,6 @@ strncasecmp (const char *s1, const char *s2, size_t n) #endif -#ifdef NEED_GET_PATH_MAX -unsigned int -get_path_max (void) -{ - static unsigned int value; - - if (value == 0) - { - long x = pathconf ("/", _PC_PATH_MAX); - if (x > 0) - value = (unsigned int) x; - else - value = PATH_MAX; - } - - return value; -} -#endif - #if !HAVE_MEMPCPY void * mempcpy (void *dest, const void *src, size_t n)