summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclInt.decls18
-rw-r--r--generic/tclInt.h191
-rw-r--r--generic/tclIntDecls.h24
-rw-r--r--generic/tclStubInit.c6
4 files changed, 116 insertions, 123 deletions
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index 6330836..75cb20a 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -290,9 +290,9 @@ declare 64 {
#declare 68 {
# int TclpAccess(const char *path, int mode)
#}
-declare 69 {
- char *TclpAlloc(unsigned int size)
-}
+#declare 69 {
+# char *TclpAlloc(unsigned int size)
+#}
#declare 70 {
# int TclpCopyFile(const char *source, const char *dest)
#}
@@ -306,9 +306,9 @@ declare 69 {
#declare 73 {
# int TclpDeleteFile(const char *path)
#}
-declare 74 {
- void TclpFree(char *ptr)
-}
+#declare 74 {
+# void TclpFree(char *ptr)
+#}
declare 75 {
unsigned long TclpGetClicks(void)
}
@@ -332,9 +332,9 @@ declare 78 {
# Tcl_Channel TclpOpenFileChannel(Tcl_Interp *interp, char *fileName,
# char *modeString, int permissions)
#}
-declare 81 {
- char *TclpRealloc(char *ptr, unsigned int size)
-}
+#declare 81 {
+# char *TclpRealloc(char *ptr, unsigned int size)
+#}
#declare 82 {
# int TclpRemoveDirectory(const char *path, int recursive,
# Tcl_DString *errorPtr)
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 6bc8f49..1f1e1d3 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -3815,6 +3815,101 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file,
#endif /* TCL_MEM_DEBUG */
/*
+ * Macros that drive the allocator behaviour
+ */
+
+#if defined(TCL_THREADS)
+/*
+ * The TCL_THREADS mode is like the regular mode but allocates Tcl_Obj's from
+ * per-thread caches.
+ */
+MODULE_SCOPE void TclpFreeAllocCache(void *);
+MODULE_SCOPE void * TclpGetAllocCache(void);
+MODULE_SCOPE void TclpSetAllocCache(void *);
+MODULE_SCOPE void TclFreeAllocCache(void *);
+MODULE_SCOPE void TclpFreeAllocMutex(Tcl_Mutex *mutex);
+MODULE_SCOPE Tcl_Mutex *TclpNewAllocMutex(void);
+#endif
+
+/*
+ * List of valid allocators. Have to respect the following convention:
+ * - allocators that shunt TclpAlloc to malloc are below aNONE
+ * - allocators that use zippy are above aNONE
+ */
+
+#define aNATIVE 0
+#define aPURIFY 1
+#define aNONE 2
+#define aZIPPY 3
+#define aMULTI 4
+
+#if defined(TCL_ALLOCATOR) && ((TCL_ALLOCATOR < 0) || (TCL_ALLOCATOR > aMULTI))
+#undef TCL_ALLOCATOR
+#endif
+
+#ifdef PURIFY
+# undef TCL_ALLOCATOR
+# define TCL_ALLOCATOR aPURIFY
+#endif
+
+#if !defined(TCL_ALLOCATOR)
+# if defined(USE_THREAD_ALLOC) || defined(USE_TCLALLOC)
+# define TCL_ALLOCATOR aZIPPY
+# else
+# define TCL_ALLOCATOR aNATIVE
+# endif
+#endif
+
+#if TCL_ALLOCATOR < aNONE /* native or purify */
+# define TclpAlloc(size) ckalloc(size)
+# define TclpRealloc(ptr, size) ckrealloc((ptr),(size))
+# define TclpFree(size) ckfree(size)
+# define TclAllocMaximize(ptr) UINT_MAX
+#else
+ MODULE_SCOPE char * TclpAlloc(unsigned int size);
+ MODULE_SCOPE char * TclpRealloc(char * ptr, unsigned int size);
+ MODULE_SCOPE void TclpFree(char * ptr);
+ MODULE_SCOPE unsigned int TclAllocMaximize(void *ptr);
+#endif
+
+#if TCL_ALLOCATOR == aPURIFY
+# define TclSmallAlloc() ckalloc(sizeof(Tcl_Obj))
+# define TclSmallFree(ptr) ckfree(ptr)
+# define TclInitAlloc()
+# define TclFinalizeAlloc()
+#else
+ MODULE_SCOPE void * TclSmallAlloc();
+ MODULE_SCOPE void TclSmallFree(void *ptr);
+ MODULE_SCOPE void TclInitAlloc(void);
+ MODULE_SCOPE void TclFinalizeAlloc(void);
+#endif
+
+#define TclCkSmallAlloc(nbytes, memPtr) \
+ do { \
+ TCL_CT_ASSERT((nbytes)<=sizeof(Tcl_Obj)); \
+ memPtr = TclSmallAlloc(); \
+ } while (0)
+
+/*
+ * Support for Clang Static Analyzer <http://clang-analyzer.llvm.org>
+ */
+
+#if (TCL_ALLOCATOR == aPURIFY) && defined(__clang__)
+#if __has_feature(attribute_analyzer_noreturn) && \
+ !defined(Tcl_Panic) && defined(Tcl_Panic_TCL_DECLARED)
+void Tcl_Panic(const char *, ...) __attribute__((analyzer_noreturn));
+#endif
+#if !defined(CLANG_ASSERT)
+#include <assert.h>
+#define CLANG_ASSERT(x) assert(x)
+#endif
+#elif !defined(CLANG_ASSERT)
+ #define CLANG_ASSERT(x)
+#endif /* PURIFY && __clang__ */
+
+
+
+/*
*----------------------------------------------------------------
* Macro used by the Tcl core to set a Tcl_Obj's string representation to a
* copy of the "len" bytes starting at "bytePtr". This code works even if the
@@ -4411,102 +4506,6 @@ typedef struct NRE_callback {
#include "tclIntPlatDecls.h"
#include "tclTomMathDecls.h"
-/*
- * Macros that drive the allocator behaviour
- * WARNING: these have to come AFTER tclIntDecls.h, as some macros may
- * interfere with those declarations.
- */
-
-#if defined(TCL_THREADS)
-/*
- * The TCL_THREADS mode is like the regular mode but allocates Tcl_Obj's from
- * per-thread caches.
- */
-MODULE_SCOPE void TclpFreeAllocCache(void *);
-MODULE_SCOPE void * TclpGetAllocCache(void);
-MODULE_SCOPE void TclpSetAllocCache(void *);
-MODULE_SCOPE void TclFreeAllocCache(void *);
-MODULE_SCOPE void TclpFreeAllocMutex(Tcl_Mutex *mutex);
-MODULE_SCOPE Tcl_Mutex *TclpNewAllocMutex(void);
-#endif
-
-/*
- * List of valid allocators. Have to respect the following convention:
- * - allocators that shunt TclpAlloc to malloc are below aNONE
- * - allocators that use zippy are above aNONE
- */
-
-#define aNATIVE 0
-#define aPURIFY 1
-#define aNONE 2
-#define aZIPPY 3
-#define aMULTI 4
-
-#if defined(TCL_ALLOCATOR) && ((TCL_ALLOCATOR < 0) || (TCL_ALLOCATOR > aMULTI))
-#undef TCL_ALLOCATOR
-#endif
-
-#ifdef PURIFY
-# undef TCL_ALLOCATOR
-# define TCL_ALLOCATOR aPURIFY
-#endif
-
-#if !defined(TCL_ALLOCATOR)
-# if defined(USE_THREAD_ALLOC) || defined(USE_TCLALLOC)
-# define TCL_ALLOCATOR aZIPPY
-# else
-# define TCL_ALLOCATOR aNATIVE
-# endif
-#endif
-
-#if TCL_ALLOCATOR < aNONE /* native or purify */
-# define TclpAlloc(size) ckalloc(size)
-# define TclpRealloc(ptr, size) ckrealloc((ptr),(size))
-# define TclpFree(size) ckfree(size)
-# define TclAllocMaximize(ptr) UINT_MAX
-#else
- MODULE_SCOPE char * TclpAlloc(unsigned int size);
- MODULE_SCOPE char * TclpRealloc(char * ptr, unsigned int size);
- MODULE_SCOPE void TclpFree(char * ptr);
- MODULE_SCOPE unsigned int TclAllocMaximize(void *ptr);
-#endif
-
-#if TCL_ALLOCATOR == aPURIFY
-# define TclSmallAlloc() ckalloc(sizeof(Tcl_Obj))
-# define TclSmallFree(ptr) ckfree(ptr)
-# define TclInitAlloc()
-# define TclFinalizeAlloc()
-#else
- MODULE_SCOPE void * TclSmallAlloc();
- MODULE_SCOPE void TclSmallFree(void *ptr);
- MODULE_SCOPE void TclInitAlloc(void);
- MODULE_SCOPE void TclFinalizeAlloc(void);
-#endif
-
-#define TclCkSmallAlloc(nbytes, memPtr) \
- do { \
- TCL_CT_ASSERT((nbytes)<=sizeof(Tcl_Obj)); \
- memPtr = TclSmallAlloc(); \
- } while (0)
-
-/*
- * Support for Clang Static Analyzer <http://clang-analyzer.llvm.org>
- */
-
-#if (TCL_ALLOCATOR == aPURIFY) && defined(__clang__)
-#if __has_feature(attribute_analyzer_noreturn) && \
- !defined(Tcl_Panic) && defined(Tcl_Panic_TCL_DECLARED)
-void Tcl_Panic(const char *, ...) __attribute__((analyzer_noreturn));
-#endif
-#if !defined(CLANG_ASSERT)
-#include <assert.h>
-#define CLANG_ASSERT(x) assert(x)
-#endif
-#elif !defined(CLANG_ASSERT)
- #define CLANG_ASSERT(x)
-#endif /* PURIFY && __clang__ */
-
-
#endif /* _TCLINT */
/*
diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h
index 0966d32..dce5dae 100644
--- a/generic/tclIntDecls.h
+++ b/generic/tclIntDecls.h
@@ -199,14 +199,12 @@ EXTERN int TclObjInvoke(Tcl_Interp *interp, int objc,
/* Slot 66 is reserved */
/* Slot 67 is reserved */
/* Slot 68 is reserved */
-/* 69 */
-EXTERN char * TclpAlloc(unsigned int size);
+/* Slot 69 is reserved */
/* Slot 70 is reserved */
/* Slot 71 is reserved */
/* Slot 72 is reserved */
/* Slot 73 is reserved */
-/* 74 */
-EXTERN void TclpFree(char *ptr);
+/* Slot 74 is reserved */
/* 75 */
EXTERN unsigned long TclpGetClicks(void);
/* 76 */
@@ -217,8 +215,7 @@ EXTERN void TclpGetTime(Tcl_Time *time);
EXTERN int TclpGetTimeZone(unsigned long time);
/* Slot 79 is reserved */
/* Slot 80 is reserved */
-/* 81 */
-EXTERN char * TclpRealloc(char *ptr, unsigned int size);
+/* Slot 81 is reserved */
/* Slot 82 is reserved */
/* Slot 83 is reserved */
/* Slot 84 is reserved */
@@ -672,19 +669,19 @@ typedef struct TclIntStubs {
void (*reserved66)(void);
void (*reserved67)(void);
void (*reserved68)(void);
- char * (*tclpAlloc) (unsigned int size); /* 69 */
+ void (*reserved69)(void);
void (*reserved70)(void);
void (*reserved71)(void);
void (*reserved72)(void);
void (*reserved73)(void);
- void (*tclpFree) (char *ptr); /* 74 */
+ void (*reserved74)(void);
unsigned long (*tclpGetClicks) (void); /* 75 */
unsigned long (*tclpGetSeconds) (void); /* 76 */
void (*tclpGetTime) (Tcl_Time *time); /* 77 */
int (*tclpGetTimeZone) (unsigned long time); /* 78 */
void (*reserved79)(void);
void (*reserved80)(void);
- char * (*tclpRealloc) (char *ptr, unsigned int size); /* 81 */
+ void (*reserved81)(void);
void (*reserved82)(void);
void (*reserved83)(void);
void (*reserved84)(void);
@@ -977,14 +974,12 @@ extern const TclIntStubs *tclIntStubsPtr;
/* Slot 66 is reserved */
/* Slot 67 is reserved */
/* Slot 68 is reserved */
-#define TclpAlloc \
- (tclIntStubsPtr->tclpAlloc) /* 69 */
+/* Slot 69 is reserved */
/* Slot 70 is reserved */
/* Slot 71 is reserved */
/* Slot 72 is reserved */
/* Slot 73 is reserved */
-#define TclpFree \
- (tclIntStubsPtr->tclpFree) /* 74 */
+/* Slot 74 is reserved */
#define TclpGetClicks \
(tclIntStubsPtr->tclpGetClicks) /* 75 */
#define TclpGetSeconds \
@@ -995,8 +990,7 @@ extern const TclIntStubs *tclIntStubsPtr;
(tclIntStubsPtr->tclpGetTimeZone) /* 78 */
/* Slot 79 is reserved */
/* Slot 80 is reserved */
-#define TclpRealloc \
- (tclIntStubsPtr->tclpRealloc) /* 81 */
+/* Slot 81 is reserved */
/* Slot 82 is reserved */
/* Slot 83 is reserved */
/* Slot 84 is reserved */
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 84c1ea9..0583961 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -123,19 +123,19 @@ static const TclIntStubs tclIntStubs = {
0, /* 66 */
0, /* 67 */
0, /* 68 */
- TclpAlloc, /* 69 */
+ 0, /* 69 */
0, /* 70 */
0, /* 71 */
0, /* 72 */
0, /* 73 */
- TclpFree, /* 74 */
+ 0, /* 74 */
TclpGetClicks, /* 75 */
TclpGetSeconds, /* 76 */
TclpGetTime, /* 77 */
TclpGetTimeZone, /* 78 */
0, /* 79 */
0, /* 80 */
- TclpRealloc, /* 81 */
+ 0, /* 81 */
0, /* 82 */
0, /* 83 */
0, /* 84 */