summaryrefslogtreecommitdiffstats
path: root/generic/tclInt.h
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclInt.h')
-rw-r--r--generic/tclInt.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h
index fbfa5a7..4a3a0c1 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -4356,6 +4356,32 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
{enum { ct_assert_value = 1/(!!(e)) };}
/*
+ *----------------------------------------------------------------
+ * Allocator for small structs (<=sizeof(Tcl_Obj)) using the Tcl_Obj pool.
+ * Only checked at compile time.
+ *
+ * ONLY USE FOR CONSTANT nBytes.
+ *
+ * DO NOT LET THEM CROSS THREAD BOUNDARIES
+ *----------------------------------------------------------------
+ */
+
+#define TclSmallAlloc(nbytes, memPtr) \
+ do { \
+ Tcl_Obj *objPtr; \
+ TCL_CT_ASSERT((nbytes)<=sizeof(Tcl_Obj)); \
+ TclIncrObjsAllocated(); \
+ TclAllocObjStorage(objPtr); \
+ memPtr = (ClientData) (objPtr); \
+ } while (0)
+
+#define TclSmallFree(memPtr) \
+ do { \
+ TclFreeObjStorage((Tcl_Obj *) (memPtr)); \
+ TclIncrObjsFreed(); \
+ } while (0)
+
+/*
* Support for Clang Static Analyzer <http://clang-analyzer.llvm.org>
*/