[libc-commits] [libc] [libc] Declare reallocarray in stdlib.h / malloc.h (PR #184223)

Roland McGrath via libc-commits libc-commits at lists.llvm.org
Mon Mar 2 12:46:18 PST 2026


https://github.com/frobtech created https://github.com/llvm/llvm-project/pull/184223

Scudo now provides reallocarray, so declare it.


>From b09d657bc96ba0319a6a7a39d4195087cbed78e1 Mon Sep 17 00:00:00 2001
From: Roland McGrath <mcgrathr at google.com>
Date: Mon, 2 Mar 2026 12:45:04 -0800
Subject: [PATCH] [libc] Declare reallocarray in stdlib.h / malloc.h

Scudo now provides reallocarray, so declare it.
---
 libc/include/stdlib-malloc.yaml | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/libc/include/stdlib-malloc.yaml b/libc/include/stdlib-malloc.yaml
index 51c11f5602e2c..e1dab21bfc213 100644
--- a/libc/include/stdlib-malloc.yaml
+++ b/libc/include/stdlib-malloc.yaml
@@ -1,10 +1,5 @@
 # This file has declarations that appear both in <stdlib.h> and in <malloc.h>.
 # These include the subset of GNU extensions that Scudo supports.
-#
-# Note: glibc's <stdlib.h> and <malloc.h> both also have `reallocarray`,
-# which Scudo does not support and is omitted here.  (Each of those glibc
-# headers also has related functions the other lacks, but those should be
-# covered separately in stdlib.yaml and malloc.yaml instead.)
 
 functions:
   - name: aligned_alloc
@@ -47,6 +42,15 @@ functions:
     arguments:
       - type: void *
       - type: size_t
+  - name: reallocarray
+    standards:
+      - bsd
+      - gnu
+    return_type: void *
+    arguments:
+      - type: void *
+      - type: size_t
+      - type: size_t
   - name: valloc
     standards:
       - bsd



More information about the libc-commits mailing list