From 4e119128f89115dc5e1b00c00c2567ad550a04c3 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 9 Jan 2016 15:46:15 -0800 Subject: New internal function for copying malloced object. * lib.c (chk_copy_obj): New function. * lib.h (chk_copy_obj): Declared. --- lib.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib.c') diff --git a/lib.c b/lib.c index 44ef6b0e..7c45907f 100644 --- a/lib.c +++ b/lib.c @@ -2358,6 +2358,14 @@ char *chk_strdup_utf8(const char *str) return copy; } +mem_t *chk_copy_obj(mem_t *orig, size_t size) +{ + mem_t *copy = chk_malloc(size); + assert (!async_sig_enabled); + memcpy(copy, orig, size); + return copy; +} + val cons(val car, val cdr) { val obj = make_obj(); -- cgit v1.2.3