Branch: Tag:

2002-12-01

2002-12-01 00:00:31 by Martin Stjernholm <mast@lysator.liu.se>

Let sub_ref return zero if refs becomes negative, to allow better
debug checking.

Rev: src/svalue.h:1.114

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: svalue.h,v 1.113 2002/11/25 02:45:43 mast Exp $ + || $Id: svalue.h,v 1.114 2002/12/01 00:00:31 mast Exp $   */      #ifndef SVALUE_H
308:   #else   #define IF_LOCAL_MUTEX(X)   #define add_ref(X) (void)((X)->refs++) - #define sub_ref(X) (--(X)->refs) + #define sub_ref(X) (--(X)->refs > 0)   #define pike_lock_data(X) (void)(X)   #define pike_unlock_data(X) (void)(X)   #endif
364:   #define sub_ref(X) pike_atomic_dec_and_test32((INT32 *)debug_malloc_pass( &((X)->refs)))   #else   #define add_ref(X) (((INT32 *)debug_malloc_pass( &((X)->refs)))[0]++) - #define sub_ref(X) (--((INT32 *)debug_malloc_pass( &((X)->refs)))[0]) + #define sub_ref(X) (--((INT32 *)debug_malloc_pass( &((X)->refs)))[0] > 0)   #endif