aboutsummaryrefslogtreecommitdiffstats
path: root/xalloc.h
diff options
context:
space:
mode:
Diffstat (limited to 'xalloc.h')
-rw-r--r--xalloc.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/xalloc.h b/xalloc.h
index d859278d..5810fc55 100644
--- a/xalloc.h
+++ b/xalloc.h
@@ -281,6 +281,16 @@ xcharalloc (size_t n)
return XNMALLOC (n, char);
}
+/* Allocate S bytes of zeroed memory dynamically, with error checking.
+ There's no need for xnzalloc (N, S), since it would be equivalent
+ to xcalloc (N, S). */
+
+inline void *
+xzalloc (size_t s)
+{
+ return memset (xmalloc (s), 0, s);
+}
+
# endif
# ifdef __cplusplus