Index: generic/nsfInt.h =================================================================== diff -u -re48161ab167236344f7d23da3e855c31d1a1ebc7 -r958b24f921951c5e7c3f454134ddf17843df22bc --- generic/nsfInt.h (.../nsfInt.h) (revision e48161ab167236344f7d23da3e855c31d1a1ebc7) +++ generic/nsfInt.h (.../nsfInt.h) (revision 958b24f921951c5e7c3f454134ddf17843df22bc) @@ -353,9 +353,17 @@ # include #endif +#ifdef PRE9 +# define NSF_PLAUSIBLE_REFCOUNT(A) ((A)->refCount >= 0) +# define NSF_PLAUSIBLE_LENGTH(A) ((A)->length >= 0) +#else +# define NSF_PLAUSIBLE_REFCOUNT(A) ((A)->refCount < (size_t)-100) +# define NSF_PLAUSIBLE_LENGTH(A) ((A)->length < (size_t)-100) +#endif + #if !defined(NDEBUG) # define ISOBJ(o) ((o) != NULL && ISOBJ_(o)) -# define ISOBJ_(o) ((o) != (void*)0xdeadbeaf && (((o)->typePtr != NULL) ? ((o)->typePtr->name != NULL) : ((o)->bytes != NULL)) && (((o)->bytes != NULL) ? (o)->length >= 0 : 1) && (o)->refCount >= 0u) +# define ISOBJ_(o) ((o) != (void*)0xdeadbeaf && (((o)->typePtr != NULL) ? ((o)->typePtr->name != NULL) : ((o)->bytes != NULL)) && (((o)->bytes != NULL) ? NSF_PLAUSIBLE_LENGTH(o) : 1) && NSF_PLAUSIBLE_REFCOUNT(o)) #else # define ISOBJ(o) #endif @@ -373,10 +381,10 @@ #ifdef USE_TCL_STUBS # define DECR_REF_COUNT(A) \ - MEM_COUNT_FREE("INCR_REF_COUNT" #A,(A)); assert((A)->refCount >= 0); \ + MEM_COUNT_FREE("INCR_REF_COUNT" #A,(A)); assert(NSF_PLAUSIBLE_REFCOUNT(A)); \ Tcl_DecrRefCount(A) # define DECR_REF_COUNT2(name,A) \ - MEM_COUNT_FREE("INCR_REF_COUNT-" name,(A)); assert((A)->refCount >= 0); \ + MEM_COUNT_FREE("INCR_REF_COUNT-" name,(A)); assert(NSF_PLAUSIBLE_REFCOUNT(A)); \ Tcl_DecrRefCount(A) #else # define DECR_REF_COUNT(A) \