1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Fix with-locale*' in (test-suite lib)'.

* test-suite/lib.scm (with-locale*): Set LOC to the previous locale
  name, not to the new locale name.  Only restore LOC when it's not #f.
  (with-locale): Use `syntax-rules'.
This commit is contained in:
Ludovic Courtès 2010-03-03 23:57:50 +01:00
parent 54096be752
commit f5147c84a2

View file

@ -456,19 +456,21 @@ with-locale with-locale*
(lambda ()
(if (defined? 'setlocale)
(begin
(set! loc
(false-if-exception (setlocale LC_ALL nloc)))
(if (not loc)
(set! loc (false-if-exception (setlocale LC_ALL)))
(if (or (not loc)
(not (false-if-exception (setlocale LC_ALL nloc))))
(throw 'unresolved)))
(throw 'unresolved)))
thunk
(lambda ()
(if (defined? 'setlocale)
(if (and (defined? 'setlocale) loc)
(setlocale LC_ALL loc))))))
;;; Evaluate BODY... using the given locale.
(define-macro (with-locale loc . body)
`(with-locale* ,loc (lambda () ,@body)))
(define-syntax with-locale
(syntax-rules ()
((_ loc body ...)
(with-locale* loc (lambda () body ...)))))
;;;; REPORTERS