Branch: Tag:

2001-12-16

2001-12-16 02:44:23 by Martin Stjernholm <mast@lysator.liu.se>

Split the IS_ZERO macro into UNSAFE_IS_ZERO and SAFE_IS_ZERO, where the
former doesn't catch errors from some `! that might be called. This since
the old IS_ZERO is routinely used in many places where we really should be
propagating errors instead of catching them.

Rev: src/svalue.c:1.129
Rev: src/svalue.h:1.100

5:   \*/      /* -  * $Id: svalue.h,v 1.99 2001/12/10 01:16:25 mast Exp $ +  * $Id: svalue.h,v 1.100 2001/12/16 02:44:23 mast Exp $    */   #ifndef SVALUE_H   #define SVALUE_H
242:   #define FUNCTION_BUILTIN USHRT_MAX      #define is_gt(a,b) is_lt(b,a) - #define IS_ZERO(X) ((X)->type==PIKE_T_INT?(X)->u.integer==0:(1<<(X)->type)&(BIT_OBJECT|BIT_FUNCTION)?!svalue_is_true(X):0) +     -  + /* SAFE_IS_ZERO is compatible with the old IS_ZERO, but you should +  * consider using UNSAFE_IS_ZERO instead, since exceptions thrown from +  * `! functions will be propagated correctly then. */ + #define UNSAFE_IS_ZERO(X) ((X)->type==PIKE_T_INT?(X)->u.integer==0:(1<<(X)->type)&(BIT_OBJECT|BIT_FUNCTION)?!svalue_is_true(X):0) + #define SAFE_IS_ZERO(X) ((X)->type==PIKE_T_INT?(X)->u.integer==0:(1<<(X)->type)&(BIT_OBJECT|BIT_FUNCTION)?!safe_svalue_is_true(X):0) +    #define IS_UNDEFINED(X) ((X)->type==PIKE_T_INT&&!(X)->u.integer&&(X)->subtype==1)      #define IS_DESTRUCTED(X) \
499:    TYPE_T type);   PMOD_EXPORT unsigned INT32 hash_svalue(const struct svalue *s);   PMOD_EXPORT int svalue_is_true(const struct svalue *s); + PMOD_EXPORT int safe_svalue_is_true(const struct svalue *s);   PMOD_EXPORT int is_identical(const struct svalue *a, const struct svalue *b);   PMOD_EXPORT int is_eq(const struct svalue *a, const struct svalue *b);   PMOD_EXPORT int low_is_equal(const struct svalue *a,