From 88eafacc822a9e546b2d075195d179e223a32296 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 12 Dec 2012 21:21:10 +0000 Subject: More memory API changes, mainly char* -> void* and unsigned -> size_t --- generic/tcl.decls | 20 +++++++-------- generic/tcl.h | 52 +++++++++++++++++++------------------- generic/tclBinary.c | 2 +- generic/tclCkalloc.c | 66 ++++++++++++++++++++++++------------------------ generic/tclDecls.h | 42 +++++++++++++++--------------- generic/tclIO.c | 2 +- generic/tclIO.h | 2 +- generic/tclIORChan.c | 2 +- generic/tclInt.decls | 6 ++--- generic/tclInt.h | 10 ++++---- generic/tclIntDecls.h | 12 ++++----- generic/tclObj.c | 4 +-- generic/tclTest.c | 15 ++++++----- generic/tclThreadAlloc.c | 16 ++++++------ generic/tclThreadTest.c | 8 +++--- win/tclWin32Dll.c | 2 +- 16 files changed, 131 insertions(+), 130 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index 88567e3..87106ef 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_MemAlloc(unsigned int size) + void *Tcl_MemAlloc(size_t size) } declare 4 { - void Tcl_MemFree(char *ptr) + void Tcl_MemFree(void *ptr) } declare 5 { - char *Tcl_MemRealloc(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) } @@ -1527,16 +1527,16 @@ declare 427 { int flags, Tcl_CommandTraceProc *proc, ClientData clientData) } declare 428 { - char *Tcl_AttemptMemAlloc(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_AttemptMemRealloc(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 121ab5c..e46fccf 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); @@ -1511,7 +1511,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); @@ -1917,7 +1917,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,24 +2255,24 @@ TCLAPI void Tcl_GetMemoryInfo(Tcl_DString *dsPtr); * defined in tclCkalloc.c. */ -#define Tcl_Alloc(x) ckalloc(x) -#define Tcl_Free(x) ckfree(x) -#define Tcl_Realloc(x, y) ckrealloc(x, y) -#define Tcl_AttemptAlloc(x) attemptckalloc(x) -#define Tcl_AttemptRealloc(x, y) attemptckrealloc(x, y) +#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 */ @@ -2282,16 +2282,16 @@ TCLAPI void Tcl_GetMemoryInfo(Tcl_DString *dsPtr); * memory allocator both inside and outside of the Tcl library. */ -# define ckalloc(x) \ - ((void *) Tcl_MemAlloc((unsigned)(x))) -# define ckfree(x) \ - Tcl_MemFree((char *)(x)) -# define ckrealloc(x,y) \ - ((void *) Tcl_MemRealloc((char *)(x), (unsigned)(y))) -# define attemptckalloc(x) \ - ((void *) Tcl_AttemptMemAlloc((unsigned)(x))) -# define attemptckrealloc(x,y) \ - ((void *) Tcl_AttemptMemRealloc((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 5c33308..caa5db7 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -178,7 +178,7 @@ typedef struct ByteArray { } 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 71dc45d..ca26b7f 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -1044,11 +1044,11 @@ Tcl_InitMemory( *---------------------------------------------------------------------- */ -char * +void * Tcl_MemAlloc( - unsigned int size) + size_t size) { - char *result; + void *result; result = TclpAlloc(size); @@ -1068,15 +1068,15 @@ Tcl_MemAlloc( 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); @@ -1096,25 +1096,25 @@ Tcl_DbCkalloc( *---------------------------------------------------------------------- */ -char * +void * Tcl_AttemptMemAlloc( - unsigned int size) + 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; } @@ -1129,10 +1129,10 @@ Tcl_AttemptDbCkalloc( *---------------------------------------------------------------------- */ -char * +void * Tcl_MemRealloc( - char *ptr, - unsigned int size) + void *ptr, + size_t size) { char *result; @@ -1144,16 +1144,16 @@ Tcl_MemRealloc( 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); @@ -1173,27 +1173,27 @@ Tcl_DbCkrealloc( *---------------------------------------------------------------------- */ -char * +void * Tcl_AttemptMemRealloc( - char *ptr, - unsigned int size) + 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; } @@ -1211,14 +1211,14 @@ Tcl_AttemptDbCkrealloc( void Tcl_MemFree( - char *ptr) + 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 cf75bb6..fc3cf96 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_MemAlloc(unsigned int size); +TCLAPI void * Tcl_MemAlloc(size_t size); /* 4 */ -TCLAPI void Tcl_MemFree(char *ptr); +TCLAPI void Tcl_MemFree(void *ptr); /* 5 */ -TCLAPI char * Tcl_MemRealloc(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 */ @@ -1201,14 +1201,14 @@ TCLAPI void Tcl_UntraceCommand(Tcl_Interp *interp, Tcl_CommandTraceProc *proc, ClientData clientData); /* 428 */ -TCLAPI char * Tcl_AttemptMemAlloc(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_AttemptMemRealloc(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); @@ -1782,12 +1782,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_MemAlloc) (unsigned int size); /* 3 */ - void (*tcl_MemFree) (char *ptr); /* 4 */ - char * (*tcl_MemRealloc) (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 */ @@ -2231,10 +2231,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_AttemptMemAlloc) (unsigned int size); /* 428 */ - char * (*tcl_AttemptDbCkalloc) (unsigned int size, const char *file, int line); /* 429 */ - char * (*tcl_AttemptMemRealloc) (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 */ diff --git a/generic/tclIO.c b/generic/tclIO.c index 0568d77..24e7823 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 cb0282a..85d9a46 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 8c46e55..57040a9 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 eeb685a..d6b1320 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4103,7 +4103,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); \ @@ -4553,9 +4553,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 /* @@ -4761,8 +4761,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 diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index 65b1888..8db3831 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -187,13 +187,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 */ @@ -203,7 +203,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 */ @@ -654,19 +654,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/tclObj.c b/generic/tclObj.c index 74cb29e..0bbb08d 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); } diff --git a/generic/tclTest.c b/generic/tclTest.c index 9b958dd..d69e04c 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); } /* @@ -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/tclThreadAlloc.c b/generic/tclThreadAlloc.c index e4261d6..09826cb 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/generic/tclThreadTest.c b/generic/tclThreadTest.c index c1828bb..3a006db 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -62,7 +62,7 @@ static ThreadSpecificData *threadList = NULL; */ typedef struct ThreadCtrl { - const char *script; /* The Tcl command this thread should + char *script; /* The Tcl command this thread should * execute */ int flags; /* Initial value of the "flags" field in the * ThreadSpecificData structure for the new @@ -122,7 +122,7 @@ TCL_DECLARE_MUTEX(threadMutex) static int ThreadObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int ThreadCreate(Tcl_Interp *interp, const char *script, +static int ThreadCreate(Tcl_Interp *interp, char *script, int joinable); static int ThreadList(Tcl_Interp *interp); static int ThreadSend(Tcl_Interp *interp, Tcl_ThreadId id, @@ -276,7 +276,7 @@ ThreadObjCmd( return ThreadCancel(interp, (Tcl_ThreadId) (size_t) id, result, flags); } case THREAD_CREATE: { - const char *script; + char *script; int joinable, len; if (objc == 2) { @@ -496,7 +496,7 @@ ThreadObjCmd( static int ThreadCreate( Tcl_Interp *interp, /* Current interpreter. */ - const char *script, /* Script to execute */ + char *script, /* Script to execute */ int joinable) /* Flag, joinable thread or not */ { ThreadCtrl ctrl; 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; -- cgit v0.12