summaryrefslogtreecommitdiffstats
path: root/generic/tclInt.h
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-12-13 13:01:49 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-12-13 13:01:49 (GMT)
commitd787284ee18526d2046981d208a0513d480877eb (patch)
tree3a0e35b2ff7a25ede71cd8d0585df70c1c245625 /generic/tclInt.h
parent454b7f29d0703cf980ef403b12c5185f92e0c92e (diff)
parent72da5b18e878aeb9744fa4b746b646eb98e750cd (diff)
downloadtcl-d787284ee18526d2046981d208a0513d480877eb.zip
tcl-d787284ee18526d2046981d208a0513d480877eb.tar.gz
tcl-d787284ee18526d2046981d208a0513d480877eb.tar.bz2
merge trunk
Diffstat (limited to 'generic/tclInt.h')
-rw-r--r--generic/tclInt.h28
1 files changed, 15 insertions, 13 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 0efb1b6..7c699c9 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -3934,24 +3934,26 @@ typedef const char *TclDTraceStr;
* Invalidate the string rep first so we can use the bytes value for our
* pointer chain, and signal an obj deletion (as opposed to shimmering) with
* 'length == -1'.
- * Use empty 'if ; else' to handle use in unbraced outer if/else conditions.
*/
# define TclDecrRefCount(objPtr) \
- if (--(objPtr)->refCount > 0) ; else { \
- if (!(objPtr)->typePtr || !(objPtr)->typePtr->freeIntRepProc) { \
- TCL_DTRACE_OBJ_FREE(objPtr); \
- if ((objPtr)->bytes \
- && ((objPtr)->bytes != tclEmptyStringRep)) { \
- ckfree((char *) (objPtr)->bytes); \
+ do { \
+ Tcl_Obj *_objPtr = (objPtr); \
+ if (_objPtr->refCount-- < 2) { \
+ if (!_objPtr->typePtr || !_objPtr->typePtr->freeIntRepProc) { \
+ TCL_DTRACE_OBJ_FREE(_objPtr); \
+ if (_objPtr->bytes \
+ && (_objPtr->bytes != tclEmptyStringRep)) { \
+ ckfree((char *) _objPtr->bytes); \
+ } \
+ _objPtr->length = -1; \
+ TclFreeObjStorage(_objPtr); \
+ TclIncrObjsFreed(); \
+ } else { \
+ TclFreeObj(_objPtr); \
} \
- (objPtr)->length = -1; \
- TclFreeObjStorage(objPtr); \
- TclIncrObjsFreed(); \
- } else { \
- TclFreeObj(objPtr); \
} \
- }
+ } while(0)
#if defined(PURIFY)