Refactored StringBuilder into StringStorage

This commit is contained in:
Benoit Blanchon
2020-07-11 17:51:39 +02:00
parent 04c59985a1
commit 1600d39693
13 changed files with 128 additions and 193 deletions

View File

@@ -77,21 +77,16 @@ class MemoryPool {
StringSlot s;
s.value = _left;
s.size = size_t(_right - _left);
_left = _right;
checkInvariants();
return s;
}
void freezeString(StringSlot& s, size_t newSize) {
_left -= (s.size - newSize);
_left = (s.value + newSize);
s.size = newSize;
checkInvariants();
}
void reclaimLastString(const char* s) {
_left = const_cast<char*>(s);
}
void clear() {
_left = _begin;
_right = _end;