~ chicken-core (chicken-5) 250fa01d489c8a9571fa256f402c4ea4df22246b
commit 250fa01d489c8a9571fa256f402c4ea4df22246b
Author: Mario Domenech Goulart <mario.goulart@gmail.com>
AuthorDate: Thu Jun 28 10:46:03 2012 -0300
Commit: Peter Bex <peter.bex@xs4all.nl>
CommitDate: Fri Jun 29 20:51:00 2012 +0200
Avoid using / in xsubstring and string-xcopy!, since srfi-13 is compiled with (declare (fixnum))
This patch fixes #869
Signed-off-by: Peter Bex <peter.bex@xs4all.nl>
diff --git a/srfi-13.scm b/srfi-13.scm
index e4a0509b..3dbc2cac 100644
--- a/srfi-13.scm
+++ b/srfi-13.scm
@@ -1766,10 +1766,16 @@
((= 1 slen) ; Fast path for 1-char replication.
(make-string anslen (string-ref s start)))
+ ;; CHICKEN compiles this file with (declare (fixnum)), so
+ ;; flonum operations are not reliable. Since this clause
+ ;; just provides a shorter path to avoid calling
+ ;; %multispan-repcopy!, we comment it out and leave the
+ ;; fixnum declaration.
+ ;;
;; Selected text falls entirely within one span.
- ((= (floor (/ from slen)) (floor (/ to slen)))
- (##sys#substring s (+ start (modulo from slen))
- (+ start (modulo to slen))))
+ ;; ((= (floor (/ from slen)) (floor (/ to slen)))
+ ;; (##sys#substring s (+ start (modulo from slen))
+ ;; (+ start (modulo to slen))))
;; Selected text requires multiple spans.
(else (let ((ans (make-string anslen)))
@@ -1813,11 +1819,17 @@
((= 1 slen) ; Fast path for 1-char replication.
(##srfi13#string-fill! target (string-ref s start) tstart tend))
+ ;; CHICKEN compiles this file with (declare (fixnum)), so
+ ;; flonum operations are not reliable. Since this clause
+ ;; just provides a shorter path to avoid calling
+ ;; %multispan-repcopy!, we comment it out and leave the
+ ;; fixnum declaration.
+ ;;
;; Selected text falls entirely within one span.
- ((= (floor (/ sfrom slen)) (floor (/ sto slen)))
- (%string-copy! target tstart s
- (+ start (modulo sfrom slen))
- (+ start (modulo sto slen))))
+ ;; ((= (floor (/ sfrom slen)) (floor (/ sto slen)))
+ ;; (%string-copy! target tstart s
+ ;; (+ start (modulo sfrom slen))
+ ;; (+ start (modulo sto slen))))
;; Multi-span copy.
(else (%multispan-repcopy! target tstart s sfrom sto start end))))))
Trap