I've pushed this patch using stdckdint.h instead of intprops.h in
ftello. I think this should be the last occurrence of the
INT_*_OK/INT_*_WRAPV that wasn't yet converted.

Also, nice work on the stdio.h / stdio_ext.h replacements. They look
like they took a while. :)

Collin
From ee4be3987b5bfb87a2d5a21c269d2f1ea249a316 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Wed, 8 May 2024 18:55:51 -0700
Subject: [PATCH] ftello: Prefer stdckdint to intprops.

* lib/ftello.c (ftello): Include stdckdint.h instead of intprops.h.
Prefer ckd_add to INT_ADD_OK.
* modules/ftello (Depends-on): Depend on stdckdint instead of intprops.
---
 ChangeLog      | 7 +++++++
 lib/ftello.c   | 4 ++--
 modules/ftello | 2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 07e34a87ed..33d4c2791c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-05-08  Collin Funk  <collin.fu...@gmail.com>
+
+	ftello: Prefer stdckdint to intprops.
+	* lib/ftello.c (ftello): Include stdckdint.h instead of intprops.h.
+	Prefer ckd_add to INT_ADD_OK.
+	* modules/ftello (Depends-on): Depend on stdckdint instead of intprops.
+
 2024-05-08  Bruno Haible  <br...@clisp.org>
 
 	sigsegv, c-stack tests: Avoid test failures with ASAN.
diff --git a/lib/ftello.c b/lib/ftello.c
index 64119aabf1..88247bca8e 100644
--- a/lib/ftello.c
+++ b/lib/ftello.c
@@ -20,7 +20,7 @@
 #include <stdio.h>
 
 #include <errno.h>
-#include "intprops.h"
+#include <stdckdint.h>
 
 /* Get lseek.  */
 #include <unistd.h>
@@ -97,7 +97,7 @@ ftello (FILE *fp)
 
       /* Compute pos + buffered, with overflow check.  */
       off_t sum;
-      if (! INT_ADD_OK (pos, buffered, &sum))
+      if (ckd_add (&sum, pos, buffered))
         {
           errno = EOVERFLOW;
           return -1;
diff --git a/modules/ftello b/modules/ftello
index d5cf73468a..7a29e6d581 100644
--- a/modules/ftello
+++ b/modules/ftello
@@ -14,7 +14,7 @@ extensions
 largefile
 sys_types
 lseek           [test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1]
-intprops        [test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1]
+stdckdint       [test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1]
 # Just to guarantee consistency between ftell() and ftello().
 ftell
 
-- 
2.45.0

Reply via email to