From 2e16a342f226b97e47fd2cd30c367ebca2a3080c Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Fri, 13 May 2011 10:32:46 +0200 Subject: [PATCH] fix type errors * libguile/numbers.c (scm_logand): Fix a type error (comparing a SCM against an int, when we really wanted to compare the unpacked fixnum). * libguile/ports.c (scm_i_set_conversion_strategy_x): Check scm_conversion_strategy_init, not scm_conversion_strategy. * libguile/read.c (recsexpr): Fix loops to avoid strange test of SCM values. --- libguile/numbers.c | 2 +- libguile/ports.c | 2 +- libguile/read.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libguile/numbers.c b/libguile/numbers.c index fe510a195..5aeced6ca 100644 --- a/libguile/numbers.c +++ b/libguile/numbers.c @@ -4112,7 +4112,7 @@ SCM scm_logand (SCM n1, SCM n2) else if SCM_BIGP (n2) { intbig: - if (n1 == 0) + if (nn1 == 0) return SCM_INUM0; { SCM result_z = scm_i_mkbig (); diff --git a/libguile/ports.c b/libguile/ports.c index 926149bf9..f3d1d2d89 100644 --- a/libguile/ports.c +++ b/libguile/ports.c @@ -2317,7 +2317,7 @@ scm_i_set_conversion_strategy_x (SCM port, if (scm_is_false (port)) { /* Set the default encoding for future ports. */ - if (!scm_conversion_strategy + if (!scm_conversion_strategy_init || !scm_is_fluid (SCM_VARIABLE_REF (scm_conversion_strategy))) scm_misc_error (NULL, "tried to set conversion strategy fluid before it is initialized", SCM_EOL); diff --git a/libguile/read.c b/libguile/read.c index ad809ef56..3760ce135 100644 --- a/libguile/read.c +++ b/libguile/read.c @@ -1557,7 +1557,7 @@ recsexpr (SCM obj, long line, int column, SCM filename) if (!scm_is_pair(obj)) { return obj; } else { - SCM tmp = obj, copy; + SCM tmp, copy; /* If this sexpr is visible in the read:sharp source, we want to keep that information, so only record non-constant cons cells which haven't previously been read by the reader. */ @@ -1567,7 +1567,7 @@ recsexpr (SCM obj, long line, int column, SCM filename) { copy = scm_cons (recsexpr (SCM_CAR (obj), line, column, filename), SCM_UNDEFINED); - while ((tmp = SCM_CDR (tmp)) && scm_is_pair (tmp)) + for (tmp = obj; scm_is_pair (tmp); tmp = SCM_CDR (tmp)) { SCM_SETCDR (copy, scm_cons (recsexpr (SCM_CAR (tmp), line, @@ -1581,7 +1581,7 @@ recsexpr (SCM obj, long line, int column, SCM filename) else { recsexpr (SCM_CAR (obj), line, column, filename); - while ((tmp = SCM_CDR (tmp)) && scm_is_pair (tmp)) + for (tmp = obj; scm_is_pair (tmp); tmp = SCM_CDR (tmp)) recsexpr (SCM_CAR (tmp), line, column, filename); copy = SCM_UNDEFINED; }