From fea5ce0f71f94ebb92c0e480508cc375c14ea5d1 Mon Sep 17 00:00:00 2001 From: sakno Date: Wed, 4 Dec 2024 20:58:03 +0200 Subject: [PATCH] Removed goto statement --- src/DotNext/Buffers/BufferWriterSlim.cs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/DotNext/Buffers/BufferWriterSlim.cs b/src/DotNext/Buffers/BufferWriterSlim.cs index 8443bdddc..30c8950f2 100644 --- a/src/DotNext/Buffers/BufferWriterSlim.cs +++ b/src/DotNext/Buffers/BufferWriterSlim.cs @@ -313,23 +313,24 @@ public MemoryOwner 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; }