summaryrefslogtreecommitdiff
path: root/libguile/fluids.c
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2013-02-28 18:43:09 -0500
committerMark H Weaver <mhw@netris.org>2013-02-28 18:43:09 -0500
commit8dd01861a9a0331b912a1ae6310e64eb6b47c29c (patch)
tree9b53d4dc72fd6ad26c3380b52729fecfceb7de77 /libguile/fluids.c
parentb8d8f8b9292a4755d2c63bc7a955d75d96eb05e0 (diff)
downloadguile-8dd01861a9a0331b912a1ae6310e64eb6b47c29c.tar.gz
Fix later-bindings-win logic in with-fluids.
Based on a patch by David Kastrup <dak@gnu.org>. 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.
Diffstat (limited to 'libguile/fluids.c')
-rw-r--r--libguile/fluids.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libguile/fluids.c b/libguile/fluids.c
index 277246e35..327d12f4c 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 */