summaryrefslogtreecommitdiff
path: root/srfi/srfi-1.c
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2008-09-10 23:09:30 +0200
committerLudovic Courtès <ludo@gnu.org>2008-09-10 23:09:30 +0200
commit6f03035fe80d1c25ffadc42ec59c473402f65f60 (patch)
treea552a077bafe408ced8737674aecdf3007f31679 /srfi/srfi-1.c
parent328efeb9a66dddcf78a24fad96d3db58e9c3375d (diff)
parentc5cd474d8c37bf32d7236e63d754a0eee9eb9071 (diff)
downloadguile-6f03035fe80d1c25ffadc42ec59c473402f65f60.tar.gz
Merge branch 'master' into boehm-demers-weiser-gc
Conflicts: libguile/Makefile.am libguile/coop-defs.h libguile/gc-card.c libguile/gc-freelist.c libguile/gc-malloc.c libguile/gc-mark.c libguile/gc-segment.c libguile/gc.c libguile/gc.h libguile/gc_os_dep.c libguile/hashtab.c libguile/hashtab.h libguile/inline.h libguile/private-gc.h libguile/struct.c libguile/struct.h libguile/threads.c libguile/threads.h libguile/vectors.h libguile/weaks.h test-suite/tests/gc.test
Diffstat (limited to 'srfi/srfi-1.c')
-rw-r--r--srfi/srfi-1.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/srfi/srfi-1.c b/srfi/srfi-1.c
index 8e27ab4e6..35815b32f 100644
--- a/srfi/srfi-1.c
+++ b/srfi/srfi-1.c
@@ -1,6 +1,6 @@
/* srfi-1.c --- SRFI-1 procedures for Guile
*
- * Copyright (C) 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2005, 2006
+ * Copyright (C) 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2005, 2006, 2008
* Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
@@ -18,6 +18,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#include <libguile.h>
#include <libguile/lang.h>
@@ -1663,6 +1667,7 @@ SCM_DEFINE (scm_srfi1_partition, "partition", 2, 0, 0,
/* In this implementation, the output lists don't share memory with
list, because it's probably not worth the effort. */
scm_t_trampoline_1 call = scm_trampoline_1(pred);
+ SCM orig_list = list;
SCM kept = scm_cons(SCM_EOL, SCM_EOL);
SCM kept_tail = kept;
SCM dropped = scm_cons(SCM_EOL, SCM_EOL);
@@ -1671,8 +1676,14 @@ SCM_DEFINE (scm_srfi1_partition, "partition", 2, 0, 0,
SCM_ASSERT(call, pred, 2, FUNC_NAME);
for (; !SCM_NULL_OR_NIL_P (list); list = SCM_CDR(list)) {
- SCM elt = SCM_CAR(list);
- SCM new_tail = scm_cons(SCM_CAR(list), SCM_EOL);
+ SCM elt, new_tail;
+
+ /* Make sure LIST is not a dotted list. */
+ SCM_ASSERT (scm_is_pair (list), orig_list, SCM_ARG2, FUNC_NAME);
+
+ elt = SCM_CAR (list);
+ new_tail = scm_cons (SCM_CAR (list), SCM_EOL);
+
if (scm_is_true (call (pred, elt))) {
SCM_SETCDR(kept_tail, new_tail);
kept_tail = new_tail;