]> Savannah Git Hosting - gnulib.git/commitdiff
xalloc-oversized: omit unnecessary cast
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 4 Feb 2024 07:53:13 +0000 (23:53 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 4 Feb 2024 07:53:41 +0000 (23:53 -0800)
* 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.

ChangeLog
lib/xalloc-oversized.h

index 088b866362222270f3fa5a8a314bcd14ba68b13c..5246105f57fe33944dd79159f9f08f98814799c8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2024-02-03  Paul Eggert  <eggert@cs.ucla.edu>
 
+       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 <stdckdint.h>.
        (size_add_wrapv): Remove.  All uses replaced by ckd_add.
index 0b7bb2cee85ae0845b413598f4b33ffd70bfab16..7f30f83e7693b65e4a611abde3d3df818e7f5d47 100644 (file)
@@ -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