public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/siddhesh/realpath-and-getcwd] move get_path_max in
@ 2022-01-18  8:37 Siddhesh Poyarekar
  0 siblings, 0 replies; only message in thread
From: Siddhesh Poyarekar @ 2022-01-18  8:37 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=fdab6828f524c6bb309e2936627a091739b26678

commit fdab6828f524c6bb309e2936627a091739b26678
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Tue Jan 18 14:07:18 2022 +0530

    move get_path_max in

Diff:
---
 support/temp_file.c | 19 ++++++++++++++++---
 support/temp_file.h | 13 -------------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/support/temp_file.c b/support/temp_file.c
index aacc9451e5..c3e83912ac 100644
--- a/support/temp_file.c
+++ b/support/temp_file.c
@@ -46,6 +46,19 @@ static const char *test_dir = _PATH_TMP;
 /* Name of subdirectories in a too long temporary directory tree.  */
 static char toolong_subdir[NAME_MAX + 1];
 
+/* Return the maximum size of path on the target.  */
+static inline size_t
+get_path_max (void)
+{
+#ifdef PATH_MAX
+  return PATH_MAX;
+#else
+  size_t path_max = pathconf ("/", _PC_PATH_MAX);
+  return (path_max < 0 ? 1024
+	  : path_max <= PTRDIFF_MAX ? path_max : PTRDIFF_MAX);
+#endif
+}
+
 static void
 add_temp_file_internal (const char *name, bool toolong)
 {
@@ -134,7 +147,7 @@ ensure_toolong_subdir_initialized (void)
 char *
 support_create_and_chdir_toolong_temp_directory (const char *basename)
 {
-  size_t path_max = support_get_path_max ();
+  size_t path_max = get_path_max ();
 
   char *base = create_temp_directory_internal (basename, true);
 
@@ -170,7 +183,7 @@ support_create_and_chdir_toolong_temp_directory (const char *basename)
 void
 support_chdir_toolong_temp_directory (const char *base)
 {
-  size_t path_max = support_get_path_max ();
+  size_t path_max = get_path_max ();
   ensure_toolong_subdir_initialized ();
 
   if (chdir (base) != 0)
@@ -192,7 +205,7 @@ support_chdir_toolong_temp_directory (const char *base)
 static void
 remove_toolong_subdirs (const char *base)
 {
-  size_t path_max = support_get_path_max ();
+  size_t path_max = get_path_max ();
 
   ensure_toolong_subdir_initialized ();
 
diff --git a/support/temp_file.h b/support/temp_file.h
index 5f104442b6..de01fbbceb 100644
--- a/support/temp_file.h
+++ b/support/temp_file.h
@@ -25,19 +25,6 @@
 
 __BEGIN_DECLS
 
-/* Return the maximum size of path on the target.  */
-static inline size_t
-support_get_path_max (void)
-{
-#ifdef PATH_MAX
-  return PATH_MAX;
-#else
-  size_t path_max = pathconf ("/", _PC_PATH_MAX);
-  return (path_max < 0 ? 1024
-	  : path_max <= PTRDIFF_MAX ? path_max : PTRDIFF_MAX);
-#endif
-}
-
 /* Schedule a temporary file for deletion on exit.  */
 void add_temp_file (const char *name);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-18  8:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-18  8:37 [glibc/siddhesh/realpath-and-getcwd] move get_path_max in Siddhesh Poyarekar

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).