From 1894e219dc530d7074085e95ffe3c1e66cebc072 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Tue, 4 Mar 2025 15:13:41 -0300 Subject: Remove eloop-threshold.h On both Linux and Hurd the __eloop_threshold() is always a constant (40 and 32 respectively), so there is no need to always call __sysconf (_SC_SYMLOOP_MAX) for Linux case (!SYMLOOP_MAX). To avoid a name clash with gnulib, rename the new file min-eloop-threshold.h. Checked on x86_64-linux-gnu and with a build for x86_64-gnu. Reviewed-by: DJ Delorie --- stdlib/canonicalize.c | 6 ++++-- stdlib/tst-canon-bz26341.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'stdlib') diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c index 528bf49..dca6fca 100644 --- a/stdlib/canonicalize.c +++ b/stdlib/canonicalize.c @@ -36,17 +36,19 @@ #include #include -#include #include #include #include #include #ifdef _LIBC +# include # include # define GCC_LINT 1 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) #else +# include +# define MIN_ELOOP_THRESHOLD __eloop_threshold () # define __canonicalize_file_name canonicalize_file_name # define __realpath realpath # define __strdup strdup @@ -310,7 +312,7 @@ realpath_stk (const char *name, char *resolved, struct realpath_bufs *bufs) } if (0 <= n) { - if (++num_links > __eloop_threshold ()) + if (++num_links > MIN_ELOOP_THRESHOLD) { __set_errno (ELOOP); goto error; diff --git a/stdlib/tst-canon-bz26341.c b/stdlib/tst-canon-bz26341.c index a9b823b..b62b2ca 100644 --- a/stdlib/tst-canon-bz26341.c +++ b/stdlib/tst-canon-bz26341.c @@ -23,7 +23,7 @@ #include #define __sysconf sysconf -#include +#include #include #include #include @@ -54,7 +54,7 @@ create_link (void) /* Create MAXLINKS symbolic links to the temporary filename. On exit, linkname has the last link created. */ char *prevlink = filename; - int maxlinks = __eloop_threshold (); + int maxlinks = MIN_ELOOP_THRESHOLD; for (int i = 0; i < maxlinks; i++) { linkname = xasprintf ("%s%d", filename, i); -- cgit v1.1