diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | generic/tclInt.h | 13 |
2 files changed, 13 insertions, 6 deletions
@@ -1,5 +1,11 @@ 2007-04-18 Miguel Sofer <msofer@users.sf.net> + * generic/tclInt.h (TclDecrRefCount): change the order of the + branches, use empty 'if ; else' to handle use in unbraced outer + if/else conditions (as already done in tcl.h) + +2007-04-18 Miguel Sofer <msofer@users.sf.net> + * generic/tclExecute.c: slight changes in Tcl_Obj management. 2007-04-17 Kevin B. Kenny <kennykb@acm.org> diff --git a/generic/tclInt.h b/generic/tclInt.h index 140a67c..df2ea41 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInt.h,v 1.305 2007/04/10 14:47:15 dkf Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.306 2007/04/18 22:49:48 msofer Exp $ */ #ifndef _TCLINT @@ -2954,14 +2954,13 @@ MODULE_SCOPE void TclInvalidateNsPath(Namespace *nsPtr); /* * 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' + * 'length == -1'. + * Use empty 'if ; else' to handle use in unbraced outer if/else conditions */ # define TclDecrRefCount(objPtr) \ - if (--(objPtr)->refCount <= 0) { \ - if ((objPtr)->typePtr && (objPtr)->typePtr->freeIntRepProc) { \ - TclFreeObj(objPtr); \ - } else { \ + if (--(objPtr)->refCount > 0) ; else { \ + if (!(objPtr)->typePtr || !(objPtr)->typePtr->freeIntRepProc) { \ if ((objPtr)->bytes \ && ((objPtr)->bytes != tclEmptyStringRep)) { \ ckfree((char *) (objPtr)->bytes); \ @@ -2969,6 +2968,8 @@ MODULE_SCOPE void TclInvalidateNsPath(Namespace *nsPtr); (objPtr)->length = -1; \ TclFreeObjStorage(objPtr); \ TclIncrObjsFreed(); \ + } else { \ + TclFreeObj(objPtr); \ } \ } |