unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#13838: [PATCH] Fix duplicate removal of with-fluids
@ 2013-02-28  9:40 David Kastrup
  2013-02-28 11:31 ` Mark H Weaver
  0 siblings, 1 reply; 2+ messages in thread
From: David Kastrup @ 2013-02-28  9:40 UTC (permalink / raw)
  To: 13838; +Cc: David Kastrup

The following code displayed #f:

(define a (make-fluid))
(define b (make-fluid))
(with-fluids ((a 3) (a 1) (b 2))
	     (display (fluid-ref b)))

In general, removing any duplicate that is not right at the end of the
(remaining) list will exhibit this problem.  The fluids and vals
arguments are modified in situ; the previous code only modified vals.
---
 libguile/fluids.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libguile/fluids.c b/libguile/fluids.c
index f1c09cb..bd59e26 100644
--- a/libguile/fluids.c
+++ b/libguile/fluids.c
@@ -326,6 +326,8 @@ scm_i_make_with_fluids (size_t n, SCM *fluids, SCM *vals)
           {
             vals[i] = vals[j]; /* later bindings win */
             n--;
+            fluids[j] = fluids[n];
+            vals[j] = vals[n];
             break;
           }
   }
-- 
1.7.10.4






^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#13838: [PATCH] Fix duplicate removal of with-fluids
  2013-02-28  9:40 bug#13838: [PATCH] Fix duplicate removal of with-fluids David Kastrup
@ 2013-02-28 11:31 ` Mark H Weaver
  0 siblings, 0 replies; 2+ messages in thread
From: Mark H Weaver @ 2013-02-28 11:31 UTC (permalink / raw)
  To: David Kastrup; +Cc: 13838-done

Applied, thanks.

     Mark





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-28 11:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-28  9:40 bug#13838: [PATCH] Fix duplicate removal of with-fluids David Kastrup
2013-02-28 11:31 ` Mark H Weaver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).