[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

string-trim-right bug



Hi,

Seth Alves found a bug in the reference implementation for
string-trim-right.  For the full discussion, please see the thread on
the chicken-hackers mailing list:
http://lists.gnu.org/archive/html/chicken-hackers/2014-01/msg00016.html

Attached you can find a patch against the reference implementation
(ported from the one provided by Seth).

Best wishes.
Mario
-- 
http://parenteses.org/mario
--- srfi-13.scm.orig	2014-01-19 20:21:54.751772464 -0200
+++ srfi-13.scm	2014-01-19 20:21:57.999772518 -0200
@@ -1015,7 +1015,7 @@
   (let-optionals* criterion+start+end ((criterion char-set:whitespace) rest)
     (let-string-start+end (start end) string-trim-right s rest
       (cond ((string-skip-right s criterion start end) =>
-	     (lambda (i) (%substring/shared s 0 (+ 1 i))))
+	     (lambda (i) (%substring/shared s start (+ 1 i))))
 	    (else "")))))
 
 (define (string-trim-both s . criterion+start+end)