summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2008-07-13 16:07:18 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2008-07-13 16:07:18 (GMT)
commit5317c96fe29f6bfe0a3c6c5b717a083452f4d4e6 (patch)
tree6c356fad86aa5537ab33c4103a77ddfde50724f7 /generic
parentfaf9c06c92a71acaf96d3813ca666a67c217d952 (diff)
downloadtcl-5317c96fe29f6bfe0a3c6c5b717a083452f4d4e6.zip
tcl-5317c96fe29f6bfe0a3c6c5b717a083452f4d4e6.tar.gz
tcl-5317c96fe29f6bfe0a3c6c5b717a083452f4d4e6.tar.bz2
* generic/tclInt.h: the new macros TclSmallAlloc and TclSmallFree
were badly defined under mem debugging [Bug 2017240] (thx das)
Diffstat (limited to 'generic')
-rw-r--r--generic/tclInt.h27
1 files changed, 26 insertions, 1 deletions
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"