summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornijtmans <nijtmans>2009-02-10 23:08:56 (GMT)
committernijtmans <nijtmans>2009-02-10 23:08:56 (GMT)
commitbfcd65034eb86288bb554aef03df7c98101c3089 (patch)
treea407af9f40cff9d5a67f7ecf3a88b22578e0f842
parentb07274fff759a29a06f8c988c019d09d583fe435 (diff)
downloadtcl-bfcd65034eb86288bb554aef03df7c98101c3089.zip
tcl-bfcd65034eb86288bb554aef03df7c98101c3089.tar.gz
tcl-bfcd65034eb86288bb554aef03df7c98101c3089.tar.bz2
- eliminate some unnessary type casts
- some internal const decorations - spacing
-rw-r--r--ChangeLog20
-rw-r--r--generic/tclScan.c20
-rw-r--r--generic/tclStringObj.c6
-rw-r--r--generic/tclStubInit.c50
-rw-r--r--generic/tclTest.c38
-rw-r--r--generic/tclTestObj.c20
-rw-r--r--generic/tclTestProcBodyObj.c4
-rw-r--r--generic/tclThread.c26
-rw-r--r--generic/tclThreadTest.c19
-rw-r--r--generic/tclTimer.c6
-rw-r--r--generic/tclTrace.c35
-rw-r--r--generic/tclUtil.c11
-rw-r--r--generic/tclVar.c45
13 files changed, 133 insertions, 167 deletions
diff --git a/ChangeLog b/ChangeLog
index 6454f89..556116a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,8 @@
-2009-02-05 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tclEncoding.c - eliminate some unnessary type casts
- * generic/tclEvent.c - some internal const decorations
- * generic/tclExecute.c - spacing
+2009-02-10 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tclEncoding.c Eliminate some unnessary type casts
+ * generic/tclEvent.c some internal const decorations
+ * generic/tclExecute.c spacing
* generic/tclIndexObj.c
* generic/tclInterp.c
* generic/tclIO.c
@@ -17,6 +18,17 @@
* generic/tclPkg.c
* generic/tclProc.c
* generic/tclRegexp.c
+ * generic/tclScan.c
+ * generic/tclStringObj.c
+ * generic/tclTest.c
+ * generic/tclTestProcBodyObj.c
+ * generic/tclThread.c
+ * generic/tclThreadTest.c
+ * generic/tclTimer.c
+ * generic/tclTrace.c
+ * generic/tclUtil.c
+ * generic/tclVar.c
+ * generic/tclStubInit.c (regenerated)
2009-02-10 Jan Nijtmans <nijtmans@users.sf.net>
diff --git a/generic/tclScan.c b/generic/tclScan.c
index d05cb8f..07bbedd 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclScan.c,v 1.30 2008/12/10 18:21:47 ferrieux Exp $
+ * RCS: @(#) $Id: tclScan.c,v 1.31 2009/02/10 23:09:04 nijtmans Exp $
*/
#include "tclInt.h"
@@ -45,10 +45,10 @@ typedef struct CharSet {
* Declarations for functions used only in this file.
*/
-static char * BuildCharSet(CharSet *cset, char *format);
+static const char * BuildCharSet(CharSet *cset, const char *format);
static int CharInSet(CharSet *cset, int ch);
static void ReleaseCharSet(CharSet *cset);
-static int ValidateFormat(Tcl_Interp *interp, char *format,
+static int ValidateFormat(Tcl_Interp *interp, const char *format,
int numVars, int *totalVars);
/*
@@ -69,14 +69,14 @@ static int ValidateFormat(Tcl_Interp *interp, char *format,
*----------------------------------------------------------------------
*/
-static char *
+static const char *
BuildCharSet(
CharSet *cset,
- char *format) /* Points to first char of set. */
+ const char *format) /* Points to first char of set. */
{
Tcl_UniChar ch, start;
int offset, nranges;
- char *end;
+ const char *end;
memset(cset, 0, sizeof(CharSet));
@@ -252,7 +252,7 @@ ReleaseCharSet(
static int
ValidateFormat(
Tcl_Interp *interp, /* Current interpreter. */
- char *format, /* The format string. */
+ const char *format, /* The format string. */
int numVars, /* The number of variables passed to the scan
* command. */
int *totalSubs) /* The number of variables that will be
@@ -343,7 +343,7 @@ ValidateFormat(
*/
if ((ch < 0x80) && isdigit(UCHAR(ch))) { /* INTL: "C" locale. */
- value = strtoul(format-1, &format, 10); /* INTL: "C" locale. */
+ value = strtoul(format-1, (char **) &format, 10); /* INTL: "C" locale. */
flags |= SCAN_WIDTH;
format += Tcl_UtfToUniChar(format, &ch);
}
@@ -559,7 +559,7 @@ Tcl_ScanObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- char *format;
+ const char *format;
int numVars, nconversions, totalVars = -1;
int objIndex, offset, i, result, code;
long value;
@@ -676,7 +676,7 @@ Tcl_ScanObjCmd(
*/
if ((ch < 0x80) && isdigit(UCHAR(ch))) { /* INTL: "C" locale. */
- width = (int) strtoul(format-1, &format, 10);/* INTL: "C" locale. */
+ width = (int) strtoul(format-1, (char **) &format, 10);/* INTL: "C" locale. */
format += Tcl_UtfToUniChar(format, &ch);
} else {
width = 0;
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 2d2622c..b2dd292 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -33,7 +33,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclStringObj.c,v 1.94 2009/02/10 21:04:06 dgp Exp $ */
+ * RCS: @(#) $Id: tclStringObj.c,v 1.95 2009/02/10 23:09:05 nijtmans Exp $ */
#include "tclInt.h"
#include "tommath.h"
@@ -668,7 +668,7 @@ Tcl_GetRange(
}
if (objPtr->bytes && (stringPtr->numChars == objPtr->length)) {
- char *str = TclGetString(objPtr);
+ const char *str = TclGetString(objPtr);
/*
* All of the characters in the Utf string are 1 byte chars, so we
@@ -1240,7 +1240,7 @@ Tcl_AppendObjToObj(
{
String *stringPtr;
int length, numChars, allOneByteChars;
- char *bytes;
+ const char *bytes;
/*
* Handle append of one bytearray object to another as a special case.
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 818abf1..f33086d 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclStubInit.c,v 1.178 2008/12/27 00:04:17 dkf Exp $
+ * RCS: @(#) $Id: tclStubInit.c,v 1.179 2009/02/10 23:09:08 nijtmans Exp $
*/
#include "tclInt.h"
@@ -50,27 +50,11 @@ static const TclIntStubs tclIntStubs = {
NULL, /* 2 */
TclAllocateFreeObjects, /* 3 */
NULL, /* 4 */
-#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
- TclCleanupChildren, /* 5 */
-#endif /* UNIX */
-#ifdef __WIN32__ /* WIN */
- TclCleanupChildren, /* 5 */
-#endif /* WIN */
-#ifdef MAC_OSX_TCL /* MACOSX */
TclCleanupChildren, /* 5 */
-#endif /* MACOSX */
TclCleanupCommand, /* 6 */
TclCopyAndCollapse, /* 7 */
TclCopyChannel, /* 8 */
-#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
- TclCreatePipeline, /* 9 */
-#endif /* UNIX */
-#ifdef __WIN32__ /* WIN */
TclCreatePipeline, /* 9 */
-#endif /* WIN */
-#ifdef MAC_OSX_TCL /* MACOSX */
- TclCreatePipeline, /* 9 */
-#endif /* MACOSX */
TclCreateProc, /* 10 */
TclDeleteCompiledLocalVars, /* 11 */
TclDeleteVars, /* 12 */
@@ -165,15 +149,7 @@ static const TclIntStubs tclIntStubs = {
TclSetPreInitScript, /* 101 */
TclSetupEnv, /* 102 */
TclSockGetPort, /* 103 */
-#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
- TclSockMinimumBuffers, /* 104 */
-#endif /* UNIX */
-#ifdef __WIN32__ /* WIN */
- TclSockMinimumBuffers, /* 104 */
-#endif /* WIN */
-#ifdef MAC_OSX_TCL /* MACOSX */
TclSockMinimumBuffers, /* 104 */
-#endif /* MACOSX */
NULL, /* 105 */
NULL, /* 106 */
NULL, /* 107 */
@@ -604,15 +580,7 @@ static const TclStubs tclStubs = {
Tcl_DeleteHashEntry, /* 108 */
Tcl_DeleteHashTable, /* 109 */
Tcl_DeleteInterp, /* 110 */
-#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
- Tcl_DetachPids, /* 111 */
-#endif /* UNIX */
-#ifdef __WIN32__ /* WIN */
- Tcl_DetachPids, /* 111 */
-#endif /* WIN */
-#ifdef MAC_OSX_TCL /* MACOSX */
Tcl_DetachPids, /* 111 */
-#endif /* MACOSX */
Tcl_DeleteTimerHandler, /* 112 */
Tcl_DeleteTrace, /* 113 */
Tcl_DontCallWhenDeleted, /* 114 */
@@ -706,15 +674,7 @@ static const TclStubs tclStubs = {
Tcl_NotifyChannel, /* 194 */
Tcl_ObjGetVar2, /* 195 */
Tcl_ObjSetVar2, /* 196 */
-#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
- Tcl_OpenCommandChannel, /* 197 */
-#endif /* UNIX */
-#ifdef __WIN32__ /* WIN */
Tcl_OpenCommandChannel, /* 197 */
-#endif /* WIN */
-#ifdef MAC_OSX_TCL /* MACOSX */
- Tcl_OpenCommandChannel, /* 197 */
-#endif /* MACOSX */
Tcl_OpenFileChannel, /* 198 */
Tcl_OpenTcpClient, /* 199 */
Tcl_OpenTcpServer, /* 200 */
@@ -724,15 +684,7 @@ static const TclStubs tclStubs = {
Tcl_PosixError, /* 204 */
Tcl_QueueEvent, /* 205 */
Tcl_Read, /* 206 */
-#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
- Tcl_ReapDetachedProcs, /* 207 */
-#endif /* UNIX */
-#ifdef __WIN32__ /* WIN */
- Tcl_ReapDetachedProcs, /* 207 */
-#endif /* WIN */
-#ifdef MAC_OSX_TCL /* MACOSX */
Tcl_ReapDetachedProcs, /* 207 */
-#endif /* MACOSX */
Tcl_RecordAndEval, /* 208 */
Tcl_RecordAndEvalObj, /* 209 */
Tcl_RegisterChannel, /* 210 */
diff --git a/generic/tclTest.c b/generic/tclTest.c
index ebcdb97..da00e84 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclTest.c,v 1.135 2009/01/09 11:21:46 dkf Exp $
+ * RCS: @(#) $Id: tclTest.c,v 1.136 2009/02/10 23:09:08 nijtmans Exp $
*/
#define TCL_TEST
@@ -305,7 +305,7 @@ static int TestregexpObjCmd(ClientData dummy,
static int TestreturnObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-static void TestregexpXflags(char *string,
+static void TestregexpXflags(const char *string,
int length, int *cflagsPtr, int *eflagsPtr);
static int TestsaveresultCmd(ClientData dummy,
Tcl_Interp *interp, int objc,
@@ -1719,7 +1719,7 @@ TestencodingObjCmd(
{
Tcl_Encoding encoding;
int index, length;
- char *string;
+ const char *string;
TclEncoding *encodingPtr;
static const char *const optionStrings[] = {
"create", "delete", NULL
@@ -1876,11 +1876,11 @@ TestevalexObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
int length, flags;
- char *script;
+ const char *script;
flags = 0;
if (objc == 3) {
- char *global = Tcl_GetStringFromObj(objv[2], &length);
+ const char *global = Tcl_GetStringFromObj(objv[2], &length);
if (strcmp(global, "global") != 0) {
Tcl_AppendResult(interp, "bad value \"", global,
"\": must be global", NULL);
@@ -2104,9 +2104,9 @@ TesteventDeleteProc(
* to remove */
{
TestEvent *ev; /* Event to examine */
- char *evNameStr;
+ const char *evNameStr;
Tcl_Obj *targetName; /* Name of the event(s) to delete */
- char *targetNameStr;
+ const char *targetNameStr;
if (event->proc != TesteventProc) {
return 0;
@@ -3075,7 +3075,7 @@ TestlocaleCmd(
Tcl_Obj *const objv[]) /* The argument objects. */
{
int index;
- char *locale;
+ const char *locale;
static const char *const optionStrings[] = {
"ctype", "numeric", "time", "collate", "monetary",
@@ -3299,7 +3299,7 @@ TestparserObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
{
- char *script;
+ const char *script;
int length, dummy;
Tcl_Parse parse;
@@ -3355,7 +3355,7 @@ TestexprparserObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
{
- char *script;
+ const char *script;
int length, dummy;
Tcl_Parse parse;
@@ -3543,7 +3543,7 @@ TestparsevarnameObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
{
- char *script;
+ const char *script;
int append, length, dummy;
Tcl_Parse parse;
@@ -3611,7 +3611,7 @@ TestregexpObjCmd(
int i, ii, indices, stringLength, match, about;
int hasxflags, cflags, eflags;
Tcl_RegExp regExpr;
- char *string;
+ const char *string;
Tcl_Obj *objPtr;
Tcl_RegExpInfo info;
static const char *const options[] = {
@@ -3634,7 +3634,7 @@ TestregexpObjCmd(
hasxflags = 0;
for (i = 1; i < objc; i++) {
- char *name;
+ const char *name;
int index;
name = Tcl_GetString(objv[i]);
@@ -3719,7 +3719,7 @@ TestregexpObjCmd(
Tcl_SetIntObj(Tcl_GetObjResult(interp), 0);
if (objc > 2 && (cflags&REG_EXPECT) && indices) {
- char *varName;
+ const char *varName;
const char *value;
int start, end;
char resinfo[TCL_INTEGER_SPACE * 2];
@@ -3734,7 +3734,7 @@ TestregexpObjCmd(
return TCL_ERROR;
}
} else if (cflags & TCL_REG_CANMATCH) {
- char *varName;
+ const char *varName;
const char *value;
char resinfo[TCL_INTEGER_SPACE * 2];
@@ -3838,7 +3838,7 @@ TestregexpObjCmd(
static void
TestregexpXflags(
- char *string, /* The string of flags. */
+ const char *string, /* The string of flags. */
int length, /* The length of the string in bytes. */
int *cflagsPtr, /* compile flags word */
int *eflagsPtr) /* exec flags word */
@@ -4368,7 +4368,7 @@ TestfileCmd(
{
int force, i, j, result;
Tcl_Obj *error = NULL;
- char *subcmd;
+ const char *subcmd;
if (argc < 3) {
return TCL_ERROR;
@@ -4448,7 +4448,7 @@ TestgetvarfullnameCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
{
- char *name, *arg;
+ const char *name, *arg;
int flags = 0;
Tcl_Namespace *namespacePtr;
Tcl_CallFrame *framePtr;
@@ -5777,7 +5777,7 @@ TestWrongNumArgsObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
int i, length;
- char *msg;
+ const char *msg;
if (objc < 3) {
/*
diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c
index 680dd18..e0dddce 100644
--- a/generic/tclTestObj.c
+++ b/generic/tclTestObj.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclTestObj.c,v 1.28 2009/01/09 11:21:46 dkf Exp $
+ * RCS: @(#) $Id: tclTestObj.c,v 1.29 2009/02/10 23:09:07 nijtmans Exp $
*/
#include "tclInt.h"
@@ -34,7 +34,7 @@ static Tcl_Obj *varPtr[NUMBER_OF_OBJECT_VARS];
static int CheckIfVarUnset(Tcl_Interp *interp, int varIndex);
static int GetVariableIndex(Tcl_Interp *interp,
- char *string, int *indexPtr);
+ const char *string, int *indexPtr);
static void SetVarToObj(int varIndex, Tcl_Obj *objPtr);
int TclObjTest_Init(Tcl_Interp *interp);
static int TestbignumobjCmd(ClientData dummy, Tcl_Interp *interp,
@@ -136,7 +136,7 @@ TestbignumobjCmd(
BIGNUM_SET, BIGNUM_GET, BIGNUM_MULT10, BIGNUM_DIV10
};
int index, varIndex;
- char *string;
+ const char *string;
mp_int bignumValue, newValue;
if (objc < 3) {
@@ -282,7 +282,7 @@ TestbooleanobjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
int varIndex, boolValue;
- char *index, *subCmd;
+ const char *index, *subCmd;
if (objc < 3) {
wrongNumArgs:
@@ -380,7 +380,7 @@ TestdoubleobjCmd(
{
int varIndex;
double doubleValue;
- char *index, *subCmd, *string;
+ const char *index, *subCmd, *string;
if (objc < 3) {
wrongNumArgs:
@@ -599,7 +599,7 @@ TestintobjCmd(
{
int intValue, varIndex, i;
long longValue;
- char *index, *subCmd, *string;
+ const char *index, *subCmd, *string;
if (objc < 3) {
wrongNumArgs:
@@ -799,7 +799,7 @@ TestobjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
int varIndex, destIndex, i;
- char *index, *subCmd, *string;
+ const char *index, *subCmd, *string;
const Tcl_ObjType *targetType;
if (objc < 2) {
@@ -827,7 +827,7 @@ TestobjCmd(
SetVarToObj(destIndex, varPtr[varIndex]);
Tcl_SetObjResult(interp, varPtr[destIndex]);
} else if (strcmp(subCmd, "convert") == 0) {
- char *typeName;
+ const char *typeName;
if (objc != 4) {
goto wrongNumArgs;
@@ -991,7 +991,7 @@ TeststringobjCmd(
{
int varIndex, option, i, length;
#define MAX_STRINGS 11
- char *index, *string, *strings[MAX_STRINGS+1];
+ const char *index, *string, *strings[MAX_STRINGS+1];
TestString *strPtr;
static const char *const options[] = {
"append", "appendstrings", "get", "get2", "length", "length2",
@@ -1220,7 +1220,7 @@ SetVarToObj(
static int
GetVariableIndex(
Tcl_Interp *interp, /* Interpreter for error reporting. */
- char *string, /* String containing a variable index
+ const char *string, /* String containing a variable index
* specified as a nonnegative number less than
* NUMBER_OF_OBJECT_VARS. */
int *indexPtr) /* Place to store converted result. */
diff --git a/generic/tclTestProcBodyObj.c b/generic/tclTestProcBodyObj.c
index 234b267..b961e3c 100644
--- a/generic/tclTestProcBodyObj.c
+++ b/generic/tclTestProcBodyObj.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclTestProcBodyObj.c,v 1.8 2009/01/09 11:21:46 dkf Exp $
+ * RCS: @(#) $Id: tclTestProcBodyObj.c,v 1.9 2009/02/10 23:08:56 nijtmans Exp $
*/
#include "tclInt.h"
@@ -229,7 +229,7 @@ ProcBodyTestProcObjCmd(
int objc, /* argument count */
Tcl_Obj *const objv[]) /* arguments */
{
- char *fullName;
+ const char *fullName;
Tcl_Command procCmd;
Command *cmdPtr;
Proc *procPtr = NULL;
diff --git a/generic/tclThread.c b/generic/tclThread.c
index 7d5d4dd..a538316 100644
--- a/generic/tclThread.c
+++ b/generic/tclThread.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclThread.c,v 1.22 2009/01/09 11:21:46 dkf Exp $
+ * RCS: @(#) $Id: tclThread.c,v 1.23 2009/02/10 23:09:06 nijtmans Exp $
*/
#include "tclInt.h"
@@ -27,7 +27,7 @@
typedef struct {
int num; /* Number of objects remembered */
int max; /* Max size of the array */
- char **list; /* List of pointers */
+ void **list; /* List of pointers */
} SyncObjRecord;
static SyncObjRecord keyRecord = {0, 0, NULL};
@@ -38,8 +38,8 @@ static SyncObjRecord condRecord = {0, 0, NULL};
* Prototypes of functions used only in this file.
*/
-static void ForgetSyncObject(char *objPtr, SyncObjRecord *recPtr);
-static void RememberSyncObject(char *objPtr,
+static void ForgetSyncObject(void *objPtr, SyncObjRecord *recPtr);
+static void RememberSyncObject(void *objPtr,
SyncObjRecord *recPtr);
/*
@@ -97,7 +97,7 @@ Tcl_GetThreadData(
result = ckalloc((size_t)size);
memset(result, 0, (size_t)size);
*keyPtr = result;
- RememberSyncObject((char *) keyPtr, &keyRecord);
+ RememberSyncObject(keyPtr, &keyRecord);
} else {
result = *keyPtr;
}
@@ -156,10 +156,10 @@ TclThreadDataKeyGet(
static void
RememberSyncObject(
- char *objPtr, /* Pointer to sync object */
+ void *objPtr, /* Pointer to sync object */
SyncObjRecord *recPtr) /* Record of sync objects */
{
- char **newList;
+ void **newList;
int i, j;
@@ -181,7 +181,7 @@ RememberSyncObject(
if (recPtr->num >= recPtr->max) {
recPtr->max += 8;
- newList = (char **) ckalloc(recPtr->max * sizeof(char *));
+ newList = (void **) ckalloc(recPtr->max * sizeof(void *));
for (i=0,j=0 ; i<recPtr->num ; i++) {
if (recPtr->list[i] != NULL) {
newList[j++] = recPtr->list[i];
@@ -217,7 +217,7 @@ RememberSyncObject(
static void
ForgetSyncObject(
- char *objPtr, /* Pointer to sync object */
+ void *objPtr, /* Pointer to sync object */
SyncObjRecord *recPtr) /* Record of sync objects */
{
int i;
@@ -251,7 +251,7 @@ void
TclRememberMutex(
Tcl_Mutex *mutexPtr)
{
- RememberSyncObject((char *)mutexPtr, &mutexRecord);
+ RememberSyncObject(mutexPtr, &mutexRecord);
}
/*
@@ -279,7 +279,7 @@ Tcl_MutexFinalize(
TclpFinalizeMutex(mutexPtr);
#endif
TclpMasterLock();
- ForgetSyncObject((char *) mutexPtr, &mutexRecord);
+ ForgetSyncObject(mutexPtr, &mutexRecord);
TclpMasterUnlock();
}
@@ -304,7 +304,7 @@ void
TclRememberCondition(
Tcl_Condition *condPtr)
{
- RememberSyncObject((char *) condPtr, &condRecord);
+ RememberSyncObject(condPtr, &condRecord);
}
/*
@@ -332,7 +332,7 @@ Tcl_ConditionFinalize(
TclpFinalizeCondition(condPtr);
#endif
TclpMasterLock();
- ForgetSyncObject((char *) condPtr, &condRecord);
+ ForgetSyncObject(condPtr, &condRecord);
TclpMasterUnlock();
}
diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c
index 7ee5704..3b7c506 100644
--- a/generic/tclThreadTest.c
+++ b/generic/tclThreadTest.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclThreadTest.c,v 1.30 2009/01/09 11:21:46 dkf Exp $
+ * RCS: @(#) $Id: tclThreadTest.c,v 1.31 2009/02/10 23:09:05 nijtmans Exp $
*/
#include "tclInt.h"
@@ -130,9 +130,9 @@ EXTERN int TclCreateThread(Tcl_Interp *interp, const char *script,
int joinable);
EXTERN int TclThreadList(Tcl_Interp *interp);
EXTERN int TclThreadSend(Tcl_Interp *interp, Tcl_ThreadId id,
- char *script, int wait);
+ const char *script, int wait);
EXTERN int TclThreadCancel(Tcl_Interp *interp, Tcl_ThreadId id,
- char *result, int flags);
+ const char *result, int flags);
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
@@ -255,7 +255,7 @@ Tcl_ThreadObjCmd(
switch ((enum options)option) {
case THREAD_CANCEL: {
long id;
- char *result;
+ const char *result;
int flags, arg;
if ((objc < 3) || (objc > 5)) {
@@ -391,7 +391,7 @@ Tcl_ThreadObjCmd(
return TclThreadList(interp);
case THREAD_SEND: {
long id;
- char *script;
+ const char *script;
int wait, arg;
if ((objc != 4) && (objc != 5)) {
@@ -429,7 +429,7 @@ Tcl_ThreadObjCmd(
* Arrange for this proc to handle thread death errors.
*/
- char *proc;
+ const char *proc;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "proc");
@@ -800,7 +800,7 @@ int
TclThreadSend(
Tcl_Interp *interp, /* The current interpreter. */
Tcl_ThreadId id, /* Thread Id of other interpreter. */
- char *script, /* The script to evaluate. */
+ const char *script, /* The script to evaluate. */
int wait) /* If 1, we block for the result. */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
@@ -926,8 +926,7 @@ TclThreadSend(
ckfree(resultPtr->errorInfo);
}
}
- Tcl_SetResult(interp, resultPtr->result, TCL_VOLATILE);
- ckfree(resultPtr->result);
+ Tcl_SetResult(interp, resultPtr->result, TCL_DYNAMIC);
Tcl_ConditionFinalize(&resultPtr->done);
code = resultPtr->code;
@@ -956,7 +955,7 @@ int
TclThreadCancel(
Tcl_Interp *interp, /* The current interpreter. */
Tcl_ThreadId id, /* Thread Id of other interpreter. */
- char *result, /* The result or NULL for default. */
+ const char *result, /* The result or NULL for default. */
int flags) /* Flags for Tcl_CancelEval. */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
diff --git a/generic/tclTimer.c b/generic/tclTimer.c
index b970d50..94a8c16 100644
--- a/generic/tclTimer.c
+++ b/generic/tclTimer.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclTimer.c,v 1.38 2009/01/09 11:21:46 dkf Exp $
+ * RCS: @(#) $Id: tclTimer.c,v 1.39 2009/02/10 23:09:04 nijtmans Exp $
*/
#include "tclInt.h"
@@ -879,7 +879,7 @@ Tcl_AfterObjCmd(
}
case AFTER_CANCEL: {
Tcl_Obj *commandPtr;
- char *command, *tempCommand;
+ const char *command, *tempCommand;
int tempLength;
if (objc < 3) {
@@ -1096,7 +1096,7 @@ GetAfterEvent(
* this interpreter. */
Tcl_Obj *commandPtr)
{
- char *cmdString; /* Textual identifier for after event, such as
+ const char *cmdString; /* Textual identifier for after event, such as
* "after#6". */
AfterInfo *afterPtr;
int id;
diff --git a/generic/tclTrace.c b/generic/tclTrace.c
index e411488..cb40fd7 100644
--- a/generic/tclTrace.c
+++ b/generic/tclTrace.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclTrace.c,v 1.54 2008/10/26 18:34:04 dkf Exp $
+ * RCS: @(#) $Id: tclTrace.c,v 1.55 2009/02/10 23:09:05 nijtmans Exp $
*/
#include "tclInt.h"
@@ -193,7 +193,8 @@ Tcl_TraceObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
int optionIndex;
- char *name, *flagOps, *p;
+ const char *name;
+ const char *flagOps, *p;
/* Main sub commands to 'trace' */
static const char *const traceOptions[] = {
"add", "info", "remove",
@@ -325,26 +326,26 @@ Tcl_TraceObjCmd(
name = Tcl_GetString(objv[2]);
FOREACH_VAR_TRACE(interp, name, clientData) {
TraceVarInfo *tvarPtr = clientData;
+ char *q = ops;
pairObjPtr = Tcl_NewListObj(0, NULL);
- p = ops;
if (tvarPtr->flags & TCL_TRACE_READS) {
- *p = 'r';
- p++;
+ *q = 'r';
+ q++;
}
if (tvarPtr->flags & TCL_TRACE_WRITES) {
- *p = 'w';
- p++;
+ *q = 'w';
+ q++;
}
if (tvarPtr->flags & TCL_TRACE_UNSETS) {
- *p = 'u';
- p++;
+ *q = 'u';
+ q++;
}
if (tvarPtr->flags & TCL_TRACE_ARRAY) {
- *p = 'a';
- p++;
+ *q = 'a';
+ q++;
}
- *p = '\0';
+ *q = '\0';
/*
* Build a pair (2-item list) with the ops string as the first obj
@@ -399,7 +400,7 @@ TraceExecutionObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
int commandLength, index;
- char *name, *command;
+ const char *name, *command;
size_t length;
enum traceOptions {
TRACE_ADD, TRACE_INFO, TRACE_REMOVE
@@ -648,7 +649,7 @@ TraceCommandObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
int commandLength, index;
- char *name, *command;
+ const char *name, *command;
size_t length;
enum traceOptions { TRACE_ADD, TRACE_INFO, TRACE_REMOVE };
static const char *const opStrings[] = { "delete", "rename", NULL };
@@ -840,7 +841,7 @@ TraceVariableObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
int commandLength, index;
- char *name, *command;
+ const char *name, *command;
size_t length;
enum traceOptions { TRACE_ADD, TRACE_INFO, TRACE_REMOVE };
static const char *const opStrings[] = {
@@ -1814,7 +1815,7 @@ TraceExecutionProc(
}
} else if (flags & TCL_TRACE_LEAVE_EXEC) {
Tcl_Obj *resultCode;
- char *resultCodeStr;
+ const char *resultCodeStr;
/*
* Append result code.
@@ -2477,7 +2478,7 @@ TclObjCallVarTraces(
* variable, or -1. Only used when part1Ptr is
* NULL. */
{
- char *part1, *part2;
+ const char *part1, *part2;
if (!part1Ptr) {
part1Ptr = localName(iPtr->varFramePtr, index);
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index bc189c0..9ea54b0 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUtil.c,v 1.108 2009/01/08 16:41:34 dkf Exp $
+ * RCS: @(#) $Id: tclUtil.c,v 1.109 2009/02/10 23:09:05 nijtmans Exp $
*/
#include "tclInt.h"
@@ -1146,7 +1146,7 @@ Tcl_ConcatObj(
{
int allocSize, finalSize, length, elemLength, i;
char *p;
- char *element;
+ const char *element;
char *concatStr;
Tcl_Obj *objPtr, *resPtr;
@@ -2561,7 +2561,8 @@ TclGetIntForIndex(
* representing an index. */
{
int length;
- char *opPtr, *bytes;
+ char *opPtr;
+ const char *bytes;
if (TclGetIntFromObj(NULL, objPtr, indexPtr) == TCL_OK) {
return TCL_OK;
@@ -2622,7 +2623,7 @@ TclGetIntForIndex(
parseError:
if (interp != NULL) {
- char *bytes = Tcl_GetString(objPtr);
+ const char *bytes = Tcl_GetString(objPtr);
/*
* The result might not be empty; this resets it which should be both
@@ -2705,7 +2706,7 @@ SetEndOffsetFromAny(
Tcl_Obj *objPtr) /* Pointer to the object to parse */
{
int offset; /* Offset in the "end-offset" expression */
- register char* bytes; /* String rep of the object */
+ register const char* bytes; /* String rep of the object */
int length; /* Length of the object's string rep */
/*
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 6c5e382..0af352c 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -16,7 +16,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclVar.c,v 1.175 2009/01/09 11:21:46 dkf Exp $
+ * RCS: @(#) $Id: tclVar.c,v 1.176 2009/02/10 23:08:57 nijtmans Exp $
*/
#include "tclInt.h"
@@ -509,7 +509,7 @@ TclObjLookupVarEx(
Interp *iPtr = (Interp *) interp;
register Var *varPtr; /* Points to the variable's in-frame Var
* structure. */
- char *part1;
+ const char *part1;
int index, len1, len2;
int parsed = 0;
Tcl_Obj *objPtr;
@@ -517,7 +517,7 @@ TclObjLookupVarEx(
const char *errMsg = NULL;
CallFrame *varFramePtr = iPtr->varFramePtr;
Namespace *nsPtr;
- char *part2 = part2Ptr? TclGetString(part2Ptr):NULL;
+ const char *part2 = part2Ptr? TclGetString(part2Ptr):NULL;
char *newPart2 = NULL;
*arrayPtrPtr = NULL;
@@ -1013,7 +1013,7 @@ TclLookupSimpleVar(
register Tcl_Obj *objPtr = *objPtrPtr;
if (objPtr) {
- char *localName = TclGetString(objPtr);
+ const char *localName = TclGetString(objPtr);
if ((varName[0] == localName[0])
&& (strcmp(varName, localName) == 0)) {
@@ -2457,7 +2457,7 @@ Tcl_UnsetObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
register int i, flags = TCL_LEAVE_ERR_MSG;
- register char *name;
+ register const char *name;
if (objc == 1) {
/*
@@ -2899,7 +2899,7 @@ Tcl_ArrayObjCmd(
case ARRAY_STARTSEARCH: {
ArraySearch *searchPtr;
int isNew;
- char *varName = TclGetString(varNamePtr);
+ const char *varName = TclGetString(varNamePtr);
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "arrayName");
@@ -2941,8 +2941,8 @@ Tcl_ArrayObjCmd(
case ARRAY_GET: {
Tcl_HashSearch search;
Var *varPtr2;
- char *pattern = NULL;
- char *name;
+ const char *pattern = NULL;
+ const char *name;
Tcl_Obj *namePtr, *valuePtr, *nameLstPtr, *tmpResPtr, **namePtrPtr;
int i, count;
@@ -3064,8 +3064,8 @@ Tcl_ArrayObjCmd(
case ARRAY_NAMES: {
Tcl_HashSearch search;
Var *varPtr2;
- char *pattern;
- char *name;
+ const char *pattern;
+ const char *name;
Tcl_Obj *namePtr, *resultPtr, *patternPtr;
int mode, matched = 0;
static const char *const options[] = {
@@ -3157,7 +3157,7 @@ Tcl_ArrayObjCmd(
case ARRAY_UNSET: {
Tcl_HashSearch search;
Var *varPtr2;
- char *pattern = NULL;
+ const char *pattern = NULL;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "arrayName ?pattern?");
@@ -3847,8 +3847,8 @@ Tcl_GlobalObjCmd(
{
Interp *iPtr = (Interp *) interp;
register Tcl_Obj *objPtr, *tailPtr;
- char *varName;
- register char *tail;
+ const char *varName;
+ register const char *tail;
int result, i;
/*
@@ -3950,7 +3950,7 @@ Tcl_VariableObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
Interp *iPtr = (Interp *) interp;
- char *varName, *tail, *cp;
+ const char *varName, *tail, *cp;
Var *varPtr, *arrayPtr;
Tcl_Obj *varValuePtr;
int i, result;
@@ -4147,7 +4147,7 @@ SetArraySearchObj(
Tcl_Interp *interp,
Tcl_Obj *objPtr)
{
- char *string;
+ const char *string;
char *end;
int id;
size_t offset;
@@ -4221,11 +4221,11 @@ ParseSearchId(
* name. */
{
Interp *iPtr = (Interp *) interp;
- register char *string;
+ register const char *string;
register size_t offset;
int id;
ArraySearch *searchPtr;
- char *varName = TclGetString(varNamePtr);
+ const char *varName = TclGetString(varNamePtr);
/*
* Parse the id.
@@ -4828,7 +4828,8 @@ UpdateParsedVarName(
{
Tcl_Obj *arrayPtr = objPtr->internalRep.twoPtrValue.ptr1;
char *part2 = objPtr->internalRep.twoPtrValue.ptr2;
- char *part1, *p;
+ const char *part1;
+ char *p;
int len1, len2, totalLen;
if (arrayPtr == NULL) {
@@ -4939,7 +4940,7 @@ ObjFindNamespaceVar(
int result;
Tcl_Var var;
Tcl_Obj *simpleNamePtr;
- char *name = TclGetString(namePtr);
+ const char *name = TclGetString(namePtr);
/*
* If this namespace has a variable resolver, then give it first crack at
@@ -5050,7 +5051,7 @@ TclInfoVarsCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
Interp *iPtr = (Interp *) interp;
- char *varName, *pattern;
+ const char *varName, *pattern;
const char *simplePattern;
Tcl_HashSearch search;
Var *varPtr;
@@ -5243,7 +5244,7 @@ TclInfoGlobalsCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- char *varName, *pattern;
+ const char *varName, *pattern;
Namespace *globalNsPtr = (Namespace *) Tcl_GetGlobalNamespace(interp);
Tcl_HashSearch search;
Var *varPtr;
@@ -5393,7 +5394,7 @@ AppendLocals(
Var *varPtr;
int i, localVarCt;
Tcl_Obj **varNamePtr;
- char *varName;
+ const char *varName;
TclVarHashTable *localVarTablePtr;
Tcl_HashSearch search;
const char *pattern = patternPtr? TclGetString(patternPtr) : NULL;