[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/14] stdlib: simplify preprocessor conditionals
From: |
Paul Eggert |
Subject: |
[PATCH 06/14] stdlib: simplify preprocessor conditionals |
Date: |
Mon, 4 Nov 2024 21:43:26 -0800 |
* lib/stdlib.in.h: Omit some redundant tests in conditionals.
---
ChangeLog | 3 +++
lib/stdlib.in.h | 6 +++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ccad8e84f6..c4c453a6c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2024-11-04 Paul Eggert <eggert@cs.ucla.edu>
+ stdlib: simplify preprocessor conditionals
+ * lib/stdlib.in.h: Omit some redundant tests in conditionals.
+
realloc: don’t require success for nongrowth
* lib/realloc.c (rpl_realloc): Do not require realloc (p, 0) to
succeed, as apparently glibc realloc (p, n) can sometimes fail
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 9d82f35b00..855038327e 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -367,7 +367,7 @@ _GL_WARN_ON_USE (atoll, "atoll is unportable - "
#endif
#if @GNULIB_CALLOC_POSIX@
-# if (@GNULIB_CALLOC_POSIX@ && @REPLACE_CALLOC_FOR_CALLOC_POSIX@) \
+# if @REPLACE_CALLOC_FOR_CALLOC_POSIX@ \
|| (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@)
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef calloc
@@ -681,7 +681,7 @@ _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
by never specifying a zero size), so it does not need malloc or
realloc to be redefined. */
#if @GNULIB_MALLOC_POSIX@
-# if (@GNULIB_MALLOC_POSIX@ && @REPLACE_MALLOC_FOR_MALLOC_POSIX@) \
+# if @REPLACE_MALLOC_FOR_MALLOC_POSIX@ \
|| (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@)
# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
|| _GL_USE_STDLIB_ALLOC)
@@ -1454,7 +1454,7 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
#if @GNULIB_REALLOC_POSIX@
-# if (@GNULIB_REALLOC_POSIX@ && @REPLACE_REALLOC_FOR_REALLOC_POSIX@)
+# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@
# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
|| _GL_USE_STDLIB_ALLOC)
# undef realloc
--
2.43.0
- [PATCH 01/14] calloc: depend on stdckdint not xalloc-oversized, Paul Eggert, 2024/11/05
- [PATCH 02/14] malloc-gnu: depend on stdckdint not xalloc-oversized, Paul Eggert, 2024/11/05
- [PATCH 03/14] calloc: configure more like malloc, Paul Eggert, 2024/11/05
- [PATCH 04/14] calloc, malloc: tune a bit, Paul Eggert, 2024/11/05
- [PATCH 05/14] realloc: don’t require success for nongrowth, Paul Eggert, 2024/11/05
- [PATCH 06/14] stdlib: simplify preprocessor conditionals,
Paul Eggert <=
- [PATCH 07/14] realloc-posix: realloc (..., 0) now returns nonnull, Paul Eggert, 2024/11/05
- [PATCH 08/14] realloc-posix: set CHERI bounds, Paul Eggert, 2024/11/05
- [PATCH 09/14] stdlib: make MB_CUR_MAX usable from extern inline, Paul Eggert, 2024/11/05
- [PATCH 10/14] realloc-posix: use _GL_USE_STDLIB_ALLOC, Paul Eggert, 2024/11/05
- [PATCH 11/14] realloc-posix: tune for glibc-like, Paul Eggert, 2024/11/05