bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/3] stat-time: prefer stdckdint to intprops


From: Paul Eggert
Subject: [PATCH 2/3] stat-time: prefer stdckdint to intprops
Date: Mon, 10 Oct 2022 18:45:44 -0700

* lib/stat-time.h: Include stdckdint.h instead of intprops.h.
(stat_time_normalize): Use ckd_add instead of INT_ADD_WRAPV.
* modules/stat-time (Depends-on): Depend on stdckdint, not intprops.
---
 ChangeLog         | 5 +++++
 lib/stat-time.h   | 5 ++---
 modules/stat-time | 2 +-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c918d0e45e..0827f5c772 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2022-10-10  Paul Eggert  <eggert@cs.ucla.edu>
 
+       stat-time: prefer stdckdint to intprops
+       * lib/stat-time.h: Include stdckdint.h instead of intprops.h.
+       (stat_time_normalize): Use ckd_add instead of INT_ADD_WRAPV.
+       * modules/stat-time (Depends-on): Depend on stdckdint, not intprops.
+
        xalloc: remove stray includes + dependencies
        These used to be needed, but are not needed now.
        * lib/xalloc.h: Do not include stdlib.h.
diff --git a/lib/stat-time.h b/lib/stat-time.h
index 6b0088e328..b661196ea5 100644
--- a/lib/stat-time.h
+++ b/lib/stat-time.h
@@ -20,9 +20,8 @@
 #ifndef STAT_TIME_H
 #define STAT_TIME_H 1
 
-#include "intprops.h"
-
 #include <errno.h>
+#include <stdckdint.h>
 #include <stddef.h>
 #include <sys/stat.h>
 #include <time.h>
@@ -232,7 +231,7 @@ stat_time_normalize (int result, _GL_UNUSED struct stat *st)
           /* Overflow is possible, as Solaris 11 stat can yield
              tv_sec == TYPE_MINIMUM (time_t) && tv_nsec == -1000000000.
              INT_ADD_WRAPV is OK, since time_t is signed on Solaris.  */
-          if (INT_ADD_WRAPV (q, ts->tv_sec, &ts->tv_sec))
+          if (ckd_add (&ts->tv_sec, q, ts->tv_sec))
             {
               errno = EOVERFLOW;
               return -1;
diff --git a/modules/stat-time b/modules/stat-time
index 2f137fc25d..92120ace8c 100644
--- a/modules/stat-time
+++ b/modules/stat-time
@@ -11,7 +11,7 @@ time
 errno
 extensions
 extern-inline
-intprops
+stdckdint
 
 configure.ac:
 gl_STAT_TIME
-- 
2.37.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]