From 5317c96fe29f6bfe0a3c6c5b717a083452f4d4e6 Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Sun, 13 Jul 2008 16:07:18 +0000 Subject: * generic/tclInt.h: the new macros TclSmallAlloc and TclSmallFree were badly defined under mem debugging [Bug 2017240] (thx das) --- ChangeLog | 5 +++++ generic/tclInt.h | 27 ++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2cd3ae8..b9ae7b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-07-14 Miguel Sofer + + * generic/tclInt.h: the new macros TclSmallAlloc and TclSmallFree + were badly defined under mem debugging [Bug 2017240] (thx das) + 2008-07-13 Miguel Sofer NRE implementation [Patch 2017110] diff --git a/generic/tclInt.h b/generic/tclInt.h index 9e0f6ce..202f5b8 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -14,7 +14,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.372 2008/07/13 09:03:34 msofer Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.373 2008/07/13 16:07:19 msofer Exp $ */ #ifndef _TCLINT @@ -3912,6 +3912,7 @@ MODULE_SCOPE void TclBNInitBignumFromWideUInt(mp_int *bignum, * DO NOT LET THEM CROSS THREAD BOUNDARIES */ +#ifndef TCL_MEM_DEBUG #define TclSmallAlloc(nbytes, memPtr) \ { \ Tcl_Obj *objPtr; \ @@ -3931,6 +3932,30 @@ MODULE_SCOPE void TclBNInitBignumFromWideUInt(mp_int *bignum, TclFreeObjStorage((Tcl_Obj *) memPtr); \ TclIncrObjsFreed() +#else /* TCL_MEM_DEBUG */ +#define TclSmallAlloc(nbytes, memPtr) \ + { \ + Tcl_Obj *objPtr; \ + switch ((nbytes)>sizeof(Tcl_Obj)) { \ + case (2 +((nbytes)>sizeof(Tcl_Obj))): \ + case 3: \ + case 1: \ + Tcl_Panic("TclSmallAlloc: nBytes too large!"); \ + case 0: (void)0; \ + } \ + TclNewObj(objPtr); \ + memPtr = (ClientData) objPtr; \ + } + +#define TclSmallFree(memPtr) \ + { \ + Tcl_Obj *objPtr = (Tcl_Obj *) memPtr; \ + objPtr->bytes = NULL; \ + objPtr->typePtr = NULL; \ + objPtr->refCount = 1; \ + TclDecrRefCount(objPtr); \ + } +#endif /* TCL_MEM_DEBUG */ #include "tclPort.h" -- cgit v0.12