diff options
author | David Thompson <dthompson2@worcester.edu> | 2021-04-29 08:19:08 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2021-04-29 08:19:08 -0400 |
commit | 10f53b84bc57fa4ce0d1646365f740b689b0e4b1 (patch) | |
tree | 49545bd8d8b44b2473c9051a40f3dd69a5dc648a | |
parent | 87730c7d9ba00d6fc024594a05cb5d0e6e000dde (diff) |
ring-buffer: Reset length to 0 in ring-buffer-clear!
-rw-r--r-- | starling/ring-buffer.scm | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/starling/ring-buffer.scm b/starling/ring-buffer.scm index 1138755..e4f18d7 100644 --- a/starling/ring-buffer.scm +++ b/starling/ring-buffer.scm @@ -54,11 +54,11 @@ (vector-length v)))))) (define (ring-buffer-clear! ring) - (let ((l (ring-buffer-length ring)) - (v (ring-buffer-vector ring))) + (let ((v (ring-buffer-vector ring))) (set-ring-buffer-head! ring 0) (set-ring-buffer-tail! ring 0) + (set-ring-buffer-length! ring 0) (let loop ((i 0)) - (when (< i l) + (when (< i (vector-length v)) (vector-set! v i #f) (loop (+ i 1)))))) |