From cfaba30ebda14dfd559498d510319eef5c4f817d Mon Sep 17 00:00:00 2001 From: "Greg J. Badros" Date: Fri, 17 Dec 1999 20:11:34 +0000 Subject: [PATCH] * tags.h (SCM_ECONSP, SCM_NECONSP): Fix these macros to have the SCM_NIMP test integrated into an || clause that I'd missed before and was causing a segfault in the regression tests. * symbols.h (SCM_ROUCHARS): Make cast be to (unsigned char *), not (char *); fixes a problem reported by the regression test ports.test. * ports.c: Fixed a couple of arg/number mismatches in SCM_VALIDATE_ macros. Now passes the (not-comprehensive) guile-modules test-suite again! --- libguile/ports.c | 4 ++-- libguile/symbols.h | 2 +- libguile/tags.h | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libguile/ports.c b/libguile/ports.c index dd092a444..1a765c7f2 100644 --- a/libguile/ports.c +++ b/libguile/ports.c @@ -977,7 +977,7 @@ not supplied, the current input port is used.") if (SCM_UNBNDP (port)) port = scm_cur_inp; else - SCM_VALIDATE_OPINPORT(1,port); + SCM_VALIDATE_OPINPORT(2,port); c = SCM_ICHR (cobj); @@ -998,7 +998,7 @@ unread characters will be read again in last-in first-out order. If if (SCM_UNBNDP (port)) port = scm_cur_inp; else - SCM_VALIDATE_OPINPORT(1,port); + SCM_VALIDATE_OPINPORT(2,port); scm_ungets (SCM_ROUCHARS (str), SCM_LENGTH (str), port); diff --git a/libguile/symbols.h b/libguile/symbols.h index a20d20a34..d592833ba 100644 --- a/libguile/symbols.h +++ b/libguile/symbols.h @@ -94,7 +94,7 @@ extern int scm_symhash_dim; #define SCM_ROCHARS(x) ((char *)((SCM_TYP7(x) == scm_tc7_substring) \ ? SCM_INUM (SCM_CADR (x)) + SCM_CHARS (SCM_CDDR (x)) \ : SCM_CHARS (x))) -#define SCM_ROUCHARS(x) ((char *) ((SCM_TYP7(x) == scm_tc7_substring) \ +#define SCM_ROUCHARS(x) ((unsigned char *) ((SCM_TYP7(x) == scm_tc7_substring) \ ? SCM_INUM (SCM_CADR (x)) + SCM_UCHARS (SCM_CDDR (x))\ : SCM_UCHARS (x))) #define SCM_ROLENGTH(x) SCM_LENGTH (x) diff --git a/libguile/tags.h b/libguile/tags.h index f717ac29f..169cb72ee 100644 --- a/libguile/tags.h +++ b/libguile/tags.h @@ -272,11 +272,11 @@ typedef long SCM; * can be expected to occur. */ #define SCM_ECONSP(x) (SCM_CONSP (x) \ - || (SCM_TYP3(x) == 1 \ - && SCM_CDR (SCM_CAR (x) - 1) != 0)) + || SCM_NIMP(x) && ((SCM_TYP3(x) == 1 \ + && SCM_CDR (SCM_CAR (x) - 1) != 0))) #define SCM_NECONSP(x) (SCM_NCONSP(x) \ && (SCM_TYP3(x) != 1 \ - || SCM_CDR (SCM_CAR (x) - 1) == 0)) + || (SCM_NIMP(x) && SCM_CDR (SCM_CAR (x) - 1) == 0)))