From: Paul Eggert Date: Sun, 4 Feb 2024 07:53:13 +0000 (-0800) Subject: xalloc-oversized: omit unnecessary cast X-Git-Tag: v1.0~470 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=78db4b08bfcb12e24d4151e30863ca56666ed549;p=gnulib.git xalloc-oversized: omit unnecessary cast * lib/xalloc-oversized.h (__xalloc_oversized): Omit unnecessary cast of a positive in-range value to size_t. This seems to be left over from an older version of the code. --- diff --git a/ChangeLog b/ChangeLog index 088b866362..5246105f57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2024-02-03 Paul Eggert + xalloc-oversized: omit unnecessary cast + * lib/xalloc-oversized.h (__xalloc_oversized): Omit unnecessary + cast of a positive in-range value to size_t. This seems to be + left over from an older version of the code. + glob: port better to C23 * lib/glob.c: Include . (size_add_wrapv): Remove. All uses replaced by ckd_add. diff --git a/lib/xalloc-oversized.h b/lib/xalloc-oversized.h index 0b7bb2cee8..7f30f83e76 100644 --- a/lib/xalloc-oversized.h +++ b/lib/xalloc-oversized.h @@ -29,8 +29,7 @@ is SIZE_MAX - 1. */ #define __xalloc_oversized(n, s) \ ((s) != 0 \ - && ((size_t) (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) \ - < (n))) + && (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) < (n)) /* Return 1 if and only if an array of N objects, each of size S, cannot exist reliably because its total size in bytes would exceed