diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-12-13 13:01:49 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-12-13 13:01:49 (GMT) |
commit | d787284ee18526d2046981d208a0513d480877eb (patch) | |
tree | 3a0e35b2ff7a25ede71cd8d0585df70c1c245625 /generic/tcl.h | |
parent | 454b7f29d0703cf980ef403b12c5185f92e0c92e (diff) | |
parent | 72da5b18e878aeb9744fa4b746b646eb98e750cd (diff) | |
download | tcl-d787284ee18526d2046981d208a0513d480877eb.zip tcl-d787284ee18526d2046981d208a0513d480877eb.tar.gz tcl-d787284ee18526d2046981d208a0513d480877eb.tar.bz2 |
merge trunk
Diffstat (limited to 'generic/tcl.h')
-rw-r--r-- | generic/tcl.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/generic/tcl.h b/generic/tcl.h index 162983b..f7d54b5 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -681,10 +681,7 @@ typedef struct Tcl_Obj { * whether an object is shared (i.e. has reference count > 1). Note: clients * should use Tcl_DecrRefCount() when they are finished using an object, and * should never call TclFreeObj() directly. TclFreeObj() is only defined and - * made public in tcl.h to support Tcl_DecrRefCount's macro definition. Note - * also that Tcl_DecrRefCount() refers to the parameter "obj" twice. This - * means that you should avoid calling it with an expression that is expensive - * to compute or has side effects. + * made public in tcl.h to support Tcl_DecrRefCount's macro definition. */ void Tcl_IncrRefCount(Tcl_Obj *objPtr); @@ -2310,7 +2307,12 @@ TCLAPI void Tcl_GetMemoryInfo(Tcl_DString *dsPtr); * http://c2.com/cgi/wiki?TrivialDoWhileLoop */ # define Tcl_DecrRefCount(objPtr) \ - do { if (--(objPtr)->refCount <= 0) TclFreeObj(objPtr); } while(0) + do { \ + Tcl_Obj *_objPtr = (objPtr); \ + if (_objPtr->refCount-- < 2) { \ + TclFreeObj(_objPtr); \ + } \ + } while(0) # define Tcl_IsShared(objPtr) \ ((objPtr)->refCount > 1) #endif |