summaryrefslogtreecommitdiff
path: root/os
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2015-03-21 09:28:07 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2015-04-21 16:57:08 -0700
commitae75d50395fdd7a6bc382ba73e923c460764c702 (patch)
tree17087211fde038f5840535201c0c8768ed1e191a /os
parentc213b29d14aaf2f4523d638abc762eaaa873cf83 (diff)
Add no-fail equivalents of allocarray & reallocarray
v2: Remove extra 's' from comment Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'os')
-rw-r--r--os/utils.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/os/utils.c b/os/utils.c
index 24a87516e..23f41173a 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1158,6 +1158,16 @@ XNFrealloc(void *ptr, unsigned long amount)
return ret;
}
+void *
+XNFreallocarray(void *ptr, size_t nmemb, size_t size)
+{
+ void *ret = reallocarray(ptr, nmemb, size);
+
+ if (!ret)
+ FatalError("XNFreallocarray: Out of memory");
+ return ret;
+}
+
char *
Xstrdup(const char *s)
{