diff --git a/libguile/posix.c b/libguile/posix.c index f9ce0adc4..6dd0551f7 100644 --- a/libguile/posix.c +++ b/libguile/posix.c @@ -928,8 +928,7 @@ environ_list_to_c (SCM envlist, int arg, const char *proc) int len; char *src; - SCM_ASSERT (SCM_NIMP (SCM_CAR (envlist)) - && SCM_ROSTRINGP (SCM_CAR (envlist)), + SCM_ASSERT (SCM_ROSTRINGP (SCM_CAR (envlist)), envlist, arg, proc); len = 1 + SCM_ROLENGTH (SCM_CAR (envlist)); result[i] = malloc ((long) len); diff --git a/libguile/print.c b/libguile/print.c index 31f719328..01873af39 100644 --- a/libguile/print.c +++ b/libguile/print.c @@ -888,10 +888,9 @@ circref: int scm_valid_oport_value_p (SCM val) { - return (SCM_NIMP (val) - && (SCM_OPOUTPORTP (val) - || (SCM_PORT_WITH_PS_P (val) - && SCM_OPOUTPORTP (SCM_PORT_WITH_PS_PORT (val))))); + return (SCM_OPOUTPORTP (val) + || (SCM_PORT_WITH_PS_P (val) + && SCM_OPOUTPORTP (SCM_PORT_WITH_PS_PORT (val)))); } /* SCM_GPROC(s_write, "write", 1, 1, 0, scm_write, g_write); */ @@ -1022,13 +1021,10 @@ GUILE_PROC (scm_get_print_state, "get-print-state", 1, 0, 0, "") #define FUNC_NAME s_scm_get_print_state { - if (SCM_NIMP (port)) - { - if (SCM_PORT_WITH_PS_P (port)) - return SCM_PORT_WITH_PS_PS (port); - if (SCM_OUTPORTP (port)) - return SCM_BOOL_F; - } + if (SCM_PORT_WITH_PS_P (port)) + return SCM_PORT_WITH_PS_PS (port); + if (SCM_OUTPORTP (port)) + return SCM_BOOL_F; RETURN_SCM_WTA (1,port); } #undef FUNC_NAME diff --git a/libguile/ramap.c b/libguile/ramap.c index 62b9b93ec..14c68d480 100644 --- a/libguile/ramap.c +++ b/libguile/ramap.c @@ -182,8 +182,7 @@ scm_ra_matchp (SCM ra0, SCM ras) bas0 = SCM_ARRAY_BASE (ra0); break; } - while SCM_NIMP - (ras) + while (SCM_NIMP (ras)) { ra1 = SCM_CAR (ras); if (SCM_IMP (ra1)) diff --git a/libguile/random.c b/libguile/random.c index 2c424c5d1..372ff61e0 100644 --- a/libguile/random.c +++ b/libguile/random.c @@ -466,9 +466,7 @@ GUILE_PROC (scm_random_solid_sphere_x, "random:solid-sphere!", 1, 1, 0, "") #define FUNC_NAME s_scm_random_solid_sphere_x { - SCM_ASSERT (SCM_NIMP (v) - && (SCM_VECTORP (v) || SCM_TYP7 (v) == scm_tc7_dvect), - v, SCM_ARG1, FUNC_NAME); + SCM_VALIDATE_VECTOR_OR_DVECTOR(1,v); if (SCM_UNBNDP (state)) state = SCM_CDR (scm_var_random_state); SCM_VALIDATE_RSTATE(2,state); @@ -486,9 +484,7 @@ GUILE_PROC (scm_random_hollow_sphere_x, "random:hollow-sphere!", 1, 1, 0, "") #define FUNC_NAME s_scm_random_hollow_sphere_x { - SCM_ASSERT (SCM_NIMP (v) - && (SCM_VECTORP (v) || SCM_TYP7 (v) == scm_tc7_dvect), - v, SCM_ARG1, FUNC_NAME); + SCM_VALIDATE_VECTOR_OR_DVECTOR(1,v); if (SCM_UNBNDP (state)) state = SCM_CDR (scm_var_random_state); SCM_VALIDATE_RSTATE(2,state); @@ -505,9 +501,7 @@ GUILE_PROC (scm_random_normal_vector_x, "random:normal-vector!", 1, 1, 0, #define FUNC_NAME s_scm_random_normal_vector_x { int n; - SCM_ASSERT (SCM_NIMP (v) - && (SCM_VECTORP (v) || SCM_TYP7 (v) == scm_tc7_dvect), - v, SCM_ARG1, FUNC_NAME); + SCM_VALIDATE_VECTOR_OR_DVECTOR(1,v); if (SCM_UNBNDP (state)) state = SCM_CDR (scm_var_random_state); SCM_VALIDATE_RSTATE(2,state); diff --git a/libguile/scm_validate.h b/libguile/scm_validate.h index 3af1c9789..d67f2b780 100644 --- a/libguile/scm_validate.h +++ b/libguile/scm_validate.h @@ -1,4 +1,4 @@ -/* $Id: scm_validate.h,v 1.8 1999-12-19 01:04:36 gjb Exp $ */ +/* $Id: scm_validate.h,v 1.9 2000-01-05 16:16:57 gjb Exp $ */ /* Copyright (C) 1999 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -264,6 +264,11 @@ #define SCM_VALIDATE_VECTOR(pos,v) SCM_MAKE_VALIDATE(pos,v,VECTORP) +#define SCM_VALIDATE_VECTOR_OR_DVECTOR(pos,v) \ + do { SCM_ASSERT ((SCM_VECTORP (v) || \ + (SCM_NIMP (v) && SCM_TYP7 (v) == scm_tc7_dvect)), \ + v, pos, FUNC_NAME); } while (0) + #define SCM_VALIDATE_STRUCT(pos,v) SCM_MAKE_VALIDATE(pos,v,STRUCTP) #define SCM_VALIDATE_VTABLE(pos,v) \ diff --git a/libguile/stacks.c b/libguile/stacks.c index 7cf4d55c9..5533dce58 100644 --- a/libguile/stacks.c +++ b/libguile/stacks.c @@ -364,15 +364,13 @@ narrow_stack (SCM stack,int inner,SCM inner_key,int outer,SCM outer_key) for (i = 0; inner; ++i, --inner) { SCM m = s->frames[i].source; - if (SCM_NIMP (m) - && SCM_MEMOIZEDP (m) + if ( SCM_MEMOIZEDP (m) && SCM_NIMP (SCM_MEMOIZED_ENV (m)) && SCM_FALSEP (scm_system_module_env_p (SCM_MEMOIZED_ENV (m)))) { /* Back up in order to include any non-source frames */ while (i > 0 - && !((SCM_NIMP (m = s->frames[i - 1].source) - && SCM_MEMOIZEDP (m)) + && !((m = s->frames[i - 1].source, SCM_MEMOIZEDP (m)) || (SCM_NIMP (m = s->frames[i - 1].proc) && SCM_NFALSEP (scm_procedure_p (m)) && SCM_NFALSEP (scm_procedure_property diff --git a/libguile/strings.c b/libguile/strings.c index 1a155b059..ed7d07351 100644 --- a/libguile/strings.c +++ b/libguile/strings.c @@ -333,8 +333,7 @@ GUILE_PROC(scm_string_append, "string-append", 0, 0, 1, register long i = 0; register SCM l, s; register unsigned char *data; - for (l = args;SCM_NIMP (l);) { - SCM_ASSERT (SCM_CONSP (l), l, SCM_ARGn, FUNC_NAME); + for (l = args;SCM_CONSP (l);) { s = SCM_CAR (l); SCM_VALIDATE_ROSTRING(SCM_ARGn,s); i += SCM_ROLENGTH (s); diff --git a/libguile/symbols.c b/libguile/symbols.c index cd43b625d..27dd69446 100644 --- a/libguile/symbols.c +++ b/libguile/symbols.c @@ -827,8 +827,7 @@ prefix for the new symbol's name. The default prefix is @code{%%gensym}.") goto skip_test; } else - SCM_ASSERT (SCM_NIMP (obarray) - && (SCM_VECTORP (obarray) || SCM_WVECTP (obarray)), + SCM_ASSERT ((SCM_VECTORP (obarray) || SCM_WVECTP (obarray)), obarray, SCM_ARG2, FUNC_NAME); diff --git a/libguile/unif.c b/libguile/unif.c index 875f60f75..7d6c51ddd 100644 --- a/libguile/unif.c +++ b/libguile/unif.c @@ -305,15 +305,13 @@ loop: return nprot || SCM_BOOL(SCM_INUMP(prot) && SCM_INUM(prot)<=0); case scm_tc7_svect: return ( nprot - || (SCM_NIMP (prot) - && SCM_SYMBOLP (prot) + || (SCM_SYMBOLP (prot) && (1 == SCM_LENGTH (prot)) && ('s' == SCM_CHARS (prot)[0]))); #ifdef HAVE_LONG_LONGS case scm_tc7_llvect: return ( nprot - || (SCM_NIMP (prot) - && SCM_SYMBOLP (prot) + || (SCM_SYMBOLP (prot) && (1 == SCM_LENGTH (prot)) && ('s' == SCM_CHARS (prot)[0]))); #endif