Skip to content

Commit fea5ce0

Browse files
committed
Removed goto statement
1 parent 72dec0b commit fea5ce0

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/DotNext/Buffers/BufferWriterSlim.cs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -313,23 +313,24 @@ public MemoryOwner<T> DetachOrCopyBuffer()
313313
if (position is 0)
314314
{
315315
result = default;
316-
goto exit;
317-
}
318-
else if (NoOverflow)
319-
{
320-
result = allocator.AllocateExactly(position);
321-
initialBuffer.CopyTo(result.Span);
322316
}
323317
else
324318
{
325-
result = extraBuffer;
326-
extraBuffer = default;
327-
}
319+
if (NoOverflow)
320+
{
321+
result = allocator.AllocateExactly(position);
322+
initialBuffer.CopyTo(result.Span);
323+
}
324+
else
325+
{
326+
result = extraBuffer;
327+
extraBuffer = default;
328+
}
328329

329-
result.Truncate(position);
330-
position = 0;
330+
result.Truncate(position);
331+
position = 0;
332+
}
331333

332-
exit:
333334
return result;
334335
}
335336

0 commit comments

Comments
 (0)