* m4/memchr.m4 (gl_FUNC_MEMCHR):
* m4/strncat.m4 (gl_FUNC_STRNCAT):
Use sysconf (_SC_PAGESIZE) instead of getpagesize, as it’s
in POSIX and there’s no point to worrying about getpagesize
performance advantages here.
---
 ChangeLog     | 7 +++++++
 m4/memchr.m4  | 4 ++--
 m4/strncat.m4 | 4 ++--
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 84c773b930..d1939c1418 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2024-06-14  Paul Eggert  <egg...@cs.ucla.edu>
 
+       memchr,strncat: prefer sysconf (_SC_PAGESIZE)
+       * m4/memchr.m4 (gl_FUNC_MEMCHR):
+       * m4/strncat.m4 (gl_FUNC_STRNCAT):
+       Use sysconf (_SC_PAGESIZE) instead of getpagesize, as it’s
+       in POSIX and there’s no point to worrying about getpagesize
+       performance advantages here.
+
        getcwd: simplify abort bug checking
        * m4/getcwd-abort-bug.m4 (gl_FUNC_GETCWD_ABORT_BUG): Don’t invoke
        gl_CHECK_FUNC_GETPAGESIZE or #define or use HAVE_GETPAGESIZE.
diff --git a/m4/memchr.m4 b/m4/memchr.m4
index 346a288210..31ff2dacff 100644
--- a/m4/memchr.m4
+++ b/m4/memchr.m4
@@ -1,5 +1,5 @@
 # memchr.m4
-# serial 19
+# serial 20
 dnl Copyright (C) 2002-2004, 2009-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -49,7 +49,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
   if (fd >= 0)
 # endif
     {
-      int pagesize = getpagesize ();
+      long int pagesize = sysconf (_SC_PAGESIZE);
       char *two_pages =
         (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
                        flags, fd, 0);
diff --git a/m4/strncat.m4 b/m4/strncat.m4
index a71d89297a..9bff2cd256 100644
--- a/m4/strncat.m4
+++ b/m4/strncat.m4
@@ -1,5 +1,5 @@
 # strncat.m4
-# serial 8
+# serial 9
 dnl Copyright (C) 2002-2004, 2009-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -45,7 +45,7 @@ AC_DEFUN_ONCE([gl_FUNC_STRNCAT],
   if (fd >= 0)
 # endif
     {
-      int pagesize = getpagesize ();
+      long int pagesize = sysconf (_SC_PAGESIZE);
       char *two_pages =
         (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
                        flags, fd, 0);
-- 
2.45.2


Reply via email to