From: Stas Boukarev Date: Fri, 6 Sep 2013 14:23:40 +0000 (+0400) Subject: Save some space in WITH-OUTPUT-TO-STRING. X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=6364a5895c0f4322c85bae4d9d82fa3833af651b;p=sbcl.git Save some space in WITH-OUTPUT-TO-STRING. Not passing :element-type 'character to MAKE-STRING-OUTPUT-STREAM saves a few bytes, since it's the default value. --- diff --git a/src/code/macros.lisp b/src/code/macros.lisp index 3bfcbaa..3cbc7af 100644 --- a/src/code/macros.lisp +++ b/src/code/macros.lisp @@ -471,17 +471,21 @@ invoked. In that case it will store into PLACE and start over." ;; (see FILL-POINTER-OUTPUT-STREAM FIXME in stream.lisp), ;; but it still has to be evaluated for side-effects. (,element-type-var ,element-type)) - (declare (ignore ,element-type-var)) - ,@decls - (unwind-protect - (progn ,@forms) - (close ,var)))) - `(let ((,var (make-string-output-stream :element-type ,element-type))) - ,@decls - (unwind-protect - (progn ,@forms) - (close ,var)) - (get-output-stream-string ,var))))) + (declare (ignore ,element-type-var)) + ,@decls + (unwind-protect + (progn ,@forms) + (close ,var)))) + `(let ((,var (make-string-output-stream + ;; CHARACTER is the default element-type of + ;; string-ouput-stream, save a few bytes when passing it + ,@(and (not (equal element-type ''character)) + `(:element-type ,element-type))))) + ,@decls + (unwind-protect + (progn ,@forms) + (close ,var)) + (get-output-stream-string ,var))))) ;;;; miscellaneous macros