]> Savannah Git Hosting - gnulib.git/commitdiff
memchr,strncat: prefer sysconf (_SC_PAGESIZE)
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 14 Jun 2024 17:42:40 +0000 (10:42 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 14 Jun 2024 20:19:02 +0000 (13:19 -0700)
* 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
m4/memchr.m4
m4/strncat.m4

index 84c773b9303e90c195cc15df534f0bad5575af53..d1939c141814d126f1c2a3841acdc60acefeba95 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2024-06-14  Paul Eggert  <eggert@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.
index 346a288210b95fdd0a38b1f5fcd6552181e1876e..31ff2dacffdecacffa8fc72c6040de6f9ddc5899 100644 (file)
@@ -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);
index a71d89297afa5614d0a2b73ab0d2d9063f79fc19..9bff2cd2560aef1b59559408ba0f5e66aa7edc65 100644 (file)
@@ -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);