summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Djurfeldt <djurfeldt@nada.kth.se>1997-12-04 16:18:59 +0000
committerMikael Djurfeldt <djurfeldt@nada.kth.se>1997-12-04 16:18:59 +0000
commitbfc471e7a141068a23f91262a36c77695536c8bd (patch)
tree597b79b8d9068a7ea3fe3bf1f9e920f48ade029c
parent380463881aa6de9cbbdb9a7c82da8818b76547c2 (diff)
downloadguile-bfc471e7a141068a23f91262a36c77695536c8bd.tar.gz
* print.h (SCM_COERCE_OUTPORT): Check that the object is a pair
before taking the CDR.
-rw-r--r--libguile/ChangeLog3
-rw-r--r--libguile/print.h4
2 files changed, 6 insertions, 1 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog
index 7ec3a69e9..61e2c79b3 100644
--- a/libguile/ChangeLog
+++ b/libguile/ChangeLog
@@ -1,5 +1,8 @@
1997-12-04 Mikael Djurfeldt <mdj@mdj.nada.kth.se>
+ * print.h (SCM_COERCE_OUTPORT): Check that the object is a pair
+ before taking the CDR.
+
* filesys.c (scm_stat): Coerce output port only if argument *is*
an output port! (Thanks to Harald Meland.)
diff --git a/libguile/print.h b/libguile/print.h
index b686ed8bd..99de7f5e7 100644
--- a/libguile/print.h
+++ b/libguile/print.h
@@ -70,7 +70,9 @@ extern scm_option scm_print_opts[];
#define SCM_WRITINGP(pstate) ((pstate)->writingp)
#define SCM_SET_WRITINGP(pstate, x) { (pstate)->writingp = (x); }
-#define SCM_COERCE_OUTPORT(p) ((SCM_NIMP (p) && SCM_PRINT_STATE_P (SCM_CDR (p))) \
+#define SCM_COERCE_OUTPORT(p) ((SCM_NIMP (p) \
+ && SCM_CONSP (p) \
+ && SCM_PRINT_STATE_P (SCM_CDR (p))) \
? SCM_CAR (p) \
: p)