Optimize TlBufferParser for empty strings.
GitOrigin-RevId: fb796f93d84a32c90f9420029b89e0f7fe169869
This commit is contained in:
parent
c5f3b2223c
commit
e34058c16f
@ -48,6 +48,9 @@ void TlParser::set_error(const string &error_message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BufferSlice TlBufferParser::as_buffer_slice(Slice slice) {
|
BufferSlice TlBufferParser::as_buffer_slice(Slice slice) {
|
||||||
|
if (slice.empty()) {
|
||||||
|
return BufferSlice();
|
||||||
|
}
|
||||||
if (is_aligned_pointer<4>(slice.data())) {
|
if (is_aligned_pointer<4>(slice.data())) {
|
||||||
return parent_->from_slice(slice);
|
return parent_->from_slice(slice);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user