summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index 43d429df..06dc76ff 100644
--- a/lib.c
+++ b/lib.c
@@ -2699,6 +2699,18 @@ mem_t *chk_copy_obj(mem_t *orig, size_t size)
return copy;
}
+mem_t *chk_xalloc(ucnum m, ucnum n, val self)
+{
+ ucnum mn = m * n;
+ size_t size = mn;
+
+ if ((m > 0 && mn / m != n) || (ucnum) size != mn)
+ uw_throwf(error_s, lit("~s: memory allocation size overflow"),
+ self, nao);
+
+ return chk_malloc(size);
+}
+
val cons(val car, val cdr)
{
val obj;