From: Paul Eggert <eggert@cs.ucla.edu>
To: bug-gnulib@gnu.org
Cc: Paul Eggert <eggert@cs.ucla.edu>
Subject: [PATCH] xalloc-oversized: omit unnecessary cast
Date: Sat, 3 Feb 2024 23:54:11 -0800 [thread overview]
Message-ID: <20240204075411.771793-1-eggert@cs.ucla.edu> (raw)
* 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 | 5 +++++
lib/xalloc-oversized.h | 3 +--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 088b866362..5246105f57 100644
--- 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.
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
--
2.40.1
reply other threads:[~2024-02-04 7:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240204075411.771793-1-eggert@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=bug-gnulib@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).