From f983cd5f117adbc96f5eedfd8c98a5677519760a Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Wed, 18 Apr 2007 22:49:48 +0000 Subject: * 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) --- ChangeLog | 6 ++++++ generic/tclInt.h | 13 +++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5af96a8..fd31b4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2007-04-18 Miguel Sofer + * 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 + * generic/tclExecute.c: slight changes in Tcl_Obj management. 2007-04-17 Kevin B. Kenny 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); \ } \ } -- cgit v0.12