diff --git a/hilti/runtime/include/types/stream.h b/hilti/runtime/include/types/stream.h index 6ff628296..914c5137d 100644 --- a/hilti/runtime/include/types/stream.h +++ b/hilti/runtime/include/types/stream.h @@ -189,8 +189,6 @@ class Chunk { // only from chain so that it can track any changes. friend class Chain; - void trim(const Offset& o); - // Update offset for current chunk and all others linked from it. void setOffset(Offset o) { auto c = this; diff --git a/hilti/runtime/src/types/stream.cc b/hilti/runtime/src/types/stream.cc index 108a84ca0..fb19a0b4d 100644 --- a/hilti/runtime/src/types/stream.cc +++ b/hilti/runtime/src/types/stream.cc @@ -47,23 +47,6 @@ Chunk::Chunk(const Offset& offset, const std::string& s) : _offset(offset) { } } -void Chunk::trim(const Offset& o) { - assert(o >= _offset && o < _offset + size()); - if ( auto a = std::get_if(&_data) ) { - auto begin = a->second.data() + (o - _offset).Ref(); - auto end = a->second.data() + a->first.Ref(); - a->first = (end - begin); - memmove(a->second.data(), begin, a->first.Ref()); - } - else if ( std::holds_alternative(_data) ) { - auto& v = std::get(_data); - v.erase(v.begin(), v.begin() + static_cast((o - _offset).Ref())); - } - // Nothing to do for gap chunks. - - _offset = o; -} - void Chain::append(std::unique_ptr chunk) { _ensureValid(); _ensureMutable(); @@ -117,8 +100,7 @@ void Chain::trim(const Offset& offset) { } else if ( _head->inRange(offset) ) { - _head->trim(offset); - assert(_head->offset() == offset); + // Perform no trimming inside individual chunks. break; } @@ -128,7 +110,6 @@ void Chain::trim(const Offset& offset) { } _head_offset = offset; - assert(! _head || _head->offset() == offset); } ChainPtr Chain::deepCopy() const {