1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-11 06:20:23 +02:00

Micro-optimize (ice-9 format).

* module/ice-9/format.scm (format): Use `call-with-output-string'
  instead of `with-output-to-string'.
This commit is contained in:
Ludovic Courtès 2012-08-21 00:36:50 +02:00
parent b908768a7e
commit 6c9220064d

View file

@ -427,15 +427,15 @@
(case modifier
((at)
(format:out-str
(with-output-to-string
(lambda ()
(truncated-print (next-arg)
(call-with-output-string
(lambda (p)
(truncated-print (next-arg) p
#:width width)))))
((colon-at)
(format:out-str
(with-output-to-string
(lambda ()
(truncated-print (next-arg)
(call-with-output-string
(lambda (p)
(truncated-print (next-arg) p
#:width
(max (- width
output-col)
@ -779,7 +779,7 @@
(define (format:obj->str obj slashify)
(let ((res (if slashify
(object->string obj)
(with-output-to-string (lambda () (display obj))))))
(call-with-output-string (lambda (p) (display obj p))))))
(if (and format:read-proof (string-prefix? "#<" res))
(object->string res)
res)))