[llvm] 7a529ad - [Support] Don't initialize buffer allocated by zlib::uncompress
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Sun May 3 06:02:13 PDT 2020
Author: Benjamin Kramer
Date: 2020-05-03T15:01:52+02:00
New Revision: 7a529ad2c142eb77ff1140e166fb85242d4cf05f
URL: https://github.com/llvm/llvm-project/commit/7a529ad2c142eb77ff1140e166fb85242d4cf05f
DIFF: https://github.com/llvm/llvm-project/commit/7a529ad2c142eb77ff1140e166fb85242d4cf05f.diff
LOG: [Support] Don't initialize buffer allocated by zlib::uncompress
This is a somewhat annoying API, but not without precedend in this low
level API.
Added:
Modified:
llvm/lib/Support/Compression.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Support/Compression.cpp b/llvm/lib/Support/Compression.cpp
index 97d5ffaadf82..27d92f0e0aec 100644
--- a/llvm/lib/Support/Compression.cpp
+++ b/llvm/lib/Support/Compression.cpp
@@ -74,10 +74,10 @@ Error zlib::uncompress(StringRef InputBuffer, char *UncompressedBuffer,
Error zlib::uncompress(StringRef InputBuffer,
SmallVectorImpl<char> &UncompressedBuffer,
size_t UncompressedSize) {
- UncompressedBuffer.resize(UncompressedSize);
+ UncompressedBuffer.reserve(UncompressedSize);
Error E =
uncompress(InputBuffer, UncompressedBuffer.data(), UncompressedSize);
- UncompressedBuffer.resize(UncompressedSize);
+ UncompressedBuffer.set_size(UncompressedSize);
return E;
}
More information about the llvm-commits
mailing list