diff options
author | bptato <nincsnevem662@gmail.com> | 2024-02-11 15:13:58 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-02-11 15:13:58 +0100 |
commit | dbdb1c0d9a2969606d665a3b7ca76c1b88545402 (patch) | |
tree | be89b10da2a35b86793de9a4c3569457feb8f768 /src | |
parent | 27a47bc9b7ba2fa0e2134bfd14565f11d94289fc (diff) | |
download | chawan-dbdb1c0d9a2969606d665a3b7ca76c1b88545402.tar.gz |
simplify newLoaderBuffer
Diffstat (limited to 'src')
-rw-r--r-- | src/loader/loaderhandle.nim | 7 |
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: |