summaryrefslogtreecommitdiffstats
path: root/generic/tclObj.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclObj.c')
-rw-r--r--generic/tclObj.c86
1 files changed, 58 insertions, 28 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 487ea26..3c22dc7 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -169,7 +169,7 @@ static __thread PendingObjData pendingObjData;
static Tcl_ThreadDataKey pendingObjDataKey;
#define ObjInitDeletionContext(contextPtr) \
PendingObjData *const contextPtr = \
- Tcl_GetThreadData(&pendingObjDataKey, sizeof(PendingObjData))
+ (PendingObjData *)Tcl_GetThreadData(&pendingObjDataKey, sizeof(PendingObjData))
#endif
/*
@@ -178,7 +178,7 @@ static Tcl_ThreadDataKey pendingObjDataKey;
#define PACK_BIGNUM(bignum, objPtr) \
if ((bignum).used > 0x7fff) { \
- mp_int *temp = (void *) Tcl_Alloc(sizeof(mp_int)); \
+ mp_int *temp = (mp_int *) Tcl_Alloc(sizeof(mp_int)); \
*temp = bignum; \
(objPtr)->internalRep.twoPtrValue.ptr1 = temp; \
(objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(-1); \
@@ -498,7 +498,7 @@ TclGetContLineTable(void)
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
if (!tsdPtr->lineCLPtr) {
- tsdPtr->lineCLPtr = Tcl_Alloc(sizeof(Tcl_HashTable));
+ tsdPtr->lineCLPtr = (Tcl_HashTable *)Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(tsdPtr->lineCLPtr, TCL_ONE_WORD_KEYS);
Tcl_CreateThreadExitHandler(TclThreadFinalizeContLines,NULL);
}
@@ -533,7 +533,7 @@ TclContinuationsEnter(
ThreadSpecificData *tsdPtr = TclGetContLineTable();
Tcl_HashEntry *hPtr =
Tcl_CreateHashEntry(tsdPtr->lineCLPtr, objPtr, &newEntry);
- ContLineLoc *clLocPtr = Tcl_Alloc(sizeof(ContLineLoc) + num*sizeof(int));
+ ContLineLoc *clLocPtr = (ContLineLoc *)Tcl_Alloc(sizeof(ContLineLoc) + num*sizeof(int));
if (!newEntry) {
/*
@@ -691,7 +691,7 @@ TclContinuationsCopy(
Tcl_FindHashEntry(tsdPtr->lineCLPtr, originObjPtr);
if (hPtr) {
- ContLineLoc *clLocPtr = Tcl_GetHashValue(hPtr);
+ ContLineLoc *clLocPtr = (ContLineLoc *)Tcl_GetHashValue(hPtr);
TclContinuationsEnter(objPtr, clLocPtr->num, clLocPtr->loc);
}
@@ -727,7 +727,7 @@ TclContinuationsGet(
if (!hPtr) {
return NULL;
}
- return Tcl_GetHashValue(hPtr);
+ return (ContLineLoc *)Tcl_GetHashValue(hPtr);
}
/*
@@ -750,7 +750,7 @@ TclContinuationsGet(
static void
TclThreadFinalizeContLines(
- ClientData clientData)
+ ClientData dummy)
{
/*
* Release the hashtable tracking invisible continuation lines.
@@ -759,6 +759,7 @@ TclThreadFinalizeContLines(
ThreadSpecificData *tsdPtr = TclGetContLineTable();
Tcl_HashEntry *hPtr;
Tcl_HashSearch hSearch;
+ (void)dummy;
for (hPtr = Tcl_FirstHashEntry(tsdPtr->lineCLPtr, &hSearch);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&hSearch)) {
@@ -855,7 +856,7 @@ Tcl_AppendAllObjTypes(
for (hPtr = Tcl_FirstHashEntry(&typeTable, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewStringObj(Tcl_GetHashKey(&typeTable, hPtr), -1));
+ Tcl_NewStringObj((char *)Tcl_GetHashKey(&typeTable, hPtr), -1));
}
Tcl_MutexUnlock(&tableMutex);
return TCL_OK;
@@ -888,7 +889,7 @@ Tcl_GetObjType(
Tcl_MutexLock(&tableMutex);
hPtr = Tcl_FindHashEntry(&typeTable, typeName);
if (hPtr != NULL) {
- typePtr = Tcl_GetHashValue(hPtr);
+ typePtr = (const Tcl_ObjType *)Tcl_GetHashValue(hPtr);
}
Tcl_MutexUnlock(&tableMutex);
return typePtr;
@@ -988,6 +989,8 @@ TclDbDumpActiveObjects(
}
}
}
+#else
+ (void)outFile;
#endif
}
@@ -1036,7 +1039,7 @@ TclDbInitNewObj(
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
if (tsdPtr->objThreadMap == NULL) {
- tsdPtr->objThreadMap = Tcl_Alloc(sizeof(Tcl_HashTable));
+ tsdPtr->objThreadMap = (Tcl_HashTable *)Tcl_Alloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(tsdPtr->objThreadMap, TCL_ONE_WORD_KEYS);
}
tablePtr = tsdPtr->objThreadMap;
@@ -1049,7 +1052,7 @@ TclDbInitNewObj(
* Record the debugging information.
*/
- objData = Tcl_Alloc(sizeof(ObjData));
+ objData = (ObjData *)Tcl_Alloc(sizeof(ObjData));
objData->objPtr = objPtr;
objData->file = file;
objData->line = line;
@@ -1164,6 +1167,9 @@ Tcl_DbNewObj(
int line) /* Line number in the source file; used for
* debugging. */
{
+ (void)file;
+ (void)line;
+
return Tcl_NewObj();
}
#endif /* TCL_MEM_DEBUG */
@@ -1208,7 +1214,7 @@ TclAllocateFreeObjects(void)
* Purify apparently can't figure that out, and fires a false alarm.
*/
- basePtr = Tcl_Alloc(bytesToAlloc);
+ basePtr = (char *)Tcl_Alloc(bytesToAlloc);
prevPtr = NULL;
objPtr = (Tcl_Obj *) basePtr;
@@ -1732,7 +1738,7 @@ Tcl_InitStringRep(
/* Allocate only as empty - extend later if bytes copied */
objPtr->length = 0;
if (numBytes) {
- objPtr->bytes = Tcl_AttemptAlloc(numBytes + 1);
+ objPtr->bytes = (char *)Tcl_AttemptAlloc(numBytes + 1);
if (objPtr->bytes == NULL) {
return NULL;
}
@@ -1746,7 +1752,7 @@ Tcl_InitStringRep(
}
} else {
/* objPtr->bytes != NULL bytes == NULL - Truncate */
- objPtr->bytes = Tcl_Realloc(objPtr->bytes, numBytes + 1);
+ objPtr->bytes = (char *)Tcl_Realloc(objPtr->bytes, numBytes + 1);
objPtr->length = numBytes;
}
@@ -2235,6 +2241,9 @@ Tcl_DbNewDoubleObj(
int line) /* Line number in the source file; used for
* debugging. */
{
+ (void)file;
+ (void)line;
+
return Tcl_NewDoubleObj(dblValue);
}
#endif /* TCL_MEM_DEBUG */
@@ -2567,6 +2576,7 @@ Tcl_GetLongFromObj(
* values in the unsigned long range will fit in a long.
*/
+ {
mp_int big;
unsigned long scratch, value = 0;
unsigned char *bytes = (unsigned char *) &scratch;
@@ -2589,6 +2599,7 @@ Tcl_GetLongFromObj(
}
}
}
+ }
#ifndef TCL_WIDE_INT_IS_LONG
tooLarge:
#endif
@@ -2722,6 +2733,9 @@ Tcl_DbNewWideIntObj(
int line) /* Line number in the source file; used for
* debugging. */
{
+ (void)file;
+ (void)line;
+
return Tcl_NewWideIntObj(wideValue);
}
#endif /* TCL_MEM_DEBUG */
@@ -3102,6 +3116,9 @@ Tcl_DbNewBignumObj(
const char *file,
int line)
{
+ (void)file;
+ (void)line;
+
return Tcl_NewBignumObj(bignumValue);
}
#endif
@@ -3386,7 +3403,8 @@ TclGetNumberFromObj(
}
if (objPtr->typePtr == &tclBignumType) {
static Tcl_ThreadDataKey bignumKey;
- mp_int *bigPtr = Tcl_GetThreadData(&bignumKey, sizeof(mp_int));
+ mp_int *bigPtr = (mp_int *)Tcl_GetThreadData(&bignumKey,
+ sizeof(mp_int));
TclUnpackBignum(objPtr, *bigPtr);
*typePtr = TCL_NUMBER_BIG;
@@ -3522,6 +3540,9 @@ Tcl_DbIncrRefCount(
}
}
# endif /* TCL_THREADS */
+#else
+ (void)file;
+ (void)line;
#endif /* TCL_MEM_DEBUG */
++(objPtr)->refCount;
}
@@ -3585,6 +3606,9 @@ Tcl_DbDecrRefCount(
}
}
# endif /* TCL_THREADS */
+#else
+ (void)file;
+ (void)line;
#endif /* TCL_MEM_DEBUG */
if (objPtr->refCount-- <= 1) {
@@ -3650,6 +3674,9 @@ Tcl_DbIsShared(
}
}
# endif /* TCL_THREADS */
+#else
+ (void)file;
+ (void)line;
#endif /* TCL_MEM_DEBUG */
#ifdef TCL_COMPILE_STATS
@@ -3713,11 +3740,12 @@ Tcl_InitObjHashTable(
static Tcl_HashEntry *
AllocObjEntry(
- Tcl_HashTable *tablePtr, /* Hash table. */
+ Tcl_HashTable *dummy, /* Hash table. */
void *keyPtr) /* Key to store in the hash table entry. */
{
Tcl_Obj *objPtr = (Tcl_Obj *)keyPtr;
- Tcl_HashEntry *hPtr = Tcl_Alloc(sizeof(Tcl_HashEntry));
+ Tcl_HashEntry *hPtr = (Tcl_HashEntry *)Tcl_Alloc(sizeof(Tcl_HashEntry));
+ (void)dummy;
hPtr->key.objPtr = objPtr;
Tcl_IncrRefCount(objPtr);
@@ -3748,8 +3776,8 @@ TclCompareObjKeys(
void *keyPtr, /* New key to compare. */
Tcl_HashEntry *hPtr) /* Existing key to compare. */
{
- Tcl_Obj *objPtr1 = (Tcl_Obj *) keyPtr;
- Tcl_Obj *objPtr2 = (Tcl_Obj *) hPtr->key.oneWordValue;
+ Tcl_Obj *objPtr1 = (Tcl_Obj *)keyPtr;
+ Tcl_Obj *objPtr2 = (Tcl_Obj *)hPtr->key.oneWordValue;
const char *p1, *p2;
size_t l1, l2;
@@ -3834,13 +3862,14 @@ TclFreeObjEntry(
TCL_HASH_TYPE
TclHashObjKey(
- Tcl_HashTable *tablePtr, /* Hash table. */
+ Tcl_HashTable *dummy, /* Hash table. */
void *keyPtr) /* Key from which to compute hash value. */
{
Tcl_Obj *objPtr = (Tcl_Obj *)keyPtr;
const char *string = TclGetString(objPtr);
size_t length = objPtr->length;
TCL_HASH_TYPE result = 0;
+ (void)dummy;
/*
* I tried a zillion different hash functions and asked many other people
@@ -3935,7 +3964,7 @@ Tcl_GetCommandFromObj(
* to discard the old rep and create a new one.
*/
- resPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ resPtr = (ResolvedCmdName *)objPtr->internalRep.twoPtrValue.ptr1;
if (objPtr->typePtr == &tclCmdNameType) {
Command *cmdPtr = resPtr->cmdPtr;
@@ -3963,7 +3992,7 @@ Tcl_GetCommandFromObj(
if (tclCmdNameType.setFromAnyProc(interp, objPtr) != TCL_OK) {
return NULL;
}
- resPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ resPtr = (ResolvedCmdName *)objPtr->internalRep.twoPtrValue.ptr1;
return (Tcl_Command) (resPtr ? resPtr->cmdPtr : NULL);
}
@@ -4001,7 +4030,7 @@ SetCmdNameObj(
if (resPtr) {
fillPtr = resPtr;
} else {
- fillPtr = Tcl_Alloc(sizeof(ResolvedCmdName));
+ fillPtr = (ResolvedCmdName *)Tcl_Alloc(sizeof(ResolvedCmdName));
fillPtr->refCount = 1;
}
@@ -4052,7 +4081,7 @@ TclSetCmdNameObj(
ResolvedCmdName *resPtr;
if (objPtr->typePtr == &tclCmdNameType) {
- resPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ resPtr = (ResolvedCmdName *)objPtr->internalRep.twoPtrValue.ptr1;
if (resPtr != NULL && resPtr->cmdPtr == cmdPtr) {
return;
}
@@ -4087,7 +4116,7 @@ FreeCmdNameInternalRep(
Tcl_Obj *objPtr) /* CmdName object with internal
* representation to free. */
{
- ResolvedCmdName *resPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ ResolvedCmdName *resPtr = (ResolvedCmdName *)objPtr->internalRep.twoPtrValue.ptr1;
/*
* Decrement the reference count of the ResolvedCmdName structure. If
@@ -4134,7 +4163,7 @@ DupCmdNameInternalRep(
Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
Tcl_Obj *copyPtr) /* Object with internal rep to set. */
{
- ResolvedCmdName *resPtr = srcPtr->internalRep.twoPtrValue.ptr1;
+ ResolvedCmdName *resPtr = (ResolvedCmdName *)srcPtr->internalRep.twoPtrValue.ptr1;
copyPtr->internalRep.twoPtrValue.ptr1 = resPtr;
copyPtr->internalRep.twoPtrValue.ptr2 = NULL;
@@ -4197,7 +4226,7 @@ SetCmdNameFromAny(
return TCL_ERROR;
}
- resPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ resPtr = (ResolvedCmdName *)objPtr->internalRep.twoPtrValue.ptr1;
if ((objPtr->typePtr == &tclCmdNameType) && (resPtr->refCount == 1)) {
/*
* Re-use existing ResolvedCmdName struct when possible.
@@ -4235,12 +4264,13 @@ SetCmdNameFromAny(
int
Tcl_RepresentationCmd(
- ClientData clientData,
+ ClientData dummy,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Tcl_Obj *descObj;
+ (void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "value");