From 9ed43a93fd7f52e7e229ff356fcc164ef66a23e8 Mon Sep 17 00:00:00 2001 From: Alfredo Beaumont Date: Wed, 24 Apr 2013 16:40:16 +0200 Subject: [PATCH] !parse-integer: trailing whitespace also increments index, when junk is not found --- ecmalisp.lisp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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))))) -- 1.7.10.4