diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-04-28 09:58:22 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-04-28 09:58:22 -0700 |
commit | 5b29a636cb092bcc9e21568db0dfe845538d34c0 (patch) | |
tree | fe0984337244b926501bc852664d9aee78c1f807 /src/wasm-binary.h | |
parent | 6a6bdc1cef5ec35cb9f7caf6e10ec76ee1107d0d (diff) | |
download | binaryen-5b29a636cb092bcc9e21568db0dfe845538d34c0.tar.gz binaryen-5b29a636cb092bcc9e21568db0dfe845538d34c0.tar.bz2 binaryen-5b29a636cb092bcc9e21568db0dfe845538d34c0.zip |
avoid dynamic allocas (#410)
Diffstat (limited to 'src/wasm-binary.h')
-rw-r--r-- | src/wasm-binary.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 91fe91b49..e9845a1fb 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -1550,11 +1550,12 @@ public: Memory::Segment curr; auto offset = getU32LEB(); auto size = getU32LEB(); - char buffer[size]; + std::vector<char> buffer; + buffer.resize(size); for (size_t j = 0; j < size; j++) { buffer[j] = char(getInt8()); } - wasm.memory.segments.emplace_back(offset, (const char*)buffer, size); + wasm.memory.segments.emplace_back(offset, (const char*)&buffer[0], size); } } |