Skip to content

Commit edef8d8

Browse files
authored
Inflection 134 std::unique_ptr for Chunk.cpp (#145)
1 parent 128b07e commit edef8d8

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

inflection/src/inflection/tokenizer/Chunk.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ Chunk::Chunk(Token* start, Token* end, bool adoptTokens)
2727
Chunk::~Chunk()
2828
{
2929
if (ownTokens) {
30-
auto curr = this->start_;
30+
std::unique_ptr<Token> curr(this->start_);
3131
while (curr != nullptr) {
32-
auto next = npc(curr)->getNext();
33-
delete curr;
34-
curr = next;
32+
curr.reset(curr->getNext());
3533
}
3634
}
3735
}

0 commit comments

Comments
 (0)