change the policy of resizing the buffer when highlighting

Signed-off-by: Le Tan <tamlokveer@gmail.com>
This commit is contained in:
Le Tan 2016-10-20 21:54:56 +08:00
parent 29609f0b65
commit 7d77002c53

View File

@ -206,9 +206,9 @@ void HGMarkdownHighlighter::parseInternal()
if (len == 0) {
return;
} else if (len >= capacity) {
resizeBuffer(qMax(2 * capacity, len + 1));
resizeBuffer(qMax(2 * capacity, len * 2));
} else if (len < (capacity >> 2)) {
resizeBuffer(qMax(capacity >> 1, len + 1));
resizeBuffer(qMax(capacity >> 1, len * 2));
}
memcpy(content, data, len);