diff options
author | nijtmans <nijtmans> | 2009-02-10 22:49:42 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2009-02-10 22:49:42 (GMT) |
commit | b07274fff759a29a06f8c988c019d09d583fe435 (patch) | |
tree | ca3baf5495ef51e4e0ad8aa5ed4221b784f68ae6 | |
parent | 9968eece0a412b8035a5437db0e8c52723c94e7f (diff) | |
download | tcl-b07274fff759a29a06f8c988c019d09d583fe435.zip tcl-b07274fff759a29a06f8c988c019d09d583fe435.tar.gz tcl-b07274fff759a29a06f8c988c019d09d583fe435.tar.bz2 |
- eliminate some unnessary type casts
- some internal const decorations
- spacing
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | generic/tclEncoding.c | 6 | ||||
-rw-r--r-- | generic/tclEvent.c | 4 | ||||
-rw-r--r-- | generic/tclExecute.c | 24 | ||||
-rw-r--r-- | generic/tclIO.c | 16 | ||||
-rw-r--r-- | generic/tclIOCmd.c | 20 | ||||
-rw-r--r-- | generic/tclIORChan.c | 4 | ||||
-rw-r--r-- | generic/tclIOUtil.c | 20 | ||||
-rw-r--r-- | generic/tclIndexObj.c | 14 | ||||
-rw-r--r-- | generic/tclInterp.c | 12 | ||||
-rw-r--r-- | generic/tclListObj.c | 8 | ||||
-rw-r--r-- | generic/tclLiteral.c | 16 | ||||
-rw-r--r-- | generic/tclNamesp.c | 36 | ||||
-rw-r--r-- | generic/tclOOBasic.c | 4 | ||||
-rw-r--r-- | generic/tclObj.c | 11 | ||||
-rw-r--r-- | generic/tclPathObj.c | 4 | ||||
-rw-r--r-- | generic/tclPkg.c | 9 | ||||
-rw-r--r-- | generic/tclProc.c | 12 | ||||
-rw-r--r-- | generic/tclRegexp.c | 4 |
19 files changed, 134 insertions, 110 deletions
@@ -1,3 +1,23 @@ +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 + * generic/tclIndexObj.c + * generic/tclInterp.c + * generic/tclIO.c + * generic/tclIOCmd.c + * generic/tclIORChan.c + * generic/tclIOUtil.c + * generic/tclListObj.c + * generic/tclLiteral.c + * generic/tclNamesp.c + * generic/tclObj.c + * generic/tclOOBasic.c + * generic/tclPathObj.c + * generic/tclPkg.c + * generic/tclProc.c + * generic/tclRegexp.c + 2009-02-10 Jan Nijtmans <nijtmans@users.sf.net> * unix/tcl.m4: fix [tcl-Bug 2502365] Building of head on HPUX is diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 843d46c..441e099 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.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: tclEncoding.c,v 1.65 2008/10/27 19:08:53 dgp Exp $ + * RCS: @(#) $Id: tclEncoding.c,v 1.66 2009/02/10 22:49:55 nijtmans Exp $ */ #include "tclInt.h" @@ -1727,7 +1727,7 @@ LoadTableEncoding( Tcl_IncrRefCount(objPtr); for (i = 0; i < numPages; i++) { int ch; - char *p; + const char *p; Tcl_ReadChars(chan, objPtr, 3 + 16 * (16 * 4 + 1), 0); p = Tcl_GetString(objPtr); @@ -3494,7 +3494,7 @@ InitializeEncodingSearchPath( int *lengthPtr, Tcl_Encoding *encodingPtr) { - char *bytes; + const char *bytes; int i, numDirs, numBytes; Tcl_Obj *libPath, *encodingObj, *searchPath; diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 40e1fe6..ada7ecb 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.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: tclEvent.c,v 1.87 2009/01/27 00:01:45 ferrieux Exp $ + * RCS: @(#) $Id: tclEvent.c,v 1.88 2009/02/10 22:49:42 nijtmans Exp $ */ #include "tclInt.h" @@ -1332,7 +1332,7 @@ Tcl_VwaitObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { int done, foundEvent; - char *nameString; + const char *nameString; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 601fe6e..0a86306 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.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: tclExecute.c,v 1.425 2009/02/05 14:21:42 dkf Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.426 2009/02/10 22:50:00 nijtmans Exp $ */ #include "tclInt.h" @@ -179,7 +179,7 @@ typedef struct BottomData { /* ------------------------------------------*/ TEOV_callback *atExitPtr; /* This field is used on return FROM here */ /* ------------------------------------------*/ - unsigned char *pc; /* These fields are used on return TO this */ + const unsigned char *pc; /* These fields are used on return TO this */ ptrdiff_t *catchTop; /* this level: they record the state when a */ int cleanup; /* new codePtr was received for NR execution */ Tcl_Obj *auxObjList; @@ -671,14 +671,14 @@ static void DeleteExecStack(ExecStack *esPtr); static void DupExprCodeInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); static void FreeExprCodeInternalRep(Tcl_Obj *objPtr); -static ExceptionRange * GetExceptRangeForPc(unsigned char *pc, int catchOnly, +static ExceptionRange * GetExceptRangeForPc(const unsigned char *pc, int catchOnly, ByteCode *codePtr); -static const char * GetSrcInfoForPc(unsigned char *pc, ByteCode *codePtr, +static const char * GetSrcInfoForPc(const unsigned char *pc, ByteCode *codePtr, int *lengthPtr); static Tcl_Obj ** GrowEvaluationStack(ExecEnv *eePtr, int growth, int move); static void IllegalExprOperandType(Tcl_Interp *interp, - unsigned char *pc, Tcl_Obj *opndPtr); + const unsigned char *pc, Tcl_Obj *opndPtr); static void InitByteCodeExecution(Tcl_Interp *interp); /* Useful elsewhere, make available in tclInt.h or stubs? */ static Tcl_Obj ** StackAllocWords(Tcl_Interp *interp, int numWords); @@ -1788,7 +1788,7 @@ TclExecuteByteCode( register Tcl_Obj **tosPtr = NULL; /* Cached pointer to top of evaluation * stack. */ - register unsigned char *pc = NULL; + register const unsigned char *pc = NULL; /* The current program counter. */ int instructionCount = 0; /* Counter that is used to work out when to * call Tcl_AsyncReady() */ @@ -4407,7 +4407,7 @@ TclExecuteByteCode( int found, s1len, s2len, llen, i; Tcl_Obj *valuePtr, *value2Ptr, *o; - char *s1; + const char *s1; const char *s2; value2Ptr = OBJ_AT_TOS; @@ -4497,7 +4497,7 @@ TclExecuteByteCode( iResult = (*pc == INST_STR_EQ); } else { - char *s1, *s2; + const char *s1, *s2; int s1len, s2len; s1 = TclGetStringFromObj(valuePtr, &s1len); @@ -8125,14 +8125,14 @@ static void IllegalExprOperandType( Tcl_Interp *interp, /* Interpreter to which error information * pertains. */ - unsigned char *pc, /* Points to the instruction being executed + const unsigned char *pc, /* Points to the instruction being executed * when the illegal type was found. */ Tcl_Obj *opndPtr) /* Points to the operand holding the value * with the illegal type. */ { ClientData ptr; int type; - unsigned char opcode = *pc; + const unsigned char opcode = *pc; const char *description, *operator = operatorStrings[opcode - INST_LOR]; if (opcode == INST_EXPON) { @@ -8259,7 +8259,7 @@ TclGetSrcInfoForPc( static const char * GetSrcInfoForPc( - unsigned char *pc, /* The program counter value for which to + const unsigned char *pc, /* The program counter value for which to * return the closest command's source info. * This points to a bytecode instruction in * codePtr's code. */ @@ -8383,7 +8383,7 @@ GetSrcInfoForPc( static ExceptionRange * GetExceptRangeForPc( - unsigned char *pc, /* The program counter value for which to + const unsigned char *pc, /* The program counter value for which to * search for a closest enclosing exception * range. This points to a bytecode * instruction in codePtr's code. */ diff --git a/generic/tclIO.c b/generic/tclIO.c index 3ed45a2..7814e32 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.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: tclIO.c,v 1.158 2009/01/09 11:21:45 dkf Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.159 2009/02/10 22:49:45 nijtmans Exp $ */ #include "tclInt.h" @@ -3158,7 +3158,7 @@ Tcl_CloseEx( NULL); return TCL_ERROR; } - + /* * Check direction against channel mode. It is an error if we try to close * a direction not supported by the channel (already closed, or never @@ -3192,14 +3192,14 @@ Tcl_CloseEx( return TCL_ERROR; } - if (flags & TCL_CLOSE_READ) { + if (flags & TCL_CLOSE_READ) { /* * Call the finalization code directly. There are no events to handle, * there cannot be for the read-side. */ return CloseChannelPart(interp, chanPtr, 0, flags); - } else if (flags & TCL_CLOSE_WRITE) { + } else if (flags & TCL_CLOSE_WRITE) { if ((statePtr->curOutPtr != NULL) && IsBufferReady(statePtr->curOutPtr)) { SetFlag(statePtr, BUFFER_READY); @@ -3785,7 +3785,7 @@ Tcl_WriteObj( Channel *chanPtr; ChannelState *statePtr; /* State info for channel */ - char *src; + const char *src; int srcLen; statePtr = ((Channel *) chan)->state; @@ -4324,7 +4324,7 @@ Tcl_Gets( { Tcl_Obj *objPtr; int charsStored, length; - char *string; + const char *string; TclNewObj(objPtr); charsStored = Tcl_GetsObj(chan, objPtr); @@ -8714,7 +8714,7 @@ Tcl_FileEventObjCmd( Channel *chanPtr; /* The channel to create the handler for. */ ChannelState *statePtr; /* State info for channel */ Tcl_Channel chan; /* The opaque type for the channel. */ - char *chanName; + const char *chanName; int modeIndex; /* Index of mode argument. */ int mask; static const char *const modeOptions[] = {"readable", "writable", NULL}; @@ -8922,7 +8922,7 @@ CopyData( Tcl_Channel inChan, outChan; ChannelState *inStatePtr, *outStatePtr; int result = TCL_OK, size, total, sizeb; - char *buffer; + const char *buffer; int inBinary, outBinary, sameEncoding; /* Encoding control */ int underflow; /* Input underflow */ diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 95f4ebc..3ee768f 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.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: tclIOCmd.c,v 1.62 2009/01/09 11:21:46 dkf Exp $ + * RCS: @(#) $Id: tclIOCmd.c,v 1.63 2009/02/10 22:49:58 nijtmans Exp $ */ #include "tclInt.h" @@ -145,7 +145,7 @@ Tcl_PutsObjCmd( * documented. */ - char *arg; + const char *arg; int length; arg = TclGetStringFromObj(objv[3], &length); @@ -435,7 +435,7 @@ Tcl_ReadObjCmd( toRead = -1; if (i < objc) { - char *arg; + const char *arg; arg = TclGetString(objv[i]); if (isdigit(UCHAR(arg[0]))) { /* INTL: digit */ @@ -477,7 +477,7 @@ Tcl_ReadObjCmd( */ if ((charactersRead > 0) && (newline != 0)) { - char *result; + const char *result; int length; result = TclGetStringFromObj(resultPtr, &length); @@ -714,7 +714,7 @@ Tcl_CloseObjCmd( */ Tcl_Obj *resultPtr = Tcl_GetObjResult(interp); - char *string; + const char *string; int len; if (Tcl_IsShared(resultPtr)) { @@ -756,7 +756,7 @@ Tcl_FconfigureObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - char *optionName, *valueName; + const char *optionName, *valueName; Tcl_Channel chan; /* The channel to set a mode on. */ int i; /* Iterate over arg-value pairs. */ @@ -881,7 +881,7 @@ Tcl_ExecObjCmd( Tcl_Obj *resultPtr; const char **argv; - char *string; + const char *string; Tcl_Channel chan; int argc, background, i, index, keepNewline, result, skip, length; int ignoreStderr; @@ -1107,7 +1107,7 @@ Tcl_OpenObjCmd( } else { modeString = TclGetString(objv[2]); if (objc == 4) { - char *permString = TclGetString(objv[3]); + const char *permString = TclGetString(objv[3]); int code = TCL_ERROR; int scanned = TclParseAllWhiteSpace(permString, -1); @@ -1469,7 +1469,7 @@ Tcl_SocketObjCmd( SKT_ASYNC, SKT_MYADDR, SKT_MYPORT, SKT_SERVER }; int optionIndex, a, server = 0, port, myport = 0, async = 0; - char *host, *script = NULL, *myaddr = NULL; + const char *host, *script = NULL, *myaddr = NULL; Tcl_Channel chan; if (TclpHasSockets(interp) != TCL_OK) { @@ -1505,7 +1505,7 @@ Tcl_SocketObjCmd( myaddr = TclGetString(objv[a]); break; case SKT_MYPORT: { - char *myPortName; + const char *myPortName; a++; if (a >= objc) { diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index cdda068..554380a 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIORChan.c,v 1.38 2009/01/26 16:42:39 dkf Exp $ + * RCS: @(#) $Id: tclIORChan.c,v 1.39 2009/02/10 22:50:09 nijtmans Exp $ */ #include <tclInt.h> @@ -1801,7 +1801,7 @@ ReflectGetOption( return TCL_ERROR; } else { int len; - char *str = Tcl_GetStringFromObj(resObj, &len); + const char *str = Tcl_GetStringFromObj(resObj, &len); if (len) { Tcl_DStringAppend(dsPtr, " ", 1); diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 6cc9fd2..44df324 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -17,7 +17,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOUtil.c,v 1.162 2009/01/06 10:08:10 dkf Exp $ + * RCS: @(#) $Id: tclIOUtil.c,v 1.163 2009/02/10 22:50:05 nijtmans Exp $ */ #include "tclInt.h" @@ -631,7 +631,7 @@ FsUpdateCwd( ClientData clientData) { int len; - char *str = NULL; + const char *str = NULL; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tclFsDataKey); if (cwdObj != NULL) { @@ -1684,7 +1684,7 @@ Tcl_FSEvalFileEx( Tcl_StatBuf statBuf; Tcl_Obj *oldScriptFile; Interp *iPtr; - char *string; + const char *string; Tcl_Channel chan; Tcl_Obj *objPtr; @@ -1797,7 +1797,7 @@ TclNREvalFile( Tcl_StatBuf statBuf; Tcl_Obj *oldScriptFile, *objPtr; Interp *iPtr; - char *string; + const char *string; Tcl_Channel chan; if (Tcl_FSGetNormalizedPath(interp, pathPtr) == NULL) { @@ -2745,7 +2745,7 @@ Tcl_FSGetCwd( */ int len1, len2; - char *str1, *str2; + const char *str1, *str2; str1 = Tcl_GetStringFromObj(tsdPtr->cwdPathPtr, &len1); str2 = Tcl_GetStringFromObj(norm, &len2); @@ -3664,7 +3664,7 @@ Tcl_FSSplitPath( const Tcl_Filesystem *fsPtr; char separator = '/'; int driveNameLength; - char *p; + const char *p; /* * Perform platform specific splitting. @@ -3710,7 +3710,7 @@ Tcl_FSSplitPath( */ for (;;) { - char *elementStart = p; + const char *elementStart = p; int length; while ((*p != '\0') && (*p != separator)) { @@ -3803,7 +3803,7 @@ TclGetPathType( * caller. */ { int pathLen; - char *path = Tcl_GetStringFromObj(pathPtr, &pathLen); + const char *path = Tcl_GetStringFromObj(pathPtr, &pathLen); Tcl_PathType type; type = TclFSNonnativePathType(path, pathLen, filesystemPtrPtr, @@ -3910,7 +3910,7 @@ TclFSNonnativePathType( while (numVolumes > 0) { Tcl_Obj *vol; int len; - char *strVol; + const char *strVol; numVolumes--; Tcl_ListObjIndex(NULL, thisFsVolumes, numVolumes, &vol); @@ -4255,7 +4255,7 @@ Tcl_FSRemoveDirectory( Tcl_Obj *cwdPtr = Tcl_FSGetCwd(NULL); if (cwdPtr != NULL) { - char *cwdStr, *normPathStr; + const char *cwdStr, *normPathStr; int cwdLen, normLen; Tcl_Obj *normPath = Tcl_FSGetNormalizedPath(NULL, pathPtr); diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index db2c0d1..6edd577 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.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: tclIndexObj.c,v 1.49 2009/01/08 16:41:34 dkf Exp $ + * RCS: @(#) $Id: tclIndexObj.c,v 1.50 2009/02/10 22:49:49 nijtmans Exp $ */ #include "tclInt.h" @@ -180,7 +180,7 @@ GetIndexFromObjList( int objc, result, t; Tcl_Obj **objv; - char **tablePtr; + const char **tablePtr; /* * Use Tcl_GetIndexFromObjStruct to do the work to avoid duplicating @@ -196,7 +196,7 @@ GetIndexFromObjList( * Build a string table from the list. */ - tablePtr = (char **) ckalloc((objc + 1) * sizeof(char *)); + tablePtr = (const char **) ckalloc((objc + 1) * sizeof(char *)); for (t = 0; t < objc; t++) { if (objv[t] == objPtr) { /* @@ -268,7 +268,7 @@ Tcl_GetIndexFromObjStruct( int *indexPtr) /* Place to store resulting integer index. */ { int index, idx, numAbbrev; - char *key, *p1; + const char *key, *p1; const char *p2; const char *const *entryPtr; Tcl_Obj *resultPtr; @@ -678,7 +678,7 @@ PrefixAllObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { int tableObjc, result, t, length, elemLength; - char *string, *elemString; + const char *string, *elemString; Tcl_Obj **tableObjv, *resultPtr; if (objc != 3) { @@ -735,7 +735,7 @@ PrefixLongestObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { int tableObjc, result, i, t, length, elemLength, resultLength; - char *string, *elemString, *resultString; + const char *string, *elemString, *resultString; Tcl_Obj **tableObjv; if (objc != 3) { @@ -1085,7 +1085,7 @@ Tcl_ParseArgsObjv( const Tcl_ArgvInfo *matchPtr; /* Descriptor that matches current argument. */ Tcl_Obj *curArg; /* Current argument */ - char *str = NULL; + const char *str = NULL; register char c; /* Second character of current arg (used for * quick check for matching; use 2nd char. * because first char. will almost always be diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 643b7e0..3105dc9 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.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: tclInterp.c,v 1.103 2009/02/06 01:00:00 mistachkin Exp $ + * RCS: @(#) $Id: tclInterp.c,v 1.104 2009/02/10 22:50:04 nijtmans Exp $ */ #include "tclInt.h" @@ -1037,7 +1037,7 @@ Tcl_InterpObjCmd( InterpInfo *iiPtr; Tcl_HashEntry *hPtr; Alias *aliasPtr; - char *aliasName; + const char *aliasName; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "path alias"); @@ -1536,7 +1536,7 @@ AliasCreate( slavePtr = &((InterpInfo *) ((Interp *) slaveInterp)->interpInfo)->slave; while (1) { Tcl_Obj *newToken; - char *string; + const char *string; string = TclGetString(aliasPtr->token); hPtr = Tcl_CreateHashEntry(&slavePtr->aliasTable, string, &isNew); @@ -2237,7 +2237,7 @@ SlaveCreate( Slave *slavePtr; InterpInfo *masterInfoPtr; Tcl_HashEntry *hPtr; - char *path; + const char *path; int isNew, objc; Tcl_Obj **objv; @@ -2671,7 +2671,7 @@ SlaveExpose( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - char *name; + const char *name; if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -2770,7 +2770,7 @@ SlaveHide( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - char *name; + const char *name; if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( diff --git a/generic/tclListObj.c b/generic/tclListObj.c index be18699..50653ab 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.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: tclListObj.c,v 1.56 2009/01/08 16:41:34 dkf Exp $ + * RCS: @(#) $Id: tclListObj.c,v 1.57 2009/02/10 22:49:52 nijtmans Exp $ */ #include "tclInt.h" @@ -1670,7 +1670,8 @@ SetListFromAny( Tcl_Interp *interp, /* Used for error reporting if not NULL. */ Tcl_Obj *objPtr) /* The object to convert. */ { - char *string, *s; + const char *string; + char *s; const char *elemStart, *nextElem; int lenRemain, length, estCount, elemSize, hasBrace, i, j, result; const char *limit; /* Points just after string's last byte. */ @@ -1860,7 +1861,8 @@ UpdateStringOfList( List *listRepPtr = (List *) listPtr->internalRep.twoPtrValue.ptr1; int numElems = listRepPtr->elemCount; register int i; - char *elem, *dst; + const char *elem; + char *dst; int length; Tcl_Obj **elemPtrs; diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c index a176e8d..ccee1c4 100644 --- a/generic/tclLiteral.c +++ b/generic/tclLiteral.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: tclLiteral.c,v 1.34 2009/01/09 11:21:46 dkf Exp $ + * RCS: @(#) $Id: tclLiteral.c,v 1.35 2009/02/10 22:49:50 nijtmans Exp $ */ #include "tclInt.h" @@ -221,7 +221,7 @@ TclDeleteLiteralTable( * Find, or if necessary create, an object in the interpreter's literal * table that has a string representation matching the argument * string. If nsPtr!=NULL then only literals stored for the namespace are - * considered. + * considered. * * Results: * The literal object. If it was created in this call *newPtr is set to @@ -255,7 +255,7 @@ TclCreateLiteral( LiteralEntry *globalPtr; int globalHash; Tcl_Obj *objPtr; - + /* * Is it in the interpreter's global literal table? */ @@ -508,7 +508,7 @@ TclLookupLiteralEntry( Interp *iPtr = (Interp *) interp; LiteralTable *globalTablePtr = &(iPtr->literalTable); register LiteralEntry *entryPtr; - char *bytes; + const char *bytes; int length, globalHash; bytes = TclGetStringFromObj(objPtr, &length); @@ -554,7 +554,7 @@ TclHideLiteral( LiteralEntry **nextPtrPtr, *entryPtr, *lPtr; LiteralTable *localTablePtr = &(envPtr->localLitTable); int localHash, length; - char *bytes; + const char *bytes; Tcl_Obj *newObjPtr; lPtr = &(envPtr->literalArrayPtr[index]); @@ -770,7 +770,7 @@ ExpandLocalLiteralArray( if (currArrayPtr != newArrayPtr) { for (i=0 ; i<currElems ; i++) { if (newArrayPtr[i].nextPtr != NULL) { - newArrayPtr[i].nextPtr = newArrayPtr + newArrayPtr[i].nextPtr = newArrayPtr + (newArrayPtr[i].nextPtr - currArrayPtr); } } @@ -818,7 +818,7 @@ TclReleaseLiteral( Interp *iPtr = (Interp *) interp; LiteralTable *globalTablePtr = &(iPtr->literalTable); register LiteralEntry *entryPtr, *prevPtr; - char *bytes; + const char *bytes; int length, index; bytes = TclGetStringFromObj(objPtr, &length); @@ -942,7 +942,7 @@ RebuildLiteralTable( register LiteralEntry **oldChainPtr, **newChainPtr; register LiteralEntry *entryPtr; LiteralEntry **bucketPtr; - char *bytes; + const char *bytes; int oldSize, count, index, length; oldSize = tablePtr->numBuckets; diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 42e5a2b..20b28eb 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -23,7 +23,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclNamesp.c,v 1.188 2009/01/29 15:57:54 dkf Exp $ + * RCS: @(#) $Id: tclNamesp.c,v 1.189 2009/02/10 22:50:07 nijtmans Exp $ */ #include "tclInt.h" @@ -2942,7 +2942,7 @@ NamespaceChildrenCmd( Tcl_Namespace *namespacePtr; Namespace *nsPtr, *childNsPtr; Namespace *globalNsPtr = (Namespace *) TclGetGlobalNamespace(interp); - char *pattern = NULL; + const char *pattern = NULL; Tcl_DString buffer; register Tcl_HashEntry *entryPtr; Tcl_HashSearch search; @@ -2970,7 +2970,7 @@ NamespaceChildrenCmd( Tcl_DStringInit(&buffer); if (objc == 4) { - char *name = TclGetString(objv[3]); + const char *name = TclGetString(objv[3]); if ((*name == ':') && (*(name+1) == ':')) { pattern = name; @@ -3056,7 +3056,7 @@ NamespaceCodeCmd( { Namespace *currNsPtr; Tcl_Obj *listPtr, *objPtr; - register char *arg, *p; + register const char *arg, *p; int length; if (objc != 3) { @@ -3203,7 +3203,7 @@ NamespaceDeleteCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Namespace *namespacePtr; - char *name; + const char *name; register int i; if (objc < 2) { @@ -3304,7 +3304,7 @@ NamespaceEvalCmd( */ if (result == TCL_ERROR) { - char *name = TclGetString(objv[2]); + const char *name = TclGetString(objv[2]); namespacePtr = Tcl_CreateNamespace(interp, name, NULL, NULL); if (namespacePtr == NULL) { @@ -3471,7 +3471,7 @@ NamespaceExportCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { Namespace *currNsPtr = (Namespace *) TclGetCurrentNamespace(interp); - char *pattern, *string; + const char *pattern, *string; int resetListFirst = 0; int firstArg, patternCt, i, result; @@ -3570,7 +3570,7 @@ NamespaceForgetCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - char *pattern; + const char *pattern; register int i, result; if (objc < 2) { @@ -3636,7 +3636,7 @@ NamespaceImportCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { int allowOverwrite = 0; - char *string, *pattern; + const char *string, *pattern; register int i, result; int firstArg; @@ -4183,7 +4183,7 @@ NamespaceQualifiersCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register char *name, *p; + register const char *name, *p; int length; if (objc != 3) { @@ -4438,7 +4438,7 @@ NamespaceTailCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register char *name, *p; + register const char *name, *p; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "string"); @@ -4499,7 +4499,7 @@ NamespaceUpvarCmd( Interp *iPtr = (Interp *) interp; Tcl_Namespace *nsPtr, *savedNsPtr; Var *otherPtr, *arrayPtr; - char *myName; + const char *myName; if (objc < 3 || !(objc & 1)) { Tcl_WrongNumArgs(interp, 2, objv, @@ -4849,7 +4849,7 @@ NamespaceEnsembleCmd( switch ((enum EnsSubcmds) index) { case ENS_CREATE: { - char *name; + const char *name; Tcl_DictSearch search; Tcl_Obj *listObj; int done, len, allocatedMapFlag = 0; @@ -4938,7 +4938,7 @@ NamespaceEnsembleCmd( } do { Tcl_Obj **listv; - char *cmd; + const char *cmd; if (TclListObjGetElements(interp, listObj, &len, &listv) != TCL_OK) { @@ -5236,7 +5236,7 @@ NamespaceEnsembleCmd( } do { Tcl_Obj **listv; - char *cmd; + const char *cmd; if (TclListObjGetElements(interp, listObj, &len, &listv) != TCL_OK) { @@ -6414,7 +6414,7 @@ NsEnsembleImplementationCmdNR( * matches. */ - char *subcmdName; /* Name of the subcommand, or unique prefix of + const char *subcmdName; /* Name of the subcommand, or unique prefix of * it (will be an error for a non-unique * prefix). */ char *fullName = NULL; /* Full name of the subcommand. */ @@ -7004,7 +7004,7 @@ BuildEnsembleConfig( TclListObjGetElements(NULL, ensemblePtr->subcmdList, &subcmdc, &subcmdv); for (i=0 ; i<subcmdc ; i++) { - char *name = TclGetString(subcmdv[i]); + const char *name = TclGetString(subcmdv[i]); hPtr = Tcl_CreateHashEntry(hash, name, &isNew); @@ -7060,7 +7060,7 @@ BuildEnsembleConfig( Tcl_DictObjFirst(NULL, ensemblePtr->subcommandDict, &dictSearch, &keyObj, &valueObj, &done); while (!done) { - char *name = TclGetString(keyObj); + const char *name = TclGetString(keyObj); hPtr = Tcl_CreateHashEntry(hash, name, &isNew); Tcl_SetHashValue(hPtr, valueObj); diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c index 887e80c..8be8773 100644 --- a/generic/tclOOBasic.c +++ b/generic/tclOOBasic.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: tclOOBasic.c,v 1.16 2008/12/02 19:40:41 dgp Exp $ + * RCS: @(#) $Id: tclOOBasic.c,v 1.17 2009/02/10 22:49:55 nijtmans Exp $ */ #ifdef HAVE_CONFIG_H @@ -942,7 +942,7 @@ TclOOCopyObjectCmd( if (objc == 2) { o2Ptr = Tcl_CopyObjectInstance(interp, oPtr, NULL, NULL); } else { - char *name; + const char *name; Tcl_DString buffer; name = TclGetString(objv[2]); diff --git a/generic/tclObj.c b/generic/tclObj.c index 56d42a6..e130dbb 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.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: tclObj.c,v 1.150 2009/02/10 17:09:09 dgp Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.151 2009/02/10 22:49:48 nijtmans Exp $ */ #include "tclInt.h" @@ -1423,7 +1423,7 @@ SetBooleanFromAny( badBoolean: if (interp != NULL) { int length; - char *str = Tcl_GetStringFromObj(objPtr, &length); + const char *str = Tcl_GetStringFromObj(objPtr, &length); Tcl_Obj *msg; TclNewLiteralStringObj(msg, "expected boolean value but got \""); @@ -1440,7 +1440,8 @@ ParseBoolean( register Tcl_Obj *objPtr) /* The object to parse/convert. */ { int i, length, newBool; - char lowerCase[6], *str = TclGetStringFromObj(objPtr, &length); + char lowerCase[6]; + const char *str = TclGetStringFromObj(objPtr, &length); if ((length == 0) || (length > 5)) { /* longest valid boolean string rep. is "false" */ @@ -3605,7 +3606,7 @@ TclSetCmdNameObj( Interp *iPtr = (Interp *) interp; register ResolvedCmdName *resPtr; register Namespace *currNsPtr; - char *name; + const char *name; if (objPtr->typePtr == &tclCmdNameType) { return; @@ -3755,7 +3756,7 @@ SetCmdNameFromAny( register Tcl_Obj *objPtr) /* The object to convert. */ { Interp *iPtr = (Interp *) interp; - char *name; + const char *name; register Command *cmdPtr; Namespace *currNsPtr; register ResolvedCmdName *resPtr; diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index b6681a6..74f526a 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.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: tclPathObj.c,v 1.77 2009/01/09 11:21:46 dkf Exp $ + * RCS: @(#) $Id: tclPathObj.c,v 1.78 2009/02/10 22:49:50 nijtmans Exp $ */ #include "tclInt.h" @@ -2300,7 +2300,7 @@ Tcl_FSEqualPaths( Tcl_Obj *firstPtr, Tcl_Obj *secondPtr) { - char *firstStr, *secondStr; + const char *firstStr, *secondStr; int firstLen, secondLen, tempErrno; if (firstPtr == secondPtr) { diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 558ccd9..7bac7eb 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.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: tclPkg.c,v 1.38 2008/10/16 22:34:18 nijtmans Exp $ + * RCS: @(#) $Id: tclPkg.c,v 1.39 2009/02/10 22:49:49 nijtmans Exp $ * * TIP #268. * Heavily rewritten to handle the extend version numbers, and extended @@ -760,7 +760,8 @@ Tcl_PackageObjCmd( Tcl_HashSearch search; Tcl_HashTable *tablePtr; const char *version; - char *argv2, *argv3, *argv4, *iva = NULL, *ivb = NULL; + const char *argv2, *argv3, *argv4; + char *iva = NULL, *ivb = NULL; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); @@ -773,7 +774,7 @@ Tcl_PackageObjCmd( } switch ((enum pkgOptions) optionIndex) { case PKG_FORGET: { - char *keyString; + const char *keyString; for (i = 2; i < objc; i++) { keyString = TclGetString(objv[i]); @@ -1645,7 +1646,7 @@ AddRequirementsToResult( for (i = 0; i < reqc; i++) { int length; - char *v = Tcl_GetStringFromObj(reqv[i], &length); + const char *v = Tcl_GetStringFromObj(reqv[i], &length); if ((length & 0x1) && (v[length/2] == '-') && (strncmp(v, v+((length+1)/2), length/2) == 0)) { diff --git a/generic/tclProc.c b/generic/tclProc.c index 99aee95..611ae45 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.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: tclProc.c,v 1.169 2009/01/09 11:21:46 dkf Exp $ + * RCS: @(#) $Id: tclProc.c,v 1.170 2009/02/10 22:50:07 nijtmans Exp $ */ #include "tclInt.h" @@ -132,7 +132,7 @@ Tcl_ProcObjCmd( { register Interp *iPtr = (Interp *) interp; Proc *procPtr; - char *fullName; + const char *fullName; const char *procName, *procArgs, *procBody; Namespace *nsPtr, *altNsPtr, *cxtNsPtr; Tcl_Command cmd; @@ -584,7 +584,7 @@ TclCreateProc( if (localPtr->defValuePtr != NULL) { int tmpLength; - char *tmpPtr = TclGetStringFromObj(localPtr->defValuePtr, + const char *tmpPtr = TclGetStringFromObj(localPtr->defValuePtr, &tmpLength); if ((valueLength != tmpLength) || @@ -1754,7 +1754,7 @@ TclNRInterpProcCore( if (TCL_DTRACE_PROC_ARGS_ENABLED()) { int l = iPtr->varFramePtr->isProcCallFrame & FRAME_IS_LAMBDA ? 1 : 0; - char *a[10]; + const char *a[10]; int i; for (i = 0 ; i < 10 ; i++) { @@ -2432,7 +2432,7 @@ SetLambdaFromAny( register Tcl_Obj *objPtr) /* The object to convert. */ { Interp *iPtr = (Interp *) interp; - char *name; + const char *name; Tcl_Obj *argsPtr, *bodyPtr, *nsObjPtr, **objv, *errPtr; int objc, result; Proc *procPtr; @@ -2571,7 +2571,7 @@ SetLambdaFromAny( if (objc == 2) { TclNewLiteralStringObj(nsObjPtr, "::"); } else { - char *nsName = TclGetString(objv[2]); + const char *nsName = TclGetString(objv[2]); if ((*nsName != ':') || (*(nsName+1) != ':')) { TclNewLiteralStringObj(nsObjPtr, "::"); diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c index 4748e58..d0505e0 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.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: tclRegexp.c,v 1.30 2008/10/15 06:17:04 nijtmans Exp $ + * RCS: @(#) $Id: tclRegexp.c,v 1.31 2009/02/10 22:49:54 nijtmans Exp $ */ #include "tclInt.h" @@ -573,7 +573,7 @@ Tcl_GetRegExpFromObj( { int length; TclRegexp *regexpPtr; - char *pattern; + const char *pattern; /* * This is OK because we only actually interpret this value properly as a |