diff options
author | Ben Smith <binjimin@gmail.com> | 2017-03-06 11:34:37 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-06 11:34:37 -0800 |
commit | e4dda12b17a5323a56b6782a6787f258ed2d8c81 (patch) | |
tree | c47e34928fc9b48f5b8dd1579e4c0213074b6494 /src/binary-writer-spec.cc | |
parent | b6e5735f3bfbb66d76142fc2f404da796289fc76 (diff) | |
download | wabt-e4dda12b17a5323a56b6782a6787f258ed2d8c81.tar.gz wabt-e4dda12b17a5323a56b6782a6787f258ed2d8c81.tar.bz2 wabt-e4dda12b17a5323a56b6782a6787f258ed2d8c81.zip |
Use new/delete instead of malloc/free (#332)
Also switch some void* -> char*, because it removes some unnecessary
casts. C++ does not like void*.
Diffstat (limited to 'src/binary-writer-spec.cc')
-rw-r--r-- | src/binary-writer-spec.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/binary-writer-spec.cc b/src/binary-writer-spec.cc index a0a85405..0903757b 100644 --- a/src/binary-writer-spec.cc +++ b/src/binary-writer-spec.cc @@ -98,7 +98,7 @@ static StringSlice get_basename(const char* s) { static char* get_module_filename(Context* ctx) { size_t buflen = ctx->module_filename_noext.length + 20; - char* str = static_cast<char*>(wabt_alloc(buflen)); + char* str = new char[buflen]; size_t length = snprintf(str, buflen, PRIstringslice ".%" PRIzd ".wasm", WABT_PRINTF_STRING_SLICE_ARG(ctx->module_filename_noext), @@ -327,7 +327,7 @@ static void write_invalid_module(Context* ctx, write_key(ctx, "text"); write_escaped_string_slice(ctx, text); write_raw_module(ctx, filename, module); - wabt_free(filename); + delete [] filename; } static void write_commands(Context* ctx, Script* script) { @@ -364,7 +364,7 @@ static void write_commands(Context* ctx, Script* script) { write_key(ctx, "filename"); write_escaped_string_slice(ctx, get_basename(filename)); write_module(ctx, filename, module); - wabt_free(filename); + delete [] filename; ctx->num_modules++; last_module_index = static_cast<int>(i); break; |