diff options
author | nijtmans <nijtmans> | 2008-10-16 22:34:18 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2008-10-16 22:34:18 (GMT) |
commit | 8b464633a0f2df93912ad25af65a5724cd643da2 (patch) | |
tree | c92c0492d1db21f9b0c7f880eec5c0cd3ce36762 | |
parent | 2b0bd4b76e50ee9f511c827309e0078efc6f537a (diff) | |
download | tcl-8b464633a0f2df93912ad25af65a5724cd643da2.zip tcl-8b464633a0f2df93912ad25af65a5724cd643da2.tar.gz tcl-8b464633a0f2df93912ad25af65a5724cd643da2.tar.bz2 |
Add "const" to many internal
const tables. No functional
or API change.
34 files changed, 217 insertions, 181 deletions
@@ -1,3 +1,39 @@ +2008-10-16 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/regc_locale.c: Add "const" to many internal + * generic/tclClock.c: const tables. No functional + * generic/tclCmdIL.c: or API change. + * generic/tclConfig.c + * generic/tclDate.c + * generic/tclEncoding.c + * generic/tclEvent.c + * generic/tclExecute.c + * generic/tclFileName.c + * generic/tclGetDate.y + * generic/tclInterp.c + * generic/tclIO.c + * generic/tclIOCmd.c + * generic/tclIORChan.c + * generic/tclIORTrans.c + * generic/tclLoad.c + * generic/tclObj.c + * generic/tclOOBasic.c + * generic/tclOOCall.c + * generic/tclOOInfo.c + * generic/tclPathObj.c + * generic/tclPkg.c + * generic/tclResult.c + * generic/tclStringObj.c + * generic/tclTest.c + * generic/tclTestObj.c + * generic/tclThreadTest.c + * generic/tclTimer.c + * generic/tclTrace.c + * macosx/tclMacOSXFCmd.c: + * win/cat.c + * win/tclWinInit.c + * win/tclWinTest.c + 2008-10-16 Don Porter <dgp@users.sourceforge.net> * library/init.tcl: Revised [unknown] so that it carefully diff --git a/generic/regc_locale.c b/generic/regc_locale.c index b5a44c4..98df798 100644 --- a/generic/regc_locale.c +++ b/generic/regc_locale.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: regc_locale.c,v 1.20 2007/12/13 15:23:14 dgp Exp $ + * RCS: @(#) $Id: regc_locale.c,v 1.21 2008/10/16 22:34:18 nijtmans Exp $ */ /* ASCII character-name table */ @@ -790,14 +790,14 @@ cclass( struct cvec *cv = NULL; Tcl_DString ds; const char *np; - const char **namePtr; + const char *const *namePtr; int i, index; /* * The following arrays define the valid character class names. */ - static const char *classNames[] = { + static const char *const classNames[] = { "alnum", "alpha", "ascii", "blank", "cntrl", "digit", "graph", "lower", "print", "punct", "space", "upper", "xdigit", NULL }; diff --git a/generic/tclClock.c b/generic/tclClock.c index d32e786..8b2e259 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.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: tclClock.c,v 1.70 2008/07/21 21:25:21 nijtmans Exp $ + * RCS: @(#) $Id: tclClock.c,v 1.71 2008/10/16 22:34:19 nijtmans Exp $ */ #include "tclInt.h" @@ -121,7 +121,7 @@ typedef struct TclDateFields { int iso8601Week; /* ISO8601 week number */ int dayOfWeek; /* Day of the week */ } TclDateFields; -static const char* eras[] = { "CE", "BCE", NULL }; +static const char *const eras[] = { "CE", "BCE", NULL }; /* * Thread specific data block holding a 'struct tm' for the 'gmtime' and @@ -1688,7 +1688,7 @@ ClockClicksObjCmd( int objc, /* Parameter count */ Tcl_Obj* const* objv) /* Parameter values */ { - static const char *clicksSwitches[] = { + static const char *const clicksSwitches[] = { "-milliseconds", "-microseconds", NULL }; enum ClicksSwitch { @@ -1849,7 +1849,7 @@ ClockParseformatargsObjCmd( /* Command line options expected */ - static const char* options[] = { + static const char *const options[] = { "-format", "-gmt", "-locale", "-timezone", NULL }; enum optionInd { diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index d1174ab..a6ee362 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.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: tclCmdIL.c,v 1.161 2008/10/14 19:26:59 dgp Exp $ + * RCS: @(#) $Id: tclCmdIL.c,v 1.162 2008/10/16 22:34:19 nijtmans Exp $ */ #include "tclInt.h" @@ -209,7 +209,7 @@ Tcl_IfObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - return Tcl_NRCallObjProc(interp, TclNRIfObjCmd, dummy, objc, objv); + return Tcl_NRCallObjProc(interp, TclNRIfObjCmd, dummy, objc, objv); } int @@ -1087,7 +1087,7 @@ InfoFrameCmd( NULL); return TCL_ERROR; } - + /* * Let us convert to relative so that we know how many levels to go back */ @@ -1096,7 +1096,7 @@ InfoFrameCmd( level -= topLevel; } - framePtr = iPtr->cmdFramePtr; + framePtr = iPtr->cmdFramePtr; while (++level <= 0) { framePtr = framePtr->nextPtr; if (!framePtr) { @@ -1137,7 +1137,7 @@ TclInfoFrame( * This array is indexed by the TCL_LOCATION_... values, except * for _LAST. */ - static const char *typeString[TCL_LOCATION_LAST] = { + static const char *const typeString[TCL_LOCATION_LAST] = { "eval", "eval", "eval", "precompiled", "source", "proc" }; Tcl_Obj *tmpObj; @@ -2759,7 +2759,7 @@ Tcl_LsearchObjCmd( Tcl_Obj *patObj, **listv, *listPtr, *startPtr, *itemPtr; SortStrCmpFn_t strCmpFn = strcmp; Tcl_RegExp regexp = NULL; - static const char *options[] = { + static const char *const options[] = { "-all", "-ascii", "-bisect", "-decreasing", "-dictionary", "-exact", "-glob", "-increasing", "-index", "-inline", "-integer", "-nocase", "-not", @@ -3254,7 +3254,7 @@ Tcl_LsearchObjCmd( } else { itemPtr = listv[i]; } - + switch (mode) { case SORTED: case EXACT: @@ -3525,7 +3525,7 @@ Tcl_LsortObjCmd( SortElement *elementArray, *elementPtr; SortInfo sortInfo; /* Information about this sort that needs to * be passed to the comparison function. */ - static const char *switches[] = { + static const char *const switches[] = { "-ascii", "-command", "-decreasing", "-dictionary", "-increasing", "-index", "-indices", "-integer", "-nocase", "-real", "-stride", "-unique", NULL diff --git a/generic/tclConfig.c b/generic/tclConfig.c index 2380430..b2d3fbb 100644 --- a/generic/tclConfig.c +++ b/generic/tclConfig.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: tclConfig.c,v 1.23 2008/10/04 11:34:19 nijtmans Exp $ + * RCS: @(#) $Id: tclConfig.c,v 1.24 2008/10/16 22:34:18 nijtmans Exp $ */ #include "tclInt.h" @@ -214,7 +214,7 @@ QueryConfigObjCmd( Tcl_Obj *pkgName = cdPtr->pkg; Tcl_Obj *pDB, *pkgDict, *val, *listPtr; int n, index; - static const char *subcmdStrings[] = { + static const char *const subcmdStrings[] = { "get", "list", NULL }; enum subcmds { diff --git a/generic/tclDate.c b/generic/tclDate.c index 2b0636b..eabd37a 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -235,7 +235,7 @@ typedef struct DateInfo { */ typedef struct _TABLE { - char *name; + const char *name; int type; time_t value; } TABLE; @@ -261,7 +261,7 @@ typedef enum _MERIDIAN { */ static int LookupWord(char *buff); -static void TclDateerror(char *s); +static void TclDateerror(const char *s); static int TclDatelex(void *info); static time_t ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian); @@ -2451,7 +2451,7 @@ static TABLE MilitaryTable[] = { static void TclDateerror( - char *s) + const char *s) { } diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 456c8a4..a1b43cb 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.61 2008/06/11 01:30:11 jenglish Exp $ + * RCS: @(#) $Id: tclEncoding.c,v 1.62 2008/10/16 22:34:19 nijtmans Exp $ */ #include "tclInt.h" @@ -277,7 +277,7 @@ static int Iso88591ToUtfProc(ClientData clientData, * See concerns raised in [Bug 1077262]. */ -static Tcl_ObjType encodingType = { +static const Tcl_ObjType encodingType = { "encoding", FreeEncodingIntRep, DupEncodingIntRep, NULL, NULL }; diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 9e38f24..3d29cb5 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.83 2008/08/01 18:22:28 hobbs Exp $ + * RCS: @(#) $Id: tclEvent.c,v 1.84 2008/10/16 22:34:19 nijtmans Exp $ */ #include "tclInt.h" @@ -416,7 +416,7 @@ TclDefaultBgErrorHandlerObjCmd( */ saved = Tcl_SaveInterpState(interp, code); - + /* Invoke the bgerror command. */ Tcl_AllowExceptions(interp); code = Tcl_EvalObjv(interp, 2, tempObjv, TCL_EVAL_GLOBAL); @@ -1325,7 +1325,7 @@ Tcl_UpdateObjCmd( { int optionIndex; int flags = 0; /* Initialized to avoid compiler warning. */ - static const char *updateOptions[] = {"idletasks", NULL}; + static const char *const updateOptions[] = {"idletasks", NULL}; enum updateOptions {REGEXP_IDLETASKS}; if (objc == 1) { diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 674cd56..2daa7ed 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.416 2008/10/14 19:26:59 dgp Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.417 2008/10/16 22:34:18 nijtmans Exp $ */ #include "tclInt.h" @@ -514,7 +514,7 @@ VarHashCreateVar( * be seen by user scripts. */ -static Tcl_ObjType dictIteratorType = { +static const Tcl_ObjType dictIteratorType = { "dictIterator", NULL, NULL, NULL, NULL }; @@ -689,7 +689,7 @@ static Tcl_Obj ** StackReallocWords(Tcl_Interp *interp, int numWords); * compiled bytecode for Tcl expressions. */ -static Tcl_ObjType exprCodeType = { +static const Tcl_ObjType exprCodeType = { "exprcode", FreeExprCodeInternalRep, /* freeIntRepProc */ DupExprCodeInternalRep, /* dupIntRepProc */ @@ -1851,7 +1851,7 @@ TclExecuteByteCode( initLevel = 0; nested = 1; - + oldBottomPtr = iPtr->execEnvPtr->bottomPtr; iPtr->execEnvPtr->corPtr->stackLevel = &initLevel; if (iPtr->execEnvPtr->rewind) { @@ -1859,7 +1859,7 @@ TclExecuteByteCode( } goto returnToCaller; } - + nonRecursiveCallStart: if (nested) { TEOV_callback *callbackPtr = TOP_CB(interp); @@ -1881,7 +1881,7 @@ TclExecuteByteCode( * A request to run a bytecode: record this level's state * variables, swap codePtr and start running the new one. */ - + codePtr = param; break; case TCL_NR_ATEXIT_TYPE: { @@ -1889,11 +1889,11 @@ TclExecuteByteCode( * A request to perform a command at exit: put it in the stack * and continue exec'ing the current bytecode */ - + TEOV_callback *newPtr = TOP_CB(interp); TOP_CB(interp) = newPtr->nextPtr; - + #ifdef TCL_COMPILE_DEBUG if (traceInstructions) { fprintf(stdout, " atProcExit request received\n"); @@ -1909,9 +1909,9 @@ TclExecuteByteCode( * A request to perform a tailcall: put it at the front of the * atExit stack and abandon the current bytecode. */ - + TEOV_callback *newPtr = TOP_CB(interp); - + TOP_CB(interp) = newPtr->nextPtr; isTailcall = 1; #ifdef TCL_COMPILE_DEBUG @@ -1926,7 +1926,7 @@ TclExecuteByteCode( TCL_STATIC); goto checkForCatch; } - + newPtr->nextPtr = NULL; if (!bottomPtr->atExitPtr) { newPtr->nextPtr = NULL; @@ -1935,9 +1935,9 @@ TclExecuteByteCode( /* * There are already atExit callbacks: run last. */ - + TEOV_callback *tmpPtr = bottomPtr->atExitPtr; - + while (tmpPtr->nextPtr) { tmpPtr = tmpPtr->nextPtr; } @@ -1947,11 +1947,11 @@ TclExecuteByteCode( } case TCL_NR_YIELD_TYPE: { /*[yield] */ CoroutineData *corPtr = iPtr->execEnvPtr->corPtr; - + if (!corPtr) { Tcl_SetResult(interp, "yield can only be called in a coroutine", TCL_STATIC); - Tcl_SetErrorCode(interp, "COROUTINE_ILLEGAL_YIELD", NULL); + Tcl_SetErrorCode(interp, "COROUTINE_ILLEGAL_YIELD", NULL); result = TCL_ERROR; goto checkForCatch; } @@ -1961,13 +1961,13 @@ TclExecuteByteCode( if (corPtr->stackLevel != &initLevel) { Tcl_SetResult(interp, "cannot yield: C stack busy", TCL_STATIC); - Tcl_SetErrorCode(interp, "COROUTINE_CANT_YIELD", NULL); + Tcl_SetErrorCode(interp, "COROUTINE_CANT_YIELD", NULL); result = TCL_ERROR; goto checkForCatch; } /* - * Save our state, restore the caller's execEnv and return + * Save our state, restore the caller's execEnv and return */ NR_DATA_BURY(); @@ -1992,7 +1992,7 @@ TclExecuteByteCode( auxObjList = NULL; initLevel = 1; NR_DATA_INIT(); /* record this level's data */ - + if (iPtr->execEnvPtr->corPtr && !iPtr->execEnvPtr->corPtr->stackLevel) { iPtr->execEnvPtr->corPtr->stackLevel = &initLevel; } @@ -2708,9 +2708,9 @@ TclExecuteByteCode( /* * Fix for [Bug 2102930] */ - + iPtr->numLevels++; - Tcl_NRAddCallback(interp, NRCommand, NULL, NULL, NULL, NULL); + Tcl_NRAddCallback(interp, NRCommand, NULL, NULL, NULL, NULL); goto doInvocationFromEval; } } @@ -2819,7 +2819,7 @@ TclExecuteByteCode( iPtr->cmdFramePtr = iPtr->cmdFramePtr->nextPtr; NRE_ASSERT(iPtr->cmdFramePtr == bcFramePtr->nextPtr); - + iPtr->execEnvPtr->bottomPtr = bottomPtr; if (result == TCL_OK) { @@ -7682,7 +7682,7 @@ TclExecuteByteCode( checkForCatch: if (iPtr->execEnvPtr->rewind) { goto abnormalReturn; - } + } if ((result == TCL_ERROR) && !(iPtr->flags & ERR_ALREADY_LOGGED)) { bytes = GetSrcInfoForPc(pc, codePtr, &length); if (bytes != NULL) { @@ -7902,18 +7902,18 @@ TclExecuteByteCode( NRE_ASSERT(result == TCL_OK); switch (type) { - case TCL_NR_BC_TYPE: + case TCL_NR_BC_TYPE: /* * One of the callbacks requested a new execution: a tailcall! * Start the new bytecode. */ - + goto nonRecursiveCallStart; case TCL_NR_ATEXIT_TYPE: case TCL_NR_TAILCALL_TYPE: TOP_CB(iPtr) = callbackPtr->nextPtr; TCLNR_FREE(interp, callbackPtr); - + Tcl_SetResult(interp, "atProcExit/tailcall cannot be invoked recursively", TCL_STATIC); result = TCL_ERROR; @@ -7930,7 +7930,7 @@ TclExecuteByteCode( /* save the interp state, arrange for restoring it after running the callbacks. Put the callback at the bottom of the atExit stack */ - + Tcl_InterpState state = Tcl_SaveInterpState(interp, result); TEOV_callback *lastPtr = atExitPtr; @@ -7938,7 +7938,7 @@ TclExecuteByteCode( lastPtr = lastPtr->nextPtr; } NRE_ASSERT(lastPtr->nextPtr == NULL); - + TclNRAddCallback(interp, NRRestoreInterpState, state, NULL, NULL, NULL); lastPtr->nextPtr = TOP_CB(iPtr); diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 0c29459..cca1a9b 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.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: tclFileName.c,v 1.93 2008/09/29 16:03:30 dgp Exp $ + * RCS: @(#) $Id: tclFileName.c,v 1.94 2008/10/16 22:34:19 nijtmans Exp $ */ #include "tclInt.h" @@ -1212,7 +1212,7 @@ Tcl_GlobObjCmd( Tcl_Obj *typePtr, *resultPtr, *look; Tcl_Obj *pathOrDir = NULL; Tcl_DString prefix; - static const char *options[] = { + static const char *const options[] = { "-directory", "-join", "-nocomplain", "-path", "-tails", "-types", "--", NULL }; @@ -1897,7 +1897,7 @@ TclGlob( */ if (types == NULL) { - /* + /* * We just want to check for existence. In this case we make it * easy on Tcl_FSMatchInDirectory and its sub-implementations by * not bothering them (even though they should support this @@ -1910,7 +1910,7 @@ TclGlob( } result = TCL_OK; } else { - /* + /* * We want to check for the correct type. Tcl_FSMatchInDirectory * is documented to do this for us, if we give it a NULL pattern. */ @@ -1960,7 +1960,7 @@ TclGlob( if (pathPrefix == NULL) { Tcl_Panic("Called TclGlob with TCL_GLOBMODE_TAILS and pathPrefix==NULL"); } - + pre = Tcl_GetStringFromObj(pathPrefix, &prefixLen); if (prefixLen > 0 && (strchr(separators, pre[prefixLen-1]) == NULL)) { diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index 119b406..af20a61 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -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: tclGetDate.y,v 1.38 2007/12/13 15:23:17 dgp Exp $ + * RCS: @(#) $Id: tclGetDate.y,v 1.39 2008/10/16 22:34:18 nijtmans Exp $ */ %{ @@ -132,7 +132,7 @@ typedef struct DateInfo { */ typedef struct _TABLE { - char *name; + const char *name; int type; time_t value; } TABLE; @@ -158,7 +158,7 @@ typedef enum _MERIDIAN { */ static int LookupWord(char *buff); -static void TclDateerror(char *s); +static void TclDateerror(const char *s); static int TclDatelex(void *info); static time_t ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian); @@ -675,7 +675,7 @@ static TABLE MilitaryTable[] = { static void TclDateerror( - char *s) + const char *s) { } diff --git a/generic/tclIO.c b/generic/tclIO.c index c69a8e2..7ec28c8 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.144 2008/10/04 12:33:34 nijtmans Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.145 2008/10/16 22:34:19 nijtmans Exp $ */ #include "tclInt.h" @@ -8346,7 +8346,7 @@ Tcl_FileEventObjCmd( char *chanName; int modeIndex; /* Index of mode argument. */ int mask; - static const char *modeOptions[] = {"readable", "writable", NULL}; + static const char *const modeOptions[] = {"readable", "writable", NULL}; static int maskArray[] = {TCL_READABLE, TCL_WRITABLE}; if ((objc != 3) && (objc != 4)) { diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 6bbf780..dbc9bb1 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.58 2008/07/21 21:58:22 das Exp $ + * RCS: @(#) $Id: tclIOCmd.c,v 1.59 2008/10/16 22:34:19 nijtmans Exp $ */ #include "tclInt.h" @@ -521,7 +521,7 @@ Tcl_SeekObjCmd( int mode; /* How to seek? */ Tcl_WideInt result; /* Of calling Tcl_Seek. */ int optionIndex; - static const char *originOptions[] = { + static const char *const originOptions[] = { "start", "current", "end", NULL }; static int modeArray[] = {SEEK_SET, SEEK_CUR, SEEK_END}; @@ -841,7 +841,7 @@ Tcl_ExecObjCmd( Tcl_Channel chan; int argc, background, i, index, keepNewline, result, skip, length; int ignoreStderr; - static const char *options[] = { + static const char *const options[] = { "-ignorestderr", "-keepnewline", "--", NULL }; enum options { @@ -1418,7 +1418,7 @@ Tcl_SocketObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - static const char *socketOptions[] = { + static const char *const socketOptions[] = { "-async", "-myaddr", "-myport","-server", NULL }; enum socketOptions { @@ -1600,7 +1600,7 @@ Tcl_FcopyObjCmd( Tcl_Channel inChan, outChan; int mode, i, toRead, index; Tcl_Obj *cmdPtr; - static const char* switches[] = { "-size", "-command", NULL }; + static const char *const switches[] = { "-size", "-command", NULL }; enum { FcopySize, FcopyCommand }; if ((objc < 3) || (objc > 7) || (objc == 4) || (objc == 6)) { @@ -1691,7 +1691,7 @@ ChanPendingObjCmd( { Tcl_Channel chan; int index, mode; - static const char *options[] = {"input", "output", NULL}; + static const char *const options[] = {"input", "output", NULL}; enum options {PENDING_INPUT, PENDING_OUTPUT}; if (objc != 3) { @@ -1900,7 +1900,7 @@ TclInitChanCmd( {"truncate", ChanTruncateObjCmd}, /* TIP #208 */ {NULL} }; - static const char *extras[] = { + static const char *const extras[] = { "configure", "::fconfigure", "names", "::file channels", NULL diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index a30469b..679f393 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.34 2008/07/03 17:38:38 andreas_kupries Exp $ + * RCS: @(#) $Id: tclIORChan.c,v 1.35 2008/10/16 22:34:19 nijtmans Exp $ */ #include <tclInt.h> @@ -161,7 +161,7 @@ typedef struct { * Event literals. ================================================== */ -static const char *eventOptions[] = { +static const char *const eventOptions[] = { "read", "write", NULL }; typedef enum { @@ -172,7 +172,7 @@ typedef enum { * Method literals. ================================================== */ -static const char *methodNames[] = { +static const char *const methodNames[] = { "blocking", /* OPT */ "cget", /* OPT \/ Together or none */ "cgetall", /* OPT /\ of these two */ @@ -2737,12 +2737,12 @@ ForwardProc( */ rcmPtr = GetReflectedChannelMap(interp); - hPtr = Tcl_FindHashEntry(&rcmPtr->map, + hPtr = Tcl_FindHashEntry(&rcmPtr->map, Tcl_GetChannelName(rcPtr->chan)); Tcl_DeleteHashEntry(hPtr); rcmPtr = GetThreadReflectedChannelMap(); - hPtr = Tcl_FindHashEntry(&rcmPtr->map, + hPtr = Tcl_FindHashEntry(&rcmPtr->map, Tcl_GetChannelName(rcPtr->chan)); Tcl_DeleteHashEntry(hPtr); diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index 89af0d5..bb7aebd 100644 --- a/generic/tclIORTrans.c +++ b/generic/tclIORTrans.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: tclIORTrans.c,v 1.3 2008/06/12 06:28:41 das Exp $ + * RCS: @(#) $Id: tclIORTrans.c,v 1.4 2008/10/16 22:34:19 nijtmans Exp $ */ #include <tclInt.h> @@ -187,7 +187,7 @@ typedef struct { * Method literals. ================================================== */ -static const char *methodNames[] = { +static const char *const methodNames[] = { "clear", /* OPT */ "drain", /* OPT, drain => read */ "finalize", /* */ @@ -987,7 +987,7 @@ ReflectClose( */ rtmPtr = GetReflectedTransformMap(interp); - hPtr = Tcl_FindHashEntry (&rtmPtr->map, + hPtr = Tcl_FindHashEntry (&rtmPtr->map, Tcl_GetString(rtPtr->handle)); if (hPtr) { Tcl_DeleteHashEntry (hPtr); @@ -998,9 +998,9 @@ ReflectClose( * allow us to survive if the script level pulls the rug out under a * channel by deleting the owning thread. */ - + rtmPtr = GetThreadReflectedTransformMap(); - hPtr = Tcl_FindHashEntry (&rtmPtr->map, + hPtr = Tcl_FindHashEntry (&rtmPtr->map, Tcl_GetString(rtPtr->handle)); if (hPtr) { Tcl_DeleteHashEntry (hPtr); @@ -1120,7 +1120,7 @@ ReflectInput( } *errorCodePtr = Tcl_GetErrno (); - return -1; + return -1; } if (read == 0) { @@ -1490,7 +1490,7 @@ ReflectSetOption( * level is not involved there is no need for thread forwarding. */ - Tcl_DriverSetOptionProc *setOptionProc = + Tcl_DriverSetOptionProc *setOptionProc = Tcl_ChannelSetOptionProc (Tcl_GetChannelType (rtPtr->parent)); if (setOptionProc != NULL) { @@ -1537,7 +1537,7 @@ ReflectGetOption( * specific option has to fail. */ - Tcl_DriverGetOptionProc *getOptionProc = + Tcl_DriverGetOptionProc *getOptionProc = Tcl_ChannelGetOptionProc (Tcl_GetChannelType (rtPtr->parent)); if (getOptionProc != NULL) { @@ -1725,7 +1725,7 @@ NewReflectedTransform( rtPtr->timer = (Tcl_TimerToken) NULL; rtPtr->mode = 0; rtPtr->readIsDrained = 0; - rtPtr->nonblocking = + rtPtr->nonblocking = (((Channel*) parentChan)->state->flags & CHANNEL_NONBLOCKING); /* Query parent for current blocking mode. */ @@ -2489,7 +2489,7 @@ ForwardProc( */ rtmPtr = GetReflectedTransformMap (interp); - hPtr = Tcl_FindHashEntry (&rtmPtr->map, + hPtr = Tcl_FindHashEntry (&rtmPtr->map, Tcl_GetString(rtPtr->handle)); Tcl_DeleteHashEntry (hPtr); @@ -2500,7 +2500,7 @@ ForwardProc( */ rtmPtr = GetThreadReflectedTransformMap(); - hPtr = Tcl_FindHashEntry (&rtmPtr->map, + hPtr = Tcl_FindHashEntry (&rtmPtr->map, Tcl_GetString(rtPtr->handle)); Tcl_DeleteHashEntry (hPtr); FreeReflectedTransform(rtPtr); diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 4f15134..84cc8d1 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.96 2008/08/03 17:33:12 msofer Exp $ + * RCS: @(#) $Id: tclInterp.c,v 1.97 2008/10/16 22:34:18 nijtmans Exp $ */ #include "tclInt.h" @@ -559,7 +559,7 @@ Tcl_InterpObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { int index; - static const char *options[] = { + static const char *const options[] = { "alias", "aliases", "bgerror", "cancel", "create", "delete", "eval", "exists", "expose", "hide", "hidden", "issafe", @@ -645,7 +645,7 @@ Tcl_InterpObjCmd( int i, flags; Tcl_Interp *slaveInterp; Tcl_Obj *resultObjPtr; - static const char *options[] = { + static const char *const options[] = { "-unwind", "--", NULL }; enum option { @@ -686,7 +686,7 @@ Tcl_InterpObjCmd( /* * Did they specify a slave interp to cancel the script in - * progress in? If not, use the current interp. + * progress in? If not, use the current interp. */ if (i < objc) { @@ -714,7 +714,7 @@ Tcl_InterpObjCmd( int i, last, safe; Tcl_Obj *slavePtr; char buf[16 + TCL_INTEGER_SPACE]; - static const char *options[] = { + static const char *const options[] = { "-safe", "--", NULL }; enum option { @@ -876,7 +876,7 @@ Tcl_InterpObjCmd( int i, index; const char *namespaceName; Tcl_Interp *slaveInterp; - static const char *hiddenOptions[] = { + static const char *const hiddenOptions[] = { "-global", "-namespace", "--", NULL }; enum hiddenOption { @@ -919,7 +919,7 @@ Tcl_InterpObjCmd( } case OPT_LIMIT: { Tcl_Interp *slaveInterp; - static const char *limitTypes[] = { + static const char *const limitTypes[] = { "commands", "time", NULL }; enum LimitTypes { @@ -1487,7 +1487,7 @@ AliasCreate( if (slaveInterp == masterInterp) { aliasPtr->slaveCmd = Tcl_NRCreateCommand(slaveInterp, - TclGetString(namePtr), AliasObjCmd, AliasNRCmd, aliasPtr, + TclGetString(namePtr), AliasObjCmd, AliasNRCmd, aliasPtr, AliasObjCmdDeleteProc); } else { aliasPtr->slaveCmd = Tcl_CreateObjCommand(slaveInterp, @@ -1762,7 +1762,7 @@ AliasNRCmd( Tcl_Obj *listPtr; List *listRep; int flags = TCL_EVAL_INVOKE; - + /* * Append the arguments to the command prefix and invoke the command in * the target interp's global namespace. @@ -1776,7 +1776,7 @@ AliasNRCmd( listRep = listPtr->internalRep.twoPtrValue.ptr1; listRep->elemCount = cmdc; cmdv = &listRep->elements; - + prefv = &aliasPtr->objPtr; memcpy(cmdv, prefv, (size_t) (prefc * sizeof(Tcl_Obj *))); memcpy(cmdv+prefc, objv+1, (size_t) ((objc-1) * sizeof(Tcl_Obj *))); @@ -2368,7 +2368,7 @@ SlaveObjCmd( { Tcl_Interp *slaveInterp = clientData; int index; - static const char *options[] = { + static const char *const options[] = { "alias", "aliases", "bgerror", "eval", "expose", "hide", "hidden", "issafe", "invokehidden", "limit", "marktrusted", "recursionlimit", NULL @@ -2455,7 +2455,7 @@ SlaveObjCmd( case OPT_INVOKEHIDDEN: { int i, index; const char *namespaceName; - static const char *hiddenOptions[] = { + static const char *const hiddenOptions[] = { "-global", "-namespace", "--", NULL }; enum hiddenOption { @@ -2493,7 +2493,7 @@ SlaveObjCmd( objc - i, objv + i); } case OPT_LIMIT: { - static const char *limitTypes[] = { + static const char *const limitTypes[] = { "commands", "time", NULL }; enum LimitTypes { @@ -2617,7 +2617,7 @@ SlaveEval( * * Do not let any intReps accross, with the exception of * bytecodes. The intrep spoiling is due to happen anyway when - * compiling. + * compiling. */ Interp *iPtr = (Interp *) interp; @@ -2634,7 +2634,7 @@ SlaveEval( } TclArgumentGet (interp, objPtr, &invoker, &word); - + result = TclEvalObjEx(slaveInterp, objPtr, 0, invoker, word); } else { objPtr = Tcl_ConcatObj(objc, objv); @@ -4152,7 +4152,7 @@ SlaveCommandLimitCmd( int objc, /* Total number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - static const char *options[] = { + static const char *const options[] = { "-command", "-granularity", "-value", NULL }; enum Options { @@ -4323,7 +4323,7 @@ SlaveTimeLimitCmd( int objc, /* Total number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - static const char *options[] = { + static const char *const options[] = { "-command", "-granularity", "-milliseconds", "-seconds", NULL }; enum Options { diff --git a/generic/tclLoad.c b/generic/tclLoad.c index 479c1fb..36a61b0 100644 --- a/generic/tclLoad.c +++ b/generic/tclLoad.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: tclLoad.c,v 1.19 2008/10/04 12:54:14 nijtmans Exp $ + * RCS: @(#) $Id: tclLoad.c,v 1.20 2008/10/16 22:34:18 nijtmans Exp $ */ #include "tclInt.h" @@ -506,7 +506,7 @@ Tcl_UnloadObjCmd( int trustedRefCount = -1, safeRefCount = -1; const char *fullFileName = ""; char *packageName; - static const char *options[] = { + static const char *const options[] = { "-nocomplain", "-keeplibrary", "--", NULL }; enum options { diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c index 2d224dd..cbece15 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.12 2008/10/04 12:00:25 dkf Exp $ + * RCS: @(#) $Id: tclOOBasic.c,v 1.13 2008/10/16 22:34:18 nijtmans Exp $ */ #ifdef HAVE_CONFIG_H @@ -688,7 +688,7 @@ TclOOSelfObjCmd( int objc, Tcl_Obj *const *objv) { - static const char *subcmds[] = { + static const char *const subcmds[] = { "caller", "class", "filter", "method", "namespace", "next", "object", "target", NULL }; diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index 8c6c15b..c4b9ab2 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.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: tclOOCall.c,v 1.12 2008/09/25 10:15:04 dkf Exp $ + * RCS: @(#) $Id: tclOOCall.c,v 1.13 2008/10/16 22:34:18 nijtmans Exp $ */ #ifdef HAVE_CONFIG_H @@ -81,7 +81,7 @@ static inline void StashCallChain(Tcl_Obj *objPtr, CallChain *callPtr); * Object type used to manage type caches attached to method names. */ -static Tcl_ObjType methodNameType = { +static const Tcl_ObjType methodNameType = { "TclOO method name", FreeMethodNameRep, DupMethodNameRep, diff --git a/generic/tclOOInfo.c b/generic/tclOOInfo.c index d994e94..583907b 100644 --- a/generic/tclOOInfo.c +++ b/generic/tclOOInfo.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: tclOOInfo.c,v 1.9 2008/10/13 21:10:43 dkf Exp $ + * RCS: @(#) $Id: tclOOInfo.c,v 1.10 2008/10/16 22:34:18 nijtmans Exp $ */ #ifdef HAVE_CONFIG_H @@ -415,7 +415,7 @@ InfoObjectIsACmd( int objc, Tcl_Obj *const objv[]) { - static const char *categories[] = { + static const char *const categories[] = { "class", "metaclass", "mixin", "object", "typeof", NULL }; enum IsACats { @@ -540,7 +540,7 @@ InfoObjectMethodsCmd( FOREACH_HASH_DECLS; Tcl_Obj *namePtr, *resultObj; Method *mPtr; - static const char *options[] = { + static const char *const options[] = { "-all", "-localprivate", "-private", NULL }; enum Options { @@ -1058,7 +1058,7 @@ InfoClassMethodsCmd( Tcl_Obj *namePtr, *resultObj; Method *mPtr; Class *clsPtr; - static const char *options[] = { + static const char *const options[] = { "-all", "-localprivate", "-private", NULL }; enum Options { diff --git a/generic/tclObj.c b/generic/tclObj.c index a92ea7e..c5fef11 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.143 2008/10/15 06:17:03 nijtmans Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.144 2008/10/16 22:34:19 nijtmans Exp $ */ #include "tclInt.h" @@ -2227,7 +2227,7 @@ Tcl_GetLongFromObj( tooLarge: #endif if (interp != NULL) { - char *s = "integer value too large to represent"; + const char *s = "integer value too large to represent"; Tcl_Obj *msg = Tcl_NewStringObj(s, -1); Tcl_SetObjResult(interp, msg); @@ -2526,7 +2526,7 @@ Tcl_GetWideIntFromObj( } } if (interp != NULL) { - char *s = "integer value too large to represent"; + const char *s = "integer value too large to represent"; Tcl_Obj *msg = Tcl_NewStringObj(s, -1); Tcl_SetObjResult(interp, msg); diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 1ac1496..3839429 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.73 2008/07/28 21:31:19 nijtmans Exp $ + * RCS: @(#) $Id: tclPathObj.c,v 1.74 2008/10/16 22:34:19 nijtmans Exp $ */ #include "tclInt.h" @@ -34,7 +34,7 @@ static Tcl_Obj * GetExtension(Tcl_Obj *pathPtr); * internally. */ -static Tcl_ObjType tclFsPathType = { +static const Tcl_ObjType tclFsPathType = { "path", /* name */ FreeFsPathInternalRep, /* freeIntRepProc */ DupFsPathInternalRep, /* dupIntRepProc */ diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 346d113..558ccd9 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.37 2008/07/19 22:50:39 nijtmans Exp $ + * RCS: @(#) $Id: tclPkg.c,v 1.38 2008/10/16 22:34:18 nijtmans Exp $ * * TIP #268. * Heavily rewritten to handle the extend version numbers, and extended @@ -742,7 +742,7 @@ Tcl_PackageObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - static const char *pkgOptions[] = { + static const char *const pkgOptions[] = { "forget", "ifneeded", "names", "prefer", "present", "provide", "require", "unknown", "vcompare", "versions", "vsatisfies", NULL @@ -1015,7 +1015,7 @@ Tcl_PackageObjCmd( break; } case PKG_PREFER: { - static const char *pkgPreferOptions[] = { + static const char *const pkgPreferOptions[] = { "latest", "stable", NULL }; diff --git a/generic/tclResult.c b/generic/tclResult.c index b91d6ef..b0a8836 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.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: tclResult.c,v 1.49 2008/10/02 20:59:45 dgp Exp $ + * RCS: @(#) $Id: tclResult.c,v 1.50 2008/10/16 22:34:19 nijtmans Exp $ */ #include "tclInt.h" @@ -1336,7 +1336,7 @@ TclMergeReturnOptions( Tcl_DictObjGet(NULL, returnOpts, keys[KEY_CODE], &valuePtr); if ((valuePtr != NULL) && (TCL_ERROR == TclGetIntFromObj(NULL, valuePtr, &code))) { - static const char *returnCodes[] = { + static const char *const returnCodes[] = { "ok", "error", "return", "break", "continue", NULL }; diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 4a7d0f4..b017347 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.72 2008/10/15 06:17:04 nijtmans Exp $ */ + * RCS: @(#) $Id: tclStringObj.c,v 1.73 2008/10/16 22:34:19 nijtmans Exp $ */ #include "tclInt.h" #include "tommath.h" @@ -1702,7 +1702,7 @@ Tcl_AppendFormatToObj( int originalLength; static const char *mixedXPG = "cannot mix \"%\" and \"%n$\" conversion specifiers"; - static const char *badIndex[2] = { + static const char *const badIndex[2] = { "not enough arguments for all format specifiers", "\"%n$\" argument index out of range" }; diff --git a/generic/tclTest.c b/generic/tclTest.c index 74d255e..1ddfb5f 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.127 2008/10/13 22:05:59 patthoyts Exp $ + * RCS: @(#) $Id: tclTest.c,v 1.128 2008/10/16 22:34:19 nijtmans Exp $ */ #define TCL_TEST @@ -527,7 +527,7 @@ Tcltest_Init( Tcl_Obj *listPtr; Tcl_Obj **objv; int objc, index; - static const char *specialOptions[] = { + static const char *const specialOptions[] = { "-appinitprocerror", "-appinitprocdeleteinterp", "-appinitprocclosestderr", "-appinitprocsetrcfile", NULL }; @@ -1726,7 +1726,7 @@ TestencodingObjCmd( int index, length; char *string; TclEncoding *encodingPtr; - static const char *optionStrings[] = { + static const char *const optionStrings[] = { "create", "delete", NULL }; enum options { @@ -1974,11 +1974,11 @@ TesteventObjCmd( int objc, /* Parameter count */ Tcl_Obj *const objv[]) /* Parameter vector */ { - static const char *subcommands[] = { /* Possible subcommands */ + static const char *const subcommands[] = { /* Possible subcommands */ "queue", "delete", NULL }; int subCmdIndex; /* Index of the chosen subcommand */ - static const char *positions[] = { /* Possible queue positions */ + static const char *const positions[] = { /* Possible queue positions */ "head", "tail", "mark", NULL }; int posIndex; /* Index of the chosen position */ @@ -2529,7 +2529,7 @@ TestgetplatformCmd( int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { - static const char *platformStrings[] = { "unix", "mac", "windows" }; + static const char *const platformStrings[] = { "unix", "mac", "windows" }; TclPlatformType *platform; platform = TclGetPlatform(); @@ -3082,7 +3082,7 @@ TestlocaleCmd( int index; char *locale; - static const char *optionStrings[] = { + static const char *const optionStrings[] = { "ctype", "numeric", "time", "collate", "monetary", "all", NULL }; @@ -3421,7 +3421,7 @@ PrintParse( Tcl_Parse *parsePtr) /* Parse structure to print out. */ { Tcl_Obj *objPtr; - char *typeString; + const char *typeString; Tcl_Token *tokenPtr; int i; @@ -3619,7 +3619,7 @@ TestregexpObjCmd( char *string; Tcl_Obj *objPtr; Tcl_RegExpInfo info; - static const char *options[] = { + static const char *const options[] = { "-indices", "-nocase", "-about", "-expanded", "-line", "-linestop", "-lineanchor", "-xflags", @@ -4852,7 +4852,7 @@ TestsaveresultCmd( int discard, result, index; Tcl_SavedResult state; Tcl_Obj *objPtr; - static const char *optionStrings[] = { + static const char *const optionStrings[] = { "append", "dynamic", "free", "object", "small", NULL }; enum options { @@ -5836,7 +5836,7 @@ TestGetIndexFromObjStructObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - char *ary[] = { + const char *const ary[] = { "a", "b", "c", "d", "e", "f", NULL, NULL }; int idx,target; @@ -5891,7 +5891,7 @@ TestFilesystemObjCmd( Tcl_Obj *const objv[]) { int res, boolVal; - char *msg; + const char *msg; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "boolean"); @@ -6263,7 +6263,7 @@ TestSimpleFilesystemObjCmd( Tcl_Obj *const objv[]) { int res, boolVal; - char *msg; + const char *msg; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "boolean"); @@ -6445,7 +6445,7 @@ TestHashSystemHashCmd( int objc, Tcl_Obj *const objv[]) { - static Tcl_HashKeyType hkType = { + static const Tcl_HashKeyType hkType = { TCL_HASH_KEY_TYPE_VERSION, TCL_HASH_KEY_SYSTEM_HASH, NULL, NULL, NULL, NULL }; @@ -6553,11 +6553,11 @@ TestNRELevels( Tcl_Obj *levels[6]; int i = 0; TEOV_callback *cbPtr = ((Interp *) interp)->execEnvPtr->callbackPtr; - + if (refDepth == NULL) { refDepth = &depth; } - + depth = (refDepth - &depth); levels[0] = Tcl_NewIntObj(depth); @@ -6572,7 +6572,7 @@ TestNRELevels( cbPtr = cbPtr->nextPtr; } levels[5] = Tcl_NewIntObj(i); - + Tcl_SetObjResult(interp, Tcl_NewListObj(6, levels)); return TCL_OK; } @@ -6611,19 +6611,19 @@ TestconcatobjCmd( * Set the start of the error message as obj result; it will be cleared at * the end if no errors were found. */ - + Tcl_SetObjResult(interp, Tcl_NewStringObj("Tcl_ConcatObj is unsafe:", -1)); - + emptyPtr = Tcl_NewObj(); - + list1Ptr = Tcl_NewStringObj("foo bar sum", -1); Tcl_ListObjLength(NULL, list1Ptr, &len); if (list1Ptr->bytes != NULL) { ckfree(list1Ptr->bytes); list1Ptr->bytes = NULL; } - + list2Ptr = Tcl_NewStringObj("eeny meeny", -1); Tcl_ListObjLength(NULL, list2Ptr, &len); if (list2Ptr->bytes != NULL) { @@ -6637,7 +6637,7 @@ TestconcatobjCmd( */ tmpPtr = Tcl_DuplicateObj(list1Ptr); - + objv[0] = tmpPtr; objv[1] = emptyPtr; concatPtr = Tcl_ConcatObj(2, objv); @@ -6721,7 +6721,7 @@ TestconcatobjCmd( objv[1] = tmpPtr; } Tcl_DecrRefCount(concatPtr); - + Tcl_IncrRefCount(tmpPtr); concatPtr = Tcl_ConcatObj(3, objv); if (concatPtr->refCount != 0) { @@ -6766,7 +6766,7 @@ TestconcatobjCmd( } if (concatPtr == tmpPtr) { int len; - + result = TCL_ERROR; Tcl_AppendResult(interp, "\n\t* (e) concatObj is not a new obj ", NULL); @@ -6781,7 +6781,7 @@ TestconcatobjCmd( if (Tcl_IsShared(tmpPtr)) { Tcl_DecrRefCount(tmpPtr); } - tmpPtr = Tcl_DuplicateObj(list1Ptr); + tmpPtr = Tcl_DuplicateObj(list1Ptr); objv[0] = tmpPtr; } Tcl_DecrRefCount(concatPtr); @@ -6796,7 +6796,7 @@ TestconcatobjCmd( } if (concatPtr == tmpPtr) { int len; - + result = TCL_ERROR; Tcl_AppendResult(interp, "\n\t* (f) concatObj is not a new obj ", NULL); @@ -6811,7 +6811,7 @@ TestconcatobjCmd( if (Tcl_IsShared(tmpPtr)) { Tcl_DecrRefCount(tmpPtr); } - tmpPtr = Tcl_DuplicateObj(list1Ptr); + tmpPtr = Tcl_DuplicateObj(list1Ptr); objv[0] = tmpPtr; } Tcl_DecrRefCount(concatPtr); @@ -6827,7 +6827,7 @@ TestconcatobjCmd( } if (concatPtr == tmpPtr) { int len; - + result = TCL_ERROR; Tcl_AppendResult(interp, "\n\t* (g) concatObj is not a new obj ", NULL); @@ -6843,7 +6843,7 @@ TestconcatobjCmd( if (Tcl_IsShared(tmpPtr)) { Tcl_DecrRefCount(tmpPtr); } - tmpPtr = Tcl_DuplicateObj(list1Ptr); + tmpPtr = Tcl_DuplicateObj(list1Ptr); objv[0] = tmpPtr; } Tcl_DecrRefCount(concatPtr); diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index c0d4f17..842cbd0 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.24 2008/07/27 22:18:23 nijtmans Exp $ + * RCS: @(#) $Id: tclTestObj.c,v 1.25 2008/10/16 22:34:19 nijtmans Exp $ */ #include "tclInt.h" @@ -129,7 +129,7 @@ TestbignumobjCmd( int objc, /* Argument count */ Tcl_Obj *const objv[]) /* Argument vector */ { - const char * subcmds[] = { + const char *const subcmds[] = { "set", "get", "mult10", "div10", NULL }; enum options { @@ -496,7 +496,7 @@ TestindexobjCmd( { int allowAbbrev, index, index2, setError, i, result; const char **argv; - static const char *tablePtr[] = {"a", "b", "check", NULL}; + static const char *const tablePtr[] = {"a", "b", "check", NULL}; /* * Keep this structure declaration in sync with tclIndexObj.c */ @@ -996,7 +996,7 @@ TeststringobjCmd( #define MAX_STRINGS 11 char *index, *string, *strings[MAX_STRINGS+1]; TestString *strPtr; - static const char *options[] = { + static const char *const options[] = { "append", "appendstrings", "get", "get2", "length", "length2", "set", "set2", "setlength", "ualloc", "getunicode", NULL }; diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index 74398fe..eb3b855 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.26 2008/07/19 22:50:42 nijtmans Exp $ + * RCS: @(#) $Id: tclThreadTest.c,v 1.27 2008/10/16 22:34:19 nijtmans Exp $ */ #include "tclInt.h" @@ -219,7 +219,7 @@ Tcl_ThreadObjCmd( { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); int option; - static const char *threadOptions[] = { + static const char *const threadOptions[] = { "cancel", "create", "event", "exit", "id", "join", "names", "send", "wait", "errorproc", NULL @@ -984,7 +984,7 @@ TclThreadCancel( } /* - * Since Tcl_CancelEval can be safely called from any thread, + * Since Tcl_CancelEval can be safely called from any thread, * we do it now. */ diff --git a/generic/tclTimer.c b/generic/tclTimer.c index 704d2bb..1e1fd73 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.34 2008/07/19 22:50:42 nijtmans Exp $ + * RCS: @(#) $Id: tclTimer.c,v 1.35 2008/10/16 22:34:19 nijtmans Exp $ */ #include "tclInt.h" @@ -786,7 +786,7 @@ Tcl_AfterObjCmd( int length; int index; char buf[16 + TCL_INTEGER_SPACE]; - static const char *afterSubCmds[] = { + static const char *const afterSubCmds[] = { "cancel", "idle", "info", NULL }; enum afterSubCmds {AFTER_CANCEL, AFTER_IDLE, AFTER_INFO}; @@ -820,7 +820,7 @@ Tcl_AfterObjCmd( || objv[1]->typePtr == &tclWideIntType #endif || objv[1]->typePtr == &tclBignumType - || ( Tcl_GetIndexFromObj(NULL, objv[1], afterSubCmds, "", 0, + || ( Tcl_GetIndexFromObj(NULL, objv[1], afterSubCmds, "", 0, &index) != TCL_OK )) { index = -1; if (Tcl_GetWideIntFromObj(NULL, objv[1], &ms) != TCL_OK) { @@ -832,7 +832,7 @@ Tcl_AfterObjCmd( } } - /* + /* * At this point, either index = -1 and ms contains the number of ms * to wait, or else index is the index of a subcommand. */ diff --git a/generic/tclTrace.c b/generic/tclTrace.c index 6386f29..7876eab 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.52 2008/10/08 14:50:57 dgp Exp $ + * RCS: @(#) $Id: tclTrace.c,v 1.53 2008/10/16 22:34:19 nijtmans Exp $ */ #include "tclInt.h" @@ -109,7 +109,7 @@ static Tcl_TraceTypeObjCmd TraceExecutionObjCmd; * add to the list of supported trace types. */ -static const char *traceTypeOptions[] = { +static const char *const traceTypeOptions[] = { "execution", "command", "variable", NULL }; static Tcl_TraceTypeObjCmd *const traceSubCmds[] = { @@ -195,7 +195,7 @@ Tcl_TraceObjCmd( int optionIndex; char *name, *flagOps, *p; /* Main sub commands to 'trace' */ - static const char *traceOptions[] = { + static const char *const traceOptions[] = { "add", "info", "remove", #ifndef TCL_REMOVE_OBSOLETE_TRACES "variable", "vdelete", "vinfo", @@ -404,7 +404,7 @@ TraceExecutionObjCmd( enum traceOptions { TRACE_ADD, TRACE_INFO, TRACE_REMOVE }; - static const char *opStrings[] = { + static const char *const opStrings[] = { "enter", "leave", "enterstep", "leavestep", NULL }; enum operations { @@ -651,7 +651,7 @@ TraceCommandObjCmd( char *name, *command; size_t length; enum traceOptions { TRACE_ADD, TRACE_INFO, TRACE_REMOVE }; - static const char *opStrings[] = { "delete", "rename", NULL }; + static const char *const opStrings[] = { "delete", "rename", NULL }; enum operations { TRACE_CMD_DELETE, TRACE_CMD_RENAME }; switch ((enum traceOptions) optionIndex) { @@ -843,7 +843,7 @@ TraceVariableObjCmd( char *name, *command; size_t length; enum traceOptions { TRACE_ADD, TRACE_INFO, TRACE_REMOVE }; - static const char *opStrings[] = { + static const char *const opStrings[] = { "array", "read", "unset", "write", NULL }; enum operations { @@ -1948,7 +1948,7 @@ TraceVarProc( int code, destroy = 0; Tcl_DString cmd; int rewind = ((Interp *)interp)->execEnvPtr->rewind; - + /* * We might call Tcl_Eval() below, and that might evaluate [trace vdelete] * which might try to free tvarPtr. We want to use tvarPtr until the end diff --git a/macosx/tclMacOSXFCmd.c b/macosx/tclMacOSXFCmd.c index d230f4a..31245f1 100644 --- a/macosx/tclMacOSXFCmd.c +++ b/macosx/tclMacOSXFCmd.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: tclMacOSXFCmd.c,v 1.13 2008/04/27 22:21:33 dkf Exp $ + * RCS: @(#) $Id: tclMacOSXFCmd.c,v 1.14 2008/10/16 22:34:19 nijtmans Exp $ */ #include "tclInt.h" @@ -74,7 +74,7 @@ static Tcl_Obj * NewOSTypeObj(const OSType newOSType); static int SetOSTypeFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static void UpdateStringOfOSType(Tcl_Obj *objPtr); -static Tcl_ObjType tclOSTypeType = { +static const Tcl_ObjType tclOSTypeType = { "osType", /* name */ NULL, /* freeIntRepProc */ NULL, /* dupIntRepProc */ @@ -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: cat.c,v 1.3 2005/11/04 00:06:49 dkf Exp $ + * RCS: @(#) $Id: cat.c,v 1.4 2008/10/16 22:34:19 nijtmans Exp $ */ #include <stdio.h> @@ -20,7 +20,7 @@ main(void) { char buf[1024]; int n; - char *err; + const char *err; while (1) { n = read(0, buf, sizeof(buf)); diff --git a/win/tclWinInit.c b/win/tclWinInit.c index d47b2cb..70170fe 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.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: tclWinInit.c,v 1.78 2008/10/14 22:43:30 nijtmans Exp $ + * RCS: @(#) $Id: tclWinInit.c,v 1.79 2008/10/16 22:34:19 nijtmans Exp $ */ #include "tclWinInt.h" @@ -85,12 +85,12 @@ typedef struct { #define NUMPLATFORMS 4 -static const char *platforms[NUMPLATFORMS] = { +static const char *const platforms[NUMPLATFORMS] = { "Win32s", "Windows 95", "Windows NT", "Windows CE" }; #define NUMPROCESSORS 11 -static const char *processors[NUMPROCESSORS] = { +static const char *const processors[NUMPROCESSORS] = { "intel", "mips", "alpha", "ppc", "shx", "arm", "ia64", "alpha64", "msil", "amd64", "ia32_on_win64" }; diff --git a/win/tclWinTest.c b/win/tclWinTest.c index eb2ccf8..29e4974 100644 --- a/win/tclWinTest.c +++ b/win/tclWinTest.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: tclWinTest.c,v 1.23 2008/07/19 22:16:57 nijtmans Exp $ + * RCS: @(#) $Id: tclWinTest.c,v 1.24 2008/10/16 22:34:19 nijtmans Exp $ */ #include "tclInt.h" @@ -421,7 +421,7 @@ TestExceptionCmd( int objc, /* Argument count */ Tcl_Obj *const objv[]) /* Argument vector */ { - static const char *cmds[] = { + static const char *const cmds[] = { "access_violation", "datatype_misalignment", "array_bounds", "float_denormal", "float_divbyzero", "float_inexact", "float_invalidop", "float_overflow", "float_stack", "float_underflow", |