mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 13:49:17 +02:00
fixing string-copy!
This commit is contained in:
parent
c8b5e7343f
commit
c8f3ba78a8
1 changed files with 5 additions and 4 deletions
|
@ -190,10 +190,11 @@
|
|||
|
||||
;; Never use this!
|
||||
(define (string-copy! to at from . o)
|
||||
(let ((start (if (pair? o) (car o) 0))
|
||||
(end (if (and (pair? o) (pair? (cdr o))) (cadr o) (string-length from))))
|
||||
(do ((i at (+ i 1)) (j start (+ i 1)))
|
||||
((>= j end))
|
||||
(let* ((start (if (pair? o) (car o) 0))
|
||||
(end (if (and (pair? o) (pair? (cdr o))) (cadr o) (string-length from)))
|
||||
(limit (min end (+ start (- (string-length to) at)))))
|
||||
(do ((i at (+ i 1)) (j start (+ j 1)))
|
||||
((>= j limit))
|
||||
(string-set! to i (string-ref from j)))))
|
||||
|
||||
(define truncate-quotient quotient)
|
||||
|
|
Loading…
Add table
Reference in a new issue