summaryrefslogtreecommitdiff
path: root/snappy.cc
diff options
context:
space:
mode:
authorckennelly <ckennelly@google.com>2016-05-26 14:51:33 -0700
committerAlkis Evlogimenos <alkis@google.com>2017-01-26 21:35:55 +0100
commite788e527d3d16db4059f92291c7806fe273c8f67 (patch)
tree7a1f099fbdba40394c1fc862bb3fa2df53fb1bb4 /snappy.cc
parent32d6d7d8a2ef328a2ee1dd40f072e21f4983ebda (diff)
downloadsnappy-e788e527d3d16db4059f92291c7806fe273c8f67.tar.gz
snappy-e788e527d3d16db4059f92291c7806fe273c8f67.tar.bz2
snappy-e788e527d3d16db4059f92291c7806fe273c8f67.zip
Avoid calling memset when resizing the buffer.
This buffer will be initialized and then trimmed down to size during the compression phase.
Diffstat (limited to 'snappy.cc')
-rw-r--r--snappy.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/snappy.cc b/snappy.cc
index 8a3668c..957d82f 100644
--- a/snappy.cc
+++ b/snappy.cc
@@ -1151,7 +1151,7 @@ void RawCompress(const char* input,
size_t Compress(const char* input, size_t input_length, string* compressed) {
// Pre-grow the buffer to the max length of the compressed output
- compressed->resize(MaxCompressedLength(input_length));
+ STLStringResizeUninitialized(compressed, MaxCompressedLength(input_length));
size_t compressed_length;
RawCompress(input, input_length, string_as_array(compressed),