summaryrefslogtreecommitdiffstats
path: root/generic/tclPreserve.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclPreserve.c')
-rw-r--r--generic/tclPreserve.c48
1 files changed, 27 insertions, 21 deletions
diff --git a/generic/tclPreserve.c b/generic/tclPreserve.c
index 0bd8f93..61e5518 100644
--- a/generic/tclPreserve.c
+++ b/generic/tclPreserve.c
@@ -15,6 +15,11 @@
#include "tclInt.h"
/*
+ * Only use this file if we are NOT using the new code in tclAlloc.c
+ */
+
+
+/*
* The following data structure is used to keep track of all the Tcl_Preserve
* calls that are still in effect. It grows as needed to accommodate any
* number of calls in effect.
@@ -45,27 +50,6 @@ TCL_DECLARE_MUTEX(preserveMutex)/* To protect the above statics */
#define INITIAL_SIZE 2 /* Initial number of reference slots to make */
-/*
- * The following data structure is used to keep track of whether an arbitrary
- * block of memory has been deleted. This is used by the TclHandle code to
- * avoid the more time-expensive algorithm of Tcl_Preserve(). This mechanism
- * is mainly used when we have lots of references to a few big, expensive
- * objects that we don't want to live any longer than necessary.
- */
-
-typedef struct HandleStruct {
- void *ptr; /* Pointer to the memory block being tracked.
- * This field will become NULL when the memory
- * block is deleted. This field must be the
- * first in the structure. */
-#ifdef TCL_MEM_DEBUG
- void *ptr2; /* Backup copy of the above pointer used to
- * ensure that the contents of the handle are
- * not changed by anyone else. */
-#endif
- int refCount; /* Number of TclHandlePreserve() calls in
- * effect on this handle. */
-} HandleStruct;
/*
*----------------------------------------------------------------------
@@ -298,6 +282,28 @@ Tcl_EventuallyFree(
}
/*
+ * The following data structure is used to keep track of whether an arbitrary
+ * block of memory has been deleted. This is used by the TclHandle code to
+ * avoid the more time-expensive algorithm of Tcl_Preserve(). This mechanism
+ * is mainly used when we have lots of references to a few big, expensive
+ * objects that we don't want to live any longer than necessary.
+ */
+
+typedef struct HandleStruct {
+ void *ptr; /* Pointer to the memory block being tracked.
+ * This field will become NULL when the memory
+ * block is deleted. This field must be the
+ * first in the structure. */
+#ifdef TCL_MEM_DEBUG
+ void *ptr2; /* Backup copy of the above pointer used to
+ * ensure that the contents of the handle are
+ * not changed by anyone else. */
+#endif
+ int refCount; /* Number of TclHandlePreserve() calls in
+ * effect on this handle. */
+} HandleStruct;
+
+/*
*---------------------------------------------------------------------------
*
* TclHandleCreate --