summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Compression.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/Compression.cpp')
-rw-r--r--llvm/lib/Support/Compression.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/Compression.cpp b/llvm/lib/Support/Compression.cpp
index c279d10f6c6..05bd7b58e08 100644
--- a/llvm/lib/Support/Compression.cpp
+++ b/llvm/lib/Support/Compression.cpp
@@ -61,7 +61,7 @@ Error zlib::compress(StringRef InputBuffer,
SmallVectorImpl<char> &CompressedBuffer,
CompressionLevel Level) {
unsigned long CompressedSize = ::compressBound(InputBuffer.size());
- CompressedBuffer.resize(CompressedSize);
+ CompressedBuffer.reserve(CompressedSize);
int CLevel = encodeZlibCompressionLevel(Level);
int Res = ::compress2((Bytef *)CompressedBuffer.data(), &CompressedSize,
(const Bytef *)InputBuffer.data(), InputBuffer.size(),
@@ -69,7 +69,7 @@ Error zlib::compress(StringRef InputBuffer,
// Tell MemorySanitizer that zlib output buffer is fully initialized.
// This avoids a false report when running LLVM with uninstrumented ZLib.
__msan_unpoison(CompressedBuffer.data(), CompressedSize);
- CompressedBuffer.resize(CompressedSize);
+ CompressedBuffer.set_size(CompressedSize);
return Res ? createError(convertZlibCodeToString(Res)) : Error::success();
}
OpenPOWER on IntegriCloud