Skip to content

Commit

Permalink
Removed goto statement
Browse files Browse the repository at this point in the history
  • Loading branch information
sakno committed Dec 4, 2024
1 parent 72dec0b commit fea5ce0
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/DotNext/Buffers/BufferWriterSlim.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,23 +313,24 @@ public MemoryOwner<T> DetachOrCopyBuffer()
if (position is 0)
{
result = default;
goto exit;
}
else if (NoOverflow)
{
result = allocator.AllocateExactly(position);
initialBuffer.CopyTo(result.Span);
}
else
{
result = extraBuffer;
extraBuffer = default;
}
if (NoOverflow)
{
result = allocator.AllocateExactly(position);
initialBuffer.CopyTo(result.Span);
}
else
{
result = extraBuffer;
extraBuffer = default;
}

result.Truncate(position);
position = 0;
result.Truncate(position);
position = 0;
}

exit:
return result;
}

Expand Down

0 comments on commit fea5ce0

Please sign in to comment.