* tags.h (SCM_ECONSP, SCM_NECONSP): Fix these macros to have the
authorGreg J. Badros <gjb@cs.washington.edu>
Fri, 17 Dec 1999 20:11:34 +0000 (20:11 +0000)
committerGreg J. Badros <gjb@cs.washington.edu>
Fri, 17 Dec 1999 20:11:34 +0000 (20:11 +0000)
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
libguile/symbols.h
libguile/tags.h

index dd092a4..1a765c7 100644 (file)
@@ -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);
   
index a20d20a..d592833 100644 (file)
@@ -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)
index f717ac2..169cb72 100644 (file)
@@ -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)))
 
 \f