]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
xalloc: use check_nonnull() in more places
authorPádraig Brady <P@draigBrady.com>
Mon, 19 Jan 2026 14:17:33 +0000 (14:17 +0000)
committerPádraig Brady <P@draigBrady.com>
Mon, 19 Jan 2026 17:20:14 +0000 (17:20 +0000)
* lib/xmalloc.c (xrealloc, xreallocarray): Use check_nonnull().

ChangeLog
lib/xmalloc.c

index 72b1eaa5c7d6c5da76574837ffd1236f852d9465..27f0a53803fddb43121b25c17c0031b1f3162e84 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2026-01-19  Pádraig Brady  <P@draigBrady.com>
+
+       xalloc: use check_nonnull() in more places
+       * lib/xmalloc.c (xrealloc, xreallocarray): Use check_nonnull().
+
 2026-01-19  Pádraig Brady  <P@draigBrady.com>
 
        xalloc: fix possible elimination of NULL checks
index b889004381b83fe6e3d88f29090f68594dd96246..f00ea5e7a4f37fcb55872ee058218aff6939fc10 100644 (file)
@@ -72,10 +72,7 @@ xcharalloc (size_t n)
 void *
 xrealloc (void *p, size_t s)
 {
-  void *r = realloc (p, s);
-  if (!r)
-    xalloc_die ();
-  return r;
+  return check_nonnull (realloc (p, s));
 }
 
 void *
@@ -90,10 +87,7 @@ xirealloc (void *p, idx_t s)
 void *
 xreallocarray (void *p, size_t n, size_t s)
 {
-  void *r = reallocarray (p, n, s);
-  if (!r)
-    xalloc_die ();
-  return r;
+  return check_nonnull (reallocarray (p, n, s));
 }
 
 void *