From 3e19a62b2d2f6af9c128bf83a3edd5e5d419563a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Tue, 12 May 2015 08:53:41 +0200 Subject: [PATCH] format-f: simplify code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel KochmaƄski --- src/lsp/format.lsp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/lsp/format.lsp b/src/lsp/format.lsp index 40aa7c13b..5b9bf6418 100644 --- a/src/lsp/format.lsp +++ b/src/lsp/format.lsp @@ -130,7 +130,7 @@ (T (let ((w (multiple-value-list (float-to-digits* nil x (max 0 - (+ (1- width) + (+ (- width 2) (if (minusp scale) scale 0))) t))) @@ -1365,19 +1365,14 @@ (prin1 number stream) nil) (t - (let* ((spaceleft w) - (digits (if (null spaceleft) - nil - (1- spaceleft)))) + (let ((spaceleft w)) (when (and w (or atsign (minusp number))) - (decf spaceleft) - (decf digits)) - (multiple-value-bind - (str len lpoint tpoint) - (sys::flonum-to-string (abs number) digits d k) - ;;if caller specifically requested no fraction digits, suppress the - ;;optional trailing zero + (decf spaceleft)) + (multiple-value-bind (str len lpoint tpoint) + (sys::flonum-to-string (abs number) spaceleft d k) + ;; if caller specifically requested no fraction digits, suppress the + ;; trailing zero (when (eql d 0) (setq tpoint nil)) (when w