diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-06-12 06:54:41 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-06-12 06:54:41 -0700 |
commit | 91b4c9db63bc5c96e100dc2e3e864bba53ba1f39 (patch) | |
tree | 36262d526bbe4e358fe53fd126ded9d03f0ebe14 /lib.c | |
parent | 547e1d5b6bf8945ecc3f680bd2dbd88bc4da56d5 (diff) | |
download | txr-91b4c9db63bc5c96e100dc2e3e864bba53ba1f39.tar.gz txr-91b4c9db63bc5c96e100dc2e3e864bba53ba1f39.tar.bz2 txr-91b4c9db63bc5c96e100dc2e3e864bba53ba1f39.zip |
lib: reimplement chk_wmalloc using chk_xalloc.
* lib.c (chk_wmalloc): Drop the incorrect multiplication
overflow test, and just call chk_xalloc.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -2655,10 +2655,8 @@ mem_t *chk_manage_vec(mem_t *old, size_t oldfilled, size_t newfilled, wchar_t *chk_wmalloc(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_malloc(sizeof (wchar_t) * nwchar)); + return coerce(wchar_t *, chk_xalloc(nwchar, sizeof (wchar_t), + lit("string operation"))); } wchar_t *chk_strdup(const wchar_t *str) |