summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index ad9e04f1..f40831c2 100644
--- a/lib.c
+++ b/lib.c
@@ -2791,6 +2791,15 @@ wchar_t *chk_wmalloc(size_t nwchar)
lit("string operation")));
}
+wchar_t *chk_wrealloc(wchar_t *old, size_t nwchar)
+{
+ size_t size = nwchar * sizeof (wchar_t);
+ if (size < nwchar)
+ uw_throw(error_s, lit("string size overflow"));
+ return coerce(wchar_t *, chk_realloc(convert(mem_t *, old),
+ sizeof (wchar_t) * nwchar));
+}
+
wchar_t *chk_strdup(const wchar_t *str)
{
size_t nchar = wcslen(str) + 1;