[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-136-g8dd01
From: |
Mark H Weaver |
Subject: |
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-136-g8dd0186 |
Date: |
Thu, 28 Feb 2013 23:47:04 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=8dd01861a9a0331b912a1ae6310e64eb6b47c29c
The branch, stable-2.0 has been updated
via 8dd01861a9a0331b912a1ae6310e64eb6b47c29c (commit)
from b8d8f8b9292a4755d2c63bc7a955d75d96eb05e0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 8dd01861a9a0331b912a1ae6310e64eb6b47c29c
Author: Mark H Weaver <address@hidden>
Date: Thu Feb 28 18:43:09 2013 -0500
Fix later-bindings-win logic in with-fluids.
Based on a patch by David Kastrup <address@hidden>.
Fixes <http://bugs.gnu.org/13843>.
* libguile/fluids.c (scm_i_make_with_fluids): Reverse direction of inner
loop that checks for duplicates, to properly handle more than two
bindings to the same fluid.
-----------------------------------------------------------------------
Summary of changes:
libguile/fluids.c | 6 +++---
test-suite/tests/fluids.test | 10 ++++++----
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/libguile/fluids.c b/libguile/fluids.c
index 277246e..327d12f 100644
--- a/libguile/fluids.c
+++ b/libguile/fluids.c
@@ -319,10 +319,10 @@ scm_i_make_with_fluids (size_t n, SCM *fluids, SCM *vals)
/* Ensure that there are no duplicates in the fluids set -- an N^2 operation,
but N will usually be small, so perhaps that's OK. */
{
- size_t i, j = n;
+ size_t i, j;
- while (j--)
- for (i = 0; i < j; i++)
+ for (j = n; j--;)
+ for (i = j; i--;)
if (scm_is_eq (fluids[i], fluids[j]))
{
vals[i] = vals[j]; /* later bindings win */
diff --git a/test-suite/tests/fluids.test b/test-suite/tests/fluids.test
index 5552fd9..9ad9e81 100644
--- a/test-suite/tests/fluids.test
+++ b/test-suite/tests/fluids.test
@@ -85,15 +85,17 @@
(pass-if "last value wins"
(compile '(with-fluids ((a 1)
- (a 2))
- (eqv? (fluid-ref a) 2))
+ (a 2)
+ (a 3))
+ (eqv? (fluid-ref a) 3))
#:env (current-module)))
(pass-if "remove the duplicate, not the last binding"
(compile '(with-fluids ((a 1)
(a 2)
- (b 3))
- (eqv? (fluid-ref b) 3))
+ (a 3)
+ (b 4))
+ (eqv? (fluid-ref b) 4))
#:env (current-module)))
(pass-if "original value restored"
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-136-g8dd0186,
Mark H Weaver <=