There was some uses of TYPE_MAXIMUM (uintmax_t) that I noticed. I guess
intprops.h in gnulib existed before the inttypes.h checks, so this was
more portable at the time. It looked weird to me though, so here is a
patch.

Collin

>From 9439e4eace278baaa0a4b9d090831b67f8e07947 Mon Sep 17 00:00:00 2001
Message-ID: <9439e4eace278baaa0a4b9d090831b67f8e07947.1750827159.git.collin.fu...@gmail.com>
From: Collin Funk <collin.fu...@gmail.com>
Date: Tue, 24 Jun 2025 21:39:20 -0700
Subject: [PATCH] maint: prefer UINTMAX_MAX to TYPE_MAXIMUM (uintmax_t)

* src/df.c (get_dev): Use UINTMAX_MAX.
* src/shred.c (dopass): Likewise.
---
 src/df.c    | 2 +-
 src/shred.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/df.c b/src/df.c
index a969c5c9b..fe2e0e38f 100644
--- a/src/df.c
+++ b/src/df.c
@@ -1174,7 +1174,7 @@ get_dev (char const *device, char const *mount_point, char const *file,
             if (! known_value (v->used) || ! known_value (v->available))
               ;
             else if (!v->negate_used
-                     && v->used <= TYPE_MAXIMUM (uintmax_t) / 100
+                     && v->used <= UINTMAX_MAX / 100
                      && v->used + v->available != 0
                      && (v->used + v->available < v->used)
                      == v->negate_available)
diff --git a/src/shred.c b/src/shred.c
index 03a260243..645822894 100644
--- a/src/shred.c
+++ b/src/shred.c
@@ -562,7 +562,7 @@ dopass (int fd, struct stat const *st, char const *qname, off_t *sizep,
                   uintmax_t off = offset;
                   int percent = (size == 0
                                  ? 100
-                                 : (off <= TYPE_MAXIMUM (uintmax_t) / 100
+                                 : (off <= UINTMAX_MAX / 100
                                     ? off * 100 / size
                                     : off / (size / 100)));
                   char const *human_size
-- 
2.49.0

Reply via email to