diff options
| author | hobbs <hobbs> | 2007-10-02 21:53:44 (GMT) |
|---|---|---|
| committer | hobbs <hobbs> | 2007-10-02 21:53:44 (GMT) |
| commit | 8f5e92f0ccc5ef5ec14fe1c5c92d04524ca4086b (patch) | |
| tree | c17e0d920eebe22e8fd4fa0047debd633cb27b5f /generic/tcl.h | |
| parent | 21f88d0be70d59dbf29a9a3d9343b285db849594 (diff) | |
| download | tcl-8f5e92f0ccc5ef5ec14fe1c5c92d04524ca4086b.zip tcl-8f5e92f0ccc5ef5ec14fe1c5c92d04524ca4086b.tar.gz tcl-8f5e92f0ccc5ef5ec14fe1c5c92d04524ca4086b.tar.bz2 | |
* generic/tcl.h (Tcl_DecrRefCount): Update change from 2006-05-29
to make macro more warning-robust in unbraced if code.
Diffstat (limited to 'generic/tcl.h')
| -rw-r--r-- | generic/tcl.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/generic/tcl.h b/generic/tcl.h index bbe6515..7c68b81 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tcl.h,v 1.153.2.32 2007/10/02 17:46:50 dgp Exp $ + * RCS: @(#) $Id: tcl.h,v 1.153.2.33 2007/10/02 21:53:45 hobbs Exp $ */ #ifndef _TCL @@ -827,10 +827,11 @@ int Tcl_IsShared _ANSI_ARGS_((Tcl_Obj *objPtr)); # define Tcl_IncrRefCount(objPtr) \ ++(objPtr)->refCount /* - * Use empty if ; else to handle use in unbraced outer if/else conditions + * Use do/while0 idiom for optimum correctness without compiler warnings + * http://c2.com/cgi/wiki?TrivialDoWhileLoop */ # define Tcl_DecrRefCount(objPtr) \ - if (--(objPtr)->refCount > 0) ; else TclFreeObj(objPtr) + do { if (--(objPtr)->refCount <= 0) TclFreeObj(objPtr); } while(0) # define Tcl_IsShared(objPtr) \ ((objPtr)->refCount > 1) #endif |
