From: Alfredo Beaumont Date: Wed, 24 Apr 2013 14:40:16 +0000 (+0200) Subject: !parse-integer: trailing whitespace also increments index, when junk X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=9ed43a93fd7f52e7e229ff356fcc164ef66a23e8;p=jscl.git !parse-integer: trailing whitespace also increments index, when junk is not found --- diff --git a/ecmalisp.lisp b/ecmalisp.lisp index f177605..cd93750 100644 --- a/ecmalisp.lisp +++ b/ecmalisp.lisp @@ -1152,11 +1152,12 @@ (unless digit (return)) (setq value (+ (* value 10) digit)) (incf index))) + ;; Trailing whitespace + (do ((i index (1+ i))) + ((or (= i size) (not (whitespacep (char string i)))) + (and (= i size) (setq index i)))) (if (or junk-allow - (= index size) - (do ((i index (1+ i))) - ((or (>= i size) (not (whitespacep (char string i)))) - (>= i size)))) + (= index size)) (values (* sign value) index) (values nil index)))))