[RandomAccessInputStream] Use tstring::resize_uninitialized()
in ReadNBytes()
.
This avoids unnecessarily `memset`ting the bytes that are about to be overwritten. PiperOrigin-RevId: 293855502 Change-Id: Ibad17f55e160b79137564a23ca8beb2c2eafab0b
This commit is contained in:
parent
2761aba394
commit
851a0b6651
@ -35,7 +35,7 @@ Status RandomAccessInputStream::ReadNBytes(int64 bytes_to_read,
|
||||
return errors::InvalidArgument("Cannot read negative number of bytes");
|
||||
}
|
||||
result->clear();
|
||||
result->resize(bytes_to_read);
|
||||
result->resize_uninitialized(bytes_to_read);
|
||||
char* result_buffer = &(*result)[0];
|
||||
StringPiece data;
|
||||
Status s = file_->Read(pos_, bytes_to_read, &data, result_buffer);
|
||||
|
Loading…
Reference in New Issue
Block a user