summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tcl.decls22
-rw-r--r--generic/tcl.h50
-rw-r--r--generic/tclBinary.c2
-rw-r--r--generic/tclCkalloc.c96
-rw-r--r--generic/tclDecls.h63
-rw-r--r--generic/tclIO.c2
-rw-r--r--generic/tclIO.h2
-rw-r--r--generic/tclIORChan.c2
-rw-r--r--generic/tclInt.decls6
-rw-r--r--generic/tclInt.h16
-rw-r--r--generic/tclIntDecls.h12
-rw-r--r--generic/tclInterp.c2
-rw-r--r--generic/tclObj.c5
-rw-r--r--generic/tclStubInit.c16
-rw-r--r--generic/tclTest.c19
-rw-r--r--generic/tclTestProcBodyObj.c2
-rw-r--r--generic/tclThreadAlloc.c16
-rw-r--r--win/tclAppInit.c2
-rw-r--r--win/tclWin32Dll.c2
19 files changed, 171 insertions, 166 deletions
diff --git a/generic/tcl.decls b/generic/tcl.decls
index c7686a1..0ee5eec 100644
--- a/generic/tcl.decls
+++ b/generic/tcl.decls
@@ -40,22 +40,22 @@ declare 2 {
void Tcl_Panic(const char *format, ...)
}
declare 3 {
- char *Tcl_Alloc(unsigned int size)
+ void *Tcl_MemAlloc(size_t size)
}
declare 4 {
- void Tcl_Free(char *ptr)
+ void Tcl_MemFree(void *ptr)
}
declare 5 {
- char *Tcl_Realloc(char *ptr, unsigned int size)
+ void *Tcl_MemRealloc(void *ptr, size_t size)
}
declare 6 {
- char *Tcl_DbCkalloc(unsigned int size, const char *file, int line)
+ void *Tcl_DbCkalloc(size_t size, const char *file, int line)
}
declare 7 {
- void Tcl_DbCkfree(char *ptr, const char *file, int line)
+ void Tcl_DbCkfree(void *ptr, const char *file, int line)
}
declare 8 {
- char *Tcl_DbCkrealloc(char *ptr, unsigned int size,
+ void *Tcl_DbCkrealloc(void *ptr, size_t size,
const char *file, int line)
}
@@ -286,7 +286,7 @@ declare 75 {
declare 76 {
void Tcl_BackgroundError(Tcl_Interp *interp)
}
-# Removed in 9.0
+# Removed in 9.0. Don't re-use it in any 9.x release, see TIP ???.
#declare 77 {
# char Tcl_Backslash(const char *src, int *readPtr)
#}
@@ -1536,16 +1536,16 @@ declare 427 {
int flags, Tcl_CommandTraceProc *proc, ClientData clientData)
}
declare 428 {
- char *Tcl_AttemptAlloc(unsigned int size)
+ void *Tcl_AttemptMemAlloc(size_t size)
}
declare 429 {
- char *Tcl_AttemptDbCkalloc(unsigned int size, const char *file, int line)
+ void *Tcl_AttemptDbCkalloc(size_t size, const char *file, int line)
}
declare 430 {
- char *Tcl_AttemptRealloc(char *ptr, unsigned int size)
+ void *Tcl_AttemptMemRealloc(void *ptr, size_t size)
}
declare 431 {
- char *Tcl_AttemptDbCkrealloc(char *ptr, unsigned int size,
+ void *Tcl_AttemptDbCkrealloc(void *ptr, size_t size,
const char *file, int line)
}
declare 432 {
diff --git a/generic/tcl.h b/generic/tcl.h
index cf0b2728a..96cffa5 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -568,16 +568,16 @@ typedef void (Tcl_DupInternalRepProc) (struct Tcl_Obj *srcPtr,
typedef int (Tcl_EncodingConvertProc) (ClientData clientData, const char *src,
int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst,
int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr);
-typedef void (Tcl_EncodingFreeProc) (ClientData clientData);
typedef int (Tcl_EventProc) (Tcl_Event *evPtr, int flags);
typedef void (Tcl_EventCheckProc) (ClientData clientData, int flags);
typedef int (Tcl_EventDeleteProc) (Tcl_Event *evPtr, ClientData clientData);
typedef void (Tcl_EventSetupProc) (ClientData clientData, int flags);
-typedef void (Tcl_ExitProc) (ClientData clientData);
typedef void (Tcl_FileProc) (ClientData clientData, int mask);
-typedef void (Tcl_FileFreeProc) (ClientData clientData);
typedef void (Tcl_FreeInternalRepProc) (struct Tcl_Obj *objPtr);
-typedef void (Tcl_FreeProc) (char *blockPtr);
+typedef void (Tcl_FreeProc) (void *blockPtr);
+#define Tcl_EncodingFreeProc Tcl_FreeProc
+#define Tcl_ExitProc Tcl_FreeProc
+#define Tcl_FileFreeProc Tcl_FreeProc
typedef void (Tcl_IdleProc) (ClientData clientData);
typedef void (Tcl_InterpDeleteProc) (ClientData clientData,
Tcl_Interp *interp);
@@ -1508,7 +1508,7 @@ typedef int (Tcl_FSPathInFilesystemProc) (Tcl_Obj *pathPtr,
ClientData *clientDataPtr);
typedef Tcl_Obj * (Tcl_FSFilesystemPathTypeProc) (Tcl_Obj *pathPtr);
typedef Tcl_Obj * (Tcl_FSFilesystemSeparatorProc) (Tcl_Obj *pathPtr);
-typedef void (Tcl_FSFreeInternalRepProc) (ClientData clientData);
+#define Tcl_FSFreeInternalRepProc Tcl_FreeProc
typedef ClientData (Tcl_FSDupInternalRepProc) (ClientData clientData);
typedef Tcl_Obj * (Tcl_FSInternalToNormalizedProc) (ClientData clientData);
typedef ClientData (Tcl_FSCreateInternalRepProc) (Tcl_Obj *pathPtr);
@@ -1914,7 +1914,7 @@ typedef struct Tcl_EncodingType {
Tcl_EncodingConvertProc *fromUtfProc;
/* Function to convert from UTF-8 into
* external encoding. */
- Tcl_EncodingFreeProc *freeProc;
+ Tcl_FreeProc *freeProc;
/* If non-NULL, function to call when this
* encoding is deleted. */
ClientData clientData; /* Arbitrary value associated with encoding
@@ -2255,37 +2255,43 @@ TCLAPI void Tcl_GetMemoryInfo(Tcl_DString *dsPtr);
* defined in tclCkalloc.c.
*/
+#define Tcl_Alloc ckalloc
+#define Tcl_Free ckfree
+#define Tcl_Realloc ckrealloc
+#define Tcl_AttemptAlloc attemptckalloc
+#define Tcl_AttemptRealloc attemptckrealloc
+
#ifdef TCL_MEM_DEBUG
# define ckalloc(x) \
- ((void *) Tcl_DbCkalloc((unsigned)(x), __FILE__, __LINE__))
+ (Tcl_DbCkalloc((x), __FILE__, __LINE__))
# define ckfree(x) \
- Tcl_DbCkfree((char *)(x), __FILE__, __LINE__)
+ Tcl_DbCkfree((x), __FILE__, __LINE__)
# define ckrealloc(x,y) \
- ((void *) Tcl_DbCkrealloc((char *)(x), (unsigned)(y), __FILE__, __LINE__))
+ (Tcl_DbCkrealloc((x), (y), __FILE__, __LINE__))
# define attemptckalloc(x) \
- ((void *) Tcl_AttemptDbCkalloc((unsigned)(x), __FILE__, __LINE__))
+ (Tcl_AttemptDbCkalloc((x), __FILE__, __LINE__))
# define attemptckrealloc(x,y) \
- ((void *) Tcl_AttemptDbCkrealloc((char *)(x), (unsigned)(y), __FILE__, __LINE__))
+ (Tcl_AttemptDbCkrealloc((x), (y), __FILE__, __LINE__))
#else /* !TCL_MEM_DEBUG */
/*
- * If we are not using the debugging allocator, we should call the Tcl_Alloc,
+ * If we are not using the debugging allocator, we should call the Tcl_MemAlloc,
* et al. routines in order to guarantee that every module is using the same
* memory allocator both inside and outside of the Tcl library.
*/
-# define ckalloc(x) \
- ((void *) Tcl_Alloc((unsigned)(x)))
-# define ckfree(x) \
- Tcl_Free((char *)(x))
-# define ckrealloc(x,y) \
- ((void *) Tcl_Realloc((char *)(x), (unsigned)(y)))
-# define attemptckalloc(x) \
- ((void *) Tcl_AttemptAlloc((unsigned)(x)))
-# define attemptckrealloc(x,y) \
- ((void *) Tcl_AttemptRealloc((char *)(x), (unsigned)(y)))
+# define ckalloc \
+ Tcl_MemAlloc
+# define ckfree \
+ Tcl_MemFree
+# define ckrealloc \
+ Tcl_MemRealloc
+# define attemptckalloc \
+ Tcl_AttemptMemAlloc
+# define attemptckrealloc \
+ Tcl_AttemptMemRealloc
# undef Tcl_InitMemory
# define Tcl_InitMemory(x)
# undef Tcl_DumpActiveMemory
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index 629319e..3b1bdff 100644
--- a/generic/tclBinary.c
+++ b/generic/tclBinary.c
@@ -202,7 +202,7 @@ typedef struct {
} ByteArray;
#define BYTEARRAY_SIZE(len) \
- ((unsigned) (TclOffset(ByteArray, bytes) + (len)))
+ ((TclOffset(ByteArray, bytes) + (len)))
#define GET_BYTEARRAY(objPtr) \
((ByteArray *) (objPtr)->internalRep.otherValuePtr)
#define SET_BYTEARRAY(objPtr, baPtr) \
diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c
index ede0d67..c25ed11 100644
--- a/generic/tclCkalloc.c
+++ b/generic/tclCkalloc.c
@@ -20,11 +20,9 @@
#define FALSE 0
#define TRUE 1
-#undef Tcl_Alloc
-#undef Tcl_Free
-#undef Tcl_Realloc
-#undef Tcl_AttemptAlloc
-#undef Tcl_AttemptRealloc
+#undef Tcl_MemFree
+#undef Tcl_AttemptMemAlloc
+#undef Tcl_AttemptMemRealloc
#ifdef TCL_MEM_DEBUG
@@ -751,35 +749,35 @@ Tcl_AttemptDbCkrealloc(
*/
char *
-Tcl_Alloc(
+Tcl_MemAlloc(
unsigned int size)
{
return Tcl_DbCkalloc(size, "unknown", 0);
}
char *
-Tcl_AttemptAlloc(
+Tcl_AttemptMemAlloc(
unsigned int size)
{
return Tcl_AttemptDbCkalloc(size, "unknown", 0);
}
void
-Tcl_Free(
+Tcl_MemFree(
char *ptr)
{
Tcl_DbCkfree(ptr, "unknown", 0);
}
char *
-Tcl_Realloc(
+Tcl_MemRealloc(
char *ptr,
unsigned int size)
{
return Tcl_DbCkrealloc(ptr, size, "unknown", 0);
}
char *
-Tcl_AttemptRealloc(
+Tcl_AttemptMemRealloc(
char *ptr,
unsigned int size)
{
@@ -1042,7 +1040,7 @@ Tcl_InitMemory(
/*
*----------------------------------------------------------------------
*
- * Tcl_Alloc --
+ * Tcl_MemAlloc --
*
* Interface to TclpAlloc when TCL_MEM_DEBUG is disabled. It does check
* that memory was actually allocated.
@@ -1050,11 +1048,11 @@ Tcl_InitMemory(
*----------------------------------------------------------------------
*/
-char *
-Tcl_Alloc(
- unsigned int size)
+void *
+Tcl_MemAlloc(
+ size_t size)
{
- char *result;
+ void *result;
result = TclpAlloc(size);
@@ -1074,15 +1072,15 @@ Tcl_Alloc(
return result;
}
-char *
+void *
Tcl_DbCkalloc(
- unsigned int size,
+ size_t size,
const char *file,
int line)
{
- char *result;
+ void *result;
- result = (char *) TclpAlloc(size);
+ result = TclpAlloc(size);
if ((result == NULL) && size) {
fflush(stdout);
@@ -1102,25 +1100,25 @@ Tcl_DbCkalloc(
*----------------------------------------------------------------------
*/
-char *
-Tcl_AttemptAlloc(
- unsigned int size)
+void *
+Tcl_AttemptMemAlloc(
+ size_t size)
{
- char *result;
+ void *result;
result = TclpAlloc(size);
return result;
}
-char *
+void *
Tcl_AttemptDbCkalloc(
- unsigned int size,
+ size_t size,
const char *file,
int line)
{
- char *result;
+ void *result;
- result = (char *) TclpAlloc(size);
+ result = TclpAlloc(size);
return result;
}
@@ -1135,10 +1133,10 @@ Tcl_AttemptDbCkalloc(
*----------------------------------------------------------------------
*/
-char *
-Tcl_Realloc(
- char *ptr,
- unsigned int size)
+void *
+Tcl_MemRealloc(
+ void *ptr,
+ size_t size)
{
char *result;
@@ -1150,16 +1148,16 @@ Tcl_Realloc(
return result;
}
-char *
+void *
Tcl_DbCkrealloc(
- char *ptr,
- unsigned int size,
+ void *ptr,
+ size_t size,
const char *file,
int line)
{
- char *result;
+ void *result;
- result = (char *) TclpRealloc(ptr, size);
+ result = TclpRealloc(ptr, size);
if ((result == NULL) && size) {
fflush(stdout);
@@ -1179,27 +1177,27 @@ Tcl_DbCkrealloc(
*----------------------------------------------------------------------
*/
-char *
-Tcl_AttemptRealloc(
- char *ptr,
- unsigned int size)
+void *
+Tcl_AttemptMemRealloc(
+ void *ptr,
+ size_t size)
{
- char *result;
+ void *result;
result = TclpRealloc(ptr, size);
return result;
}
-char *
+void *
Tcl_AttemptDbCkrealloc(
- char *ptr,
- unsigned int size,
+ void *ptr,
+ size_t size,
const char *file,
int line)
{
- char *result;
+ void *result;
- result = (char *) TclpRealloc(ptr, size);
+ result = TclpRealloc(ptr, size);
return result;
}
@@ -1216,15 +1214,15 @@ Tcl_AttemptDbCkrealloc(
*/
void
-Tcl_Free(
- char *ptr)
+Tcl_MemFree(
+ void *ptr)
{
TclpFree(ptr);
}
void
Tcl_DbCkfree(
- char *ptr,
+ void *ptr,
const char *file,
int line)
{
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index d7b2324..ca3d5c6 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -35,18 +35,18 @@ TCLAPI const char * Tcl_PkgRequireEx(Tcl_Interp *interp,
/* 2 */
TCLAPI void Tcl_Panic(const char *format, ...) TCL_FORMAT_PRINTF(1, 2);
/* 3 */
-TCLAPI char * Tcl_Alloc(unsigned int size);
+TCLAPI void * Tcl_MemAlloc(size_t size);
/* 4 */
-TCLAPI void Tcl_Free(char *ptr);
+TCLAPI void Tcl_MemFree(void *ptr);
/* 5 */
-TCLAPI char * Tcl_Realloc(char *ptr, unsigned int size);
+TCLAPI void * Tcl_MemRealloc(void *ptr, size_t size);
/* 6 */
-TCLAPI char * Tcl_DbCkalloc(unsigned int size, const char *file,
+TCLAPI void * Tcl_DbCkalloc(size_t size, const char *file,
int line);
/* 7 */
-TCLAPI void Tcl_DbCkfree(char *ptr, const char *file, int line);
+TCLAPI void Tcl_DbCkfree(void *ptr, const char *file, int line);
/* 8 */
-TCLAPI char * Tcl_DbCkrealloc(char *ptr, unsigned int size,
+TCLAPI void * Tcl_DbCkrealloc(void *ptr, size_t size,
const char *file, int line);
#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
/* 9 */
@@ -1190,14 +1190,14 @@ TCLAPI void Tcl_UntraceCommand(Tcl_Interp *interp,
Tcl_CommandTraceProc *proc,
ClientData clientData);
/* 428 */
-TCLAPI char * Tcl_AttemptAlloc(unsigned int size);
+TCLAPI void * Tcl_AttemptMemAlloc(size_t size);
/* 429 */
-TCLAPI char * Tcl_AttemptDbCkalloc(unsigned int size,
- const char *file, int line);
+TCLAPI void * Tcl_AttemptDbCkalloc(size_t size, const char *file,
+ int line);
/* 430 */
-TCLAPI char * Tcl_AttemptRealloc(char *ptr, unsigned int size);
+TCLAPI void * Tcl_AttemptMemRealloc(void *ptr, size_t size);
/* 431 */
-TCLAPI char * Tcl_AttemptDbCkrealloc(char *ptr, unsigned int size,
+TCLAPI void * Tcl_AttemptDbCkrealloc(void *ptr, size_t size,
const char *file, int line);
/* 432 */
TCLAPI int Tcl_AttemptSetObjLength(Tcl_Obj *objPtr, int length);
@@ -1771,12 +1771,12 @@ typedef struct TclStubs {
int (*tcl_PkgProvideEx) (Tcl_Interp *interp, const char *name, const char *version, const void *clientData); /* 0 */
const char * (*tcl_PkgRequireEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 1 */
void (*tcl_Panic) (const char *format, ...) TCL_FORMAT_PRINTF(1, 2); /* 2 */
- char * (*tcl_Alloc) (unsigned int size); /* 3 */
- void (*tcl_Free) (char *ptr); /* 4 */
- char * (*tcl_Realloc) (char *ptr, unsigned int size); /* 5 */
- char * (*tcl_DbCkalloc) (unsigned int size, const char *file, int line); /* 6 */
- void (*tcl_DbCkfree) (char *ptr, const char *file, int line); /* 7 */
- char * (*tcl_DbCkrealloc) (char *ptr, unsigned int size, const char *file, int line); /* 8 */
+ void * (*tcl_MemAlloc) (size_t size); /* 3 */
+ void (*tcl_MemFree) (void *ptr); /* 4 */
+ void * (*tcl_MemRealloc) (void *ptr, size_t size); /* 5 */
+ void * (*tcl_DbCkalloc) (size_t size, const char *file, int line); /* 6 */
+ void (*tcl_DbCkfree) (void *ptr, const char *file, int line); /* 7 */
+ void * (*tcl_DbCkrealloc) (void *ptr, size_t size, const char *file, int line); /* 8 */
#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
void (*tcl_CreateFileHandler) (int fd, int mask, Tcl_FileProc *proc, ClientData clientData); /* 9 */
#endif /* UNIX */
@@ -2220,10 +2220,10 @@ typedef struct TclStubs {
ClientData (*tcl_CommandTraceInfo) (Tcl_Interp *interp, const char *varName, int flags, Tcl_CommandTraceProc *procPtr, ClientData prevClientData); /* 425 */
int (*tcl_TraceCommand) (Tcl_Interp *interp, const char *varName, int flags, Tcl_CommandTraceProc *proc, ClientData clientData); /* 426 */
void (*tcl_UntraceCommand) (Tcl_Interp *interp, const char *varName, int flags, Tcl_CommandTraceProc *proc, ClientData clientData); /* 427 */
- char * (*tcl_AttemptAlloc) (unsigned int size); /* 428 */
- char * (*tcl_AttemptDbCkalloc) (unsigned int size, const char *file, int line); /* 429 */
- char * (*tcl_AttemptRealloc) (char *ptr, unsigned int size); /* 430 */
- char * (*tcl_AttemptDbCkrealloc) (char *ptr, unsigned int size, const char *file, int line); /* 431 */
+ void * (*tcl_AttemptMemAlloc) (size_t size); /* 428 */
+ void * (*tcl_AttemptDbCkalloc) (size_t size, const char *file, int line); /* 429 */
+ void * (*tcl_AttemptMemRealloc) (void *ptr, size_t size); /* 430 */
+ void * (*tcl_AttemptDbCkrealloc) (void *ptr, size_t size, const char *file, int line); /* 431 */
int (*tcl_AttemptSetObjLength) (Tcl_Obj *objPtr, int length); /* 432 */
Tcl_ThreadId (*tcl_GetChannelThread) (Tcl_Channel channel); /* 433 */
Tcl_UniChar * (*tcl_GetUnicodeFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 434 */
@@ -2445,12 +2445,12 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_PkgRequireEx) /* 1 */
#define Tcl_Panic \
(tclStubsPtr->tcl_Panic) /* 2 */
-#define Tcl_Alloc \
- (tclStubsPtr->tcl_Alloc) /* 3 */
-#define Tcl_Free \
- (tclStubsPtr->tcl_Free) /* 4 */
-#define Tcl_Realloc \
- (tclStubsPtr->tcl_Realloc) /* 5 */
+#define Tcl_MemAlloc \
+ (tclStubsPtr->tcl_MemAlloc) /* 3 */
+#define Tcl_MemFree \
+ (tclStubsPtr->tcl_MemFree) /* 4 */
+#define Tcl_MemRealloc \
+ (tclStubsPtr->tcl_MemRealloc) /* 5 */
#define Tcl_DbCkalloc \
(tclStubsPtr->tcl_DbCkalloc) /* 6 */
#define Tcl_DbCkfree \
@@ -3293,12 +3293,12 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_TraceCommand) /* 426 */
#define Tcl_UntraceCommand \
(tclStubsPtr->tcl_UntraceCommand) /* 427 */
-#define Tcl_AttemptAlloc \
- (tclStubsPtr->tcl_AttemptAlloc) /* 428 */
+#define Tcl_AttemptMemAlloc \
+ (tclStubsPtr->tcl_AttemptMemAlloc) /* 428 */
#define Tcl_AttemptDbCkalloc \
(tclStubsPtr->tcl_AttemptDbCkalloc) /* 429 */
-#define Tcl_AttemptRealloc \
- (tclStubsPtr->tcl_AttemptRealloc) /* 430 */
+#define Tcl_AttemptMemRealloc \
+ (tclStubsPtr->tcl_AttemptMemRealloc) /* 430 */
#define Tcl_AttemptDbCkrealloc \
(tclStubsPtr->tcl_AttemptDbCkrealloc) /* 431 */
#define Tcl_AttemptSetObjLength \
@@ -3749,5 +3749,4 @@ TCLAPI void Tcl_MainExW(int argc, wchar_t **argv,
# define Tcl_GlobalEvalObj(interp,objPtr) \
Tcl_EvalObjEx((interp),(objPtr),TCL_EVAL_GLOBAL)
#endif /* !TCL_NO_DEPRECATED */
-
#endif /* _TCLDECLS */
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 0ba441a..5855caf 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -2717,7 +2717,7 @@ CloseChannel(
if (chanPtr == statePtr->bottomChanPtr) {
if (statePtr->channelName != NULL) {
- ckfree(statePtr->channelName);
+ ckfree((char *)statePtr->channelName);
statePtr->channelName = NULL;
}
diff --git a/generic/tclIO.h b/generic/tclIO.h
index 1e89878..956ed15 100644
--- a/generic/tclIO.h
+++ b/generic/tclIO.h
@@ -156,7 +156,7 @@ typedef struct Channel {
*/
typedef struct ChannelState {
- const char *channelName; /* The name of the channel instance in Tcl
+ char *channelName; /* The name of the channel instance in Tcl
* commands. Storage is owned by the generic
* IO code, is dynamically allocated. */
int flags; /* ORed combination of the flags defined
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c
index 4b61538..b907dba 100644
--- a/generic/tclIORChan.c
+++ b/generic/tclIORChan.c
@@ -2303,7 +2303,7 @@ FreeReflectedChannel(
* Delete a cloned ChannelType structure.
*/
- ckfree(chanPtr->typePtr);
+ ckfree((void *) chanPtr->typePtr);
chanPtr->typePtr = NULL;
}
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index b840d04..dd7722d 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -291,7 +291,7 @@ declare 64 {
# int TclpAccess(const char *path, int mode)
#}
declare 69 {
- char *TclpAlloc(unsigned int size)
+ void *TclpAlloc(size_t size)
}
#declare 70 {
# int TclpCopyFile(const char *source, const char *dest)
@@ -307,7 +307,7 @@ declare 69 {
# int TclpDeleteFile(const char *path)
#}
declare 74 {
- void TclpFree(char *ptr)
+ void TclpFree(void *ptr)
}
declare 75 {
unsigned long TclpGetClicks(void)
@@ -334,7 +334,7 @@ declare 76 {
# char *modeString, int permissions)
#}
declare 81 {
- char *TclpRealloc(char *ptr, unsigned int size)
+ void *TclpRealloc(void *ptr, size_t size)
}
#declare 82 {
# int TclpRemoveDirectory(const char *path, int recursive,
diff --git a/generic/tclInt.h b/generic/tclInt.h
index df1507d..0f862e8 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -4151,7 +4151,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file,
(objPtr)->bytes = tclEmptyStringRep; \
(objPtr)->length = 0; \
} else { \
- (objPtr)->bytes = (char *) ckalloc((unsigned) ((len) + 1)); \
+ (objPtr)->bytes = ckalloc((unsigned) ((len) + 1)); \
memcpy((objPtr)->bytes, (bytePtr), (unsigned) (len)); \
(objPtr)->bytes[len] = '\0'; \
(objPtr)->length = (len); \
@@ -4601,9 +4601,9 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
*/
#ifdef offsetof
-#define TclOffset(type, field) ((int) offsetof(type, field))
+#define TclOffset(type, field) (offsetof(type, field))
#else
-#define TclOffset(type, field) ((int) ((char *) &((type *) 0)->field))
+#define TclOffset(type, field) (((char *) &((type *) 0)->field))
#endif
/*
@@ -4780,8 +4780,8 @@ typedef struct NRE_callback {
#define TCLNR_FREE(interp, ptr) TclSmallFreeEx((interp), (ptr))
#else
#define TCLNR_ALLOC(interp, ptr) \
- (ptr = ((ClientData) ckalloc(sizeof(NRE_callback))))
-#define TCLNR_FREE(interp, ptr) ckfree((char *) (ptr))
+ (ptr = (ckalloc(sizeof(NRE_callback))))
+#define TCLNR_FREE(interp, ptr) ckfree(ptr)
#endif
#if NRE_ENABLE_ASSERTS
@@ -4795,9 +4795,9 @@ typedef struct NRE_callback {
#include "tclTomMathDecls.h"
#if !defined(USE_TCL_STUBS) && !defined(TCL_MEM_DEBUG)
-#define Tcl_AttemptAlloc(size) TclpAlloc(size)
-#define Tcl_AttemptRealloc(ptr, size) TclpRealloc((ptr), (size))
-#define Tcl_Free(ptr) TclpFree(ptr)
+#define Tcl_AttemptMemAlloc(size) TclpAlloc(size)
+#define Tcl_AttemptMemRealloc(ptr, size) TclpRealloc((ptr), (size))
+#define Tcl_MemFree(ptr) TclpFree(ptr)
#endif
#endif /* _TCLINT */
diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h
index 26b168f..bbf6c6c 100644
--- a/generic/tclIntDecls.h
+++ b/generic/tclIntDecls.h
@@ -172,13 +172,13 @@ TCLAPI int TclObjInvoke(Tcl_Interp *interp, int objc,
/* Slot 67 is reserved */
/* Slot 68 is reserved */
/* 69 */
-TCLAPI char * TclpAlloc(unsigned int size);
+TCLAPI void * TclpAlloc(size_t size);
/* Slot 70 is reserved */
/* Slot 71 is reserved */
/* Slot 72 is reserved */
/* Slot 73 is reserved */
/* 74 */
-TCLAPI void TclpFree(char *ptr);
+TCLAPI void TclpFree(void *ptr);
/* 75 */
TCLAPI unsigned long TclpGetClicks(void);
/* 76 */
@@ -188,7 +188,7 @@ TCLAPI unsigned long TclpGetSeconds(void);
/* Slot 79 is reserved */
/* Slot 80 is reserved */
/* 81 */
-TCLAPI char * TclpRealloc(char *ptr, unsigned int size);
+TCLAPI void * TclpRealloc(void *ptr, size_t size);
/* Slot 82 is reserved */
/* Slot 83 is reserved */
/* Slot 84 is reserved */
@@ -616,19 +616,19 @@ typedef struct TclIntStubs {
void (*reserved66)(void);
void (*reserved67)(void);
void (*reserved68)(void);
- char * (*tclpAlloc) (unsigned int size); /* 69 */
+ void * (*tclpAlloc) (size_t size); /* 69 */
void (*reserved70)(void);
void (*reserved71)(void);
void (*reserved72)(void);
void (*reserved73)(void);
- void (*tclpFree) (char *ptr); /* 74 */
+ void (*tclpFree) (void *ptr); /* 74 */
unsigned long (*tclpGetClicks) (void); /* 75 */
unsigned long (*tclpGetSeconds) (void); /* 76 */
void (*reserved77)(void);
void (*reserved78)(void);
void (*reserved79)(void);
void (*reserved80)(void);
- char * (*tclpRealloc) (char *ptr, unsigned int size); /* 81 */
+ void * (*tclpRealloc) (void *ptr, size_t size); /* 81 */
void (*reserved82)(void);
void (*reserved83)(void);
void (*reserved84)(void);
diff --git a/generic/tclInterp.c b/generic/tclInterp.c
index 8b7a5a4..442a683 100644
--- a/generic/tclInterp.c
+++ b/generic/tclInterp.c
@@ -3466,7 +3466,7 @@ Tcl_LimitAddHandler(
*/
if (deleteProc == (Tcl_LimitHandlerDeleteProc *) TCL_DYNAMIC) {
- deleteProc = (Tcl_LimitHandlerDeleteProc *) Tcl_Free;
+ deleteProc = (Tcl_LimitHandlerDeleteProc *) Tcl_MemFree;
}
if (deleteProc == (Tcl_LimitHandlerDeleteProc *) TCL_STATIC) {
deleteProc = NULL;
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 7841bcf..5f653a4 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -97,7 +97,7 @@ typedef struct ThreadSpecificData {
static Tcl_ThreadDataKey dataKey;
-static void ContLineLocFree(char *clientData);
+static void ContLineLocFree(void *clientData);
static void TclThreadFinalizeContLines(ClientData clientData);
static ThreadSpecificData *TclGetContLineTable(void);
@@ -840,7 +840,7 @@ TclThreadFinalizeContLines(
static void
ContLineLocFree(
- char *clientData)
+ void *clientData)
{
ckfree(clientData);
}
@@ -1664,6 +1664,7 @@ Tcl_GetString(
*----------------------------------------------------------------------
*/
+#undef Tcl_GetStringFromObj
char *
Tcl_GetStringFromObj(
register Tcl_Obj *objPtr, /* Object whose string rep byte pointer should
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 7a4b0c0..4db2d2e 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -22,9 +22,9 @@
* Remove macros that will interfere with the definitions below.
*/
-#undef Tcl_Alloc
-#undef Tcl_Free
-#undef Tcl_Realloc
+#undef Tcl_MemAlloc
+#undef Tcl_MemFree
+#undef Tcl_MemRealloc
#undef Tcl_NewBooleanObj
#undef Tcl_NewByteArrayObj
#undef Tcl_NewDoubleObj
@@ -641,9 +641,9 @@ const TclStubs tclStubs = {
Tcl_PkgProvideEx, /* 0 */
Tcl_PkgRequireEx, /* 1 */
Tcl_Panic, /* 2 */
- Tcl_Alloc, /* 3 */
- Tcl_Free, /* 4 */
- Tcl_Realloc, /* 5 */
+ Tcl_MemAlloc, /* 3 */
+ Tcl_MemFree, /* 4 */
+ Tcl_MemRealloc, /* 5 */
Tcl_DbCkalloc, /* 6 */
Tcl_DbCkfree, /* 7 */
Tcl_DbCkrealloc, /* 8 */
@@ -1090,9 +1090,9 @@ const TclStubs tclStubs = {
Tcl_CommandTraceInfo, /* 425 */
Tcl_TraceCommand, /* 426 */
Tcl_UntraceCommand, /* 427 */
- Tcl_AttemptAlloc, /* 428 */
+ Tcl_AttemptMemAlloc, /* 428 */
Tcl_AttemptDbCkalloc, /* 429 */
- Tcl_AttemptRealloc, /* 430 */
+ Tcl_AttemptMemRealloc, /* 430 */
Tcl_AttemptDbCkrealloc, /* 431 */
Tcl_AttemptSetObjLength, /* 432 */
Tcl_GetChannelThread, /* 433 */
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 8b4a730..fae020f 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -200,7 +200,7 @@ static int ObjTraceProc(ClientData clientData,
Tcl_Obj *const objv[]);
static void ObjTraceDeleteProc(ClientData clientData);
static void PrintParse(Tcl_Interp *interp, Tcl_Parse *parsePtr);
-static void SpecialFree(char *blockPtr);
+static void SpecialFree(void *blockPtr);
static int StaticInitProc(Tcl_Interp *interp);
static int TestasyncCmd(ClientData dummy,
Tcl_Interp *interp, int argc, const char **argv);
@@ -309,7 +309,7 @@ static void TestregexpXflags(const char *string,
static int TestsaveresultCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-static void TestsaveresultFree(char *blockPtr);
+static void TestsaveresultFree(void *blockPtr);
static int TestsetassocdataCmd(ClientData dummy,
Tcl_Interp *interp, int argc, const char **argv);
static int TestsetCmd(ClientData dummy,
@@ -893,7 +893,8 @@ AsyncHandlerProc(
{
TestAsyncHandler *asyncPtr;
int id = PTR2INT(clientData);
- const char *listArgv[4], *cmd;
+ const char *listArgv[4];
+ char *cmd;
char string[TCL_INTEGER_SPACE];
Tcl_MutexLock(&asyncTestMutex);
@@ -1839,9 +1840,9 @@ TestdstringCmd(
*/
static void SpecialFree(blockPtr)
- char *blockPtr; /* Block to free. */
+ void *blockPtr; /* Block to free. */
{
- ckfree(blockPtr - 16);
+ ckfree(((char *)blockPtr) - 16);
}
/*
@@ -2263,9 +2264,9 @@ TesteventDeleteProc(
return 0;
}
targetName = (Tcl_Obj *) clientData;
- targetNameStr = (char *) Tcl_GetStringFromObj(targetName, NULL);
+ targetNameStr = (char *) Tcl_GetString(targetName);
ev = (TestEvent *) event;
- evNameStr = Tcl_GetStringFromObj(ev->tag, NULL);
+ evNameStr = Tcl_GetString(ev->tag);
if (strcmp(evNameStr, targetNameStr) == 0) {
Tcl_DecrRefCount(ev->tag);
Tcl_DecrRefCount(ev->command);
@@ -4364,7 +4365,7 @@ TestpanicCmd(
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
{
- const char *argString;
+ char *argString;
/*
* Put the arguments into a var args structure
@@ -4960,7 +4961,7 @@ TestsaveresultCmd(
static void
TestsaveresultFree(
- char *blockPtr)
+ void *blockPtr)
{
/* empty... */
}
diff --git a/generic/tclTestProcBodyObj.c b/generic/tclTestProcBodyObj.c
index be510fc..c098489 100644
--- a/generic/tclTestProcBodyObj.c
+++ b/generic/tclTestProcBodyObj.c
@@ -245,7 +245,7 @@ ProcBodyTestProcObjCmd(
* Find the Command pointer to this procedure
*/
- fullName = Tcl_GetStringFromObj(objv[3], NULL);
+ fullName = Tcl_GetString(objv[3]);
procCmd = Tcl_FindCommand(interp, fullName, NULL, TCL_LEAVE_ERR_MSG);
if (procCmd == NULL) {
return TCL_ERROR;
diff --git a/generic/tclThreadAlloc.c b/generic/tclThreadAlloc.c
index e57988b..b324560 100644
--- a/generic/tclThreadAlloc.c
+++ b/generic/tclThreadAlloc.c
@@ -306,9 +306,9 @@ TclFreeAllocCache(
*----------------------------------------------------------------------
*/
-char *
+void *
TclpAlloc(
- unsigned int reqSize)
+ size_t reqSize)
{
Cache *cachePtr;
Block *blockPtr;
@@ -321,7 +321,7 @@ TclpAlloc(
const size_t zero = 0;
const size_t max = ~zero;
- if (((size_t) reqSize) > max - sizeof(Block) - RCHECK) {
+ if (reqSize > max - sizeof(Block) - RCHECK) {
/* Requested allocation exceeds memory */
return NULL;
}
@@ -385,7 +385,7 @@ TclpAlloc(
void
TclpFree(
- char *ptr)
+ void *ptr)
{
Cache *cachePtr;
Block *blockPtr;
@@ -439,10 +439,10 @@ TclpFree(
*----------------------------------------------------------------------
*/
-char *
+void *
TclpRealloc(
- char *ptr,
- unsigned int reqSize)
+ void *ptr,
+ size_t reqSize)
{
Cache *cachePtr;
Block *blockPtr;
@@ -460,7 +460,7 @@ TclpRealloc(
const size_t zero = 0;
const size_t max = ~zero;
- if (((size_t) reqSize) > max - sizeof(Block) - RCHECK) {
+ if ((reqSize) > max - sizeof(Block) - RCHECK) {
/* Requested allocation exceeds memory */
return NULL;
}
diff --git a/win/tclAppInit.c b/win/tclAppInit.c
index 5ecebea..917cf00 100644
--- a/win/tclAppInit.c
+++ b/win/tclAppInit.c
@@ -255,7 +255,7 @@ setargv(
}
/* Make sure we don't call ckalloc through the (not yet initialized) stub table */
- #undef Tcl_Alloc
+ #undef Tcl_MemAlloc
#undef Tcl_DbCkalloc
argSpace = ckalloc(size * sizeof(char *)
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index 019d76f..ae025e8 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.c
@@ -66,7 +66,7 @@ BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason,
*/
typedef struct MountPointMap {
- const TCHAR *volumeName; /* Native wide string volume name. */
+ TCHAR *volumeName; /* Native wide string volume name. */
TCHAR driveLetter; /* Drive letter corresponding to the volume
* name. */
struct MountPointMap *nextPtr;