about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-02-11 15:13:58 +0100
committerbptato <nincsnevem662@gmail.com>2024-02-11 15:13:58 +0100
commitdbdb1c0d9a2969606d665a3b7ca76c1b88545402 (patch)
treebe89b10da2a35b86793de9a4c3569457feb8f768 /src
parent27a47bc9b7ba2fa0e2134bfd14565f11d94289fc (diff)
downloadchawan-dbdb1c0d9a2969606d665a3b7ca76c1b88545402.tar.gz
simplify newLoaderBuffer
Diffstat (limited to 'src')
-rw-r--r--src/loader/loaderhandle.nim7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/loader/loaderhandle.nim b/src/loader/loaderhandle.nim
index 579c553d..7a0e893a 100644
--- a/src/loader/loaderhandle.nim
+++ b/src/loader/loaderhandle.nim
@@ -81,11 +81,10 @@ proc `len=`*(buffer: LoaderBuffer, i: int) {.inline.} =
   buffer[].len = i
 
 proc newLoaderBuffer*(): LoaderBuffer =
-  let buffer = LoaderBuffer(
-    page: cast[ptr UncheckedArray[uint8]](alloc(LoaderBufferPageSize))
+  return LoaderBuffer(
+    page: cast[ptr UncheckedArray[uint8]](alloc(LoaderBufferPageSize)),
+    len: 0
   )
-  buffer.len = 0
-  return buffer
 
 proc addBuffer*(output: OutputHandle, buffer: LoaderBuffer) =
   if output.currentBuffer == nil: