refactore a bit more, increase escape shifting performance

This commit is contained in:
ado
2021-02-06 00:55:05 +01:00
parent f973f404be
commit 42629c39c4
2 changed files with 45 additions and 43 deletions

View File

@@ -285,10 +285,10 @@ private:
void undo_remove_eol(size_t& string_end) {
if (crlf) {
memcpy(next_line_buffer_ + string_end, "\r\n\0", 3);
std::copy_n("\r\n\0", 3, next_line_buffer_ + string_end);
string_end += 2;
} else {
memcpy(next_line_buffer_ + string_end, "\n\0", 2);
std::copy_n("\n\0", 2, next_line_buffer_ + string_end);
string_end += 1;
}
}
@@ -311,7 +311,7 @@ private:
first = static_cast<char*>(realloc(static_cast<void*>(first),
first_size + second_size + 2));
memcpy(first + first_size, second, second_size + 1);
std::copy_n(second, second_size + 1, first + first_size);
first_size += second_size;
}