summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2013-06-17 14:43:58 -0400
committerMark H Weaver <mhw@netris.org>2013-06-17 14:51:51 -0400
commit10454601e03a20cc121d06d8004f96bb2a3b6fb5 (patch)
tree351bbe958dc7a2b12aa235cf69d77331ff7c1f10
parentb16bf64639d457f9cfe8dc7bf80464cd2b86a622 (diff)
downloadguile-10454601e03a20cc121d06d8004f96bb2a3b6fb5.tar.gz
Fix bug in remqueue in threads.c when removing last element.
Reported and debugged by Andrew Gaylard <ag@computer.org>. * libguile/threads.c (remqueue): When removing the last element from a queue with more than one element, set (car q) to the previous element. * THANKS: Thank Andrew Gaylard.
-rw-r--r--THANKS1
-rw-r--r--libguile/threads.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/THANKS b/THANKS
index a01dcfb17..c517cf724 100644
--- a/THANKS
+++ b/THANKS
@@ -77,6 +77,7 @@ For fixes or providing information which led to a fix:
Fu-gangqiang
Aidan Gauland
Peter Gavin
+ Andrew Gaylard
Nils Gey
Eric Gillespie, Jr
Didier Godefroy
diff --git a/libguile/threads.c b/libguile/threads.c
index c5947915e..8cbe1e22f 100644
--- a/libguile/threads.c
+++ b/libguile/threads.c
@@ -327,7 +327,7 @@ remqueue (SCM q, SCM c)
if (scm_is_eq (p, c))
{
if (scm_is_eq (c, SCM_CAR (q)))
- SCM_SETCAR (q, SCM_CDR (c));
+ SCM_SETCAR (q, scm_is_eq (prev, q) ? SCM_EOL : prev);
SCM_SETCDR (prev, SCM_CDR (c));
/* GC-robust */