From bb146c387f42e478b1d8ffbc8617988fb572587c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 18 Apr 2012 21:38:50 +0000 Subject: make some more internal tables CONST fix compilation with -DNO_CONST --- generic/regerror.c | 2 +- generic/tclBasic.c | 8 ++++---- generic/tclBinary.c | 2 +- generic/tclEncoding.c | 2 +- generic/tclExecute.c | 8 ++++---- generic/tclFileName.c | 2 +- generic/tclParseExpr.c | 2 +- generic/tclPkg.c | 10 +++++----- generic/tclStringObj.c | 2 +- generic/tclStubInit.c | 2 +- generic/tclTestProcBodyObj.c | 12 ++++++------ 11 files changed, 26 insertions(+), 26 deletions(-) diff --git a/generic/regerror.c b/generic/regerror.c index 182830d..6376e80 100644 --- a/generic/regerror.c +++ b/generic/regerror.c @@ -32,7 +32,7 @@ #include "regguts.h" /* unknown-error explanation */ -static char unk[] = "*** unknown regex error code 0x%x ***"; +static CONST char unk[] = "*** unknown regex error code 0x%x ***"; /* struct to map among codes, code names, and explanations */ static struct rerr { diff --git a/generic/tclBasic.c b/generic/tclBasic.c index c5c914e..c738916 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -64,7 +64,7 @@ extern TclStubs tclStubs; */ typedef struct { - char *name; /* Name of object-based command. */ + CONST char *name; /* Name of object-based command. */ Tcl_CmdProc *proc; /* String-based procedure for command. */ Tcl_ObjCmdProc *objProc; /* Object-based procedure for command. */ CompileProc *compileProc; /* Procedure called to compile command. */ @@ -77,7 +77,7 @@ typedef struct { * The built-in commands, and the procedures that implement them: */ -static CmdInfo builtInCmds[] = { +static CONST CmdInfo builtInCmds[] = { /* * Commands in the generic core. Note that at least one of the proc or * objProc members should be non-NULL. This avoids infinitely recursive @@ -304,7 +304,7 @@ Tcl_CreateInterp() BuiltinFunc *builtinFuncPtr; MathFunc *mathFuncPtr; Tcl_HashEntry *hPtr; - CmdInfo *cmdInfoPtr; + CONST CmdInfo *cmdInfoPtr; int i; union { char c[sizeof(short)]; @@ -664,7 +664,7 @@ int TclHideUnsafeCommands(interp) Tcl_Interp *interp; /* Hide commands in this interpreter. */ { - register CmdInfo *cmdInfoPtr; + register CONST CmdInfo *cmdInfoPtr; if (interp == (Tcl_Interp *) NULL) { return TCL_ERROR; diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 8d258b3..8eb3ac3 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -1160,7 +1160,7 @@ Tcl_BinaryObjCmd(dummy, interp, objc, objv) char *dest; unsigned char *src; int i; - static char hexdigit[] = "0123456789abcdef"; + static CONST char hexdigit[] = "0123456789abcdef"; if (arg >= objc) { DeleteScanNumberCache(numberCachePtr); diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index a4a7027..73c4067 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -1462,7 +1462,7 @@ LoadTableEncoding(interp, name, type, chan) * sequences in the encoding files. */ - static char staticHex[] = { + static CONST char staticHex[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0 ... 15 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 16 ... 31 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 32 ... 47 */ diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 1c9d99d..9f01cbb 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -87,7 +87,7 @@ int tclTraceExec = 0; * expression opcodes (e.g., INST_LOR) in tclCompile.h. */ -static char *operatorStrings[] = { +static CONST char *CONST operatorStrings[] = { "||", "&&", "|", "^", "&", "==", "!=", "<", ">", "<=", ">=", "<<", ">>", "+", "-", "*", "/", "%", "+", "-", "~", "!", "BUILTIN FUNCTION", "FUNCTION", @@ -100,7 +100,7 @@ static char *operatorStrings[] = { */ #ifdef TCL_COMPILE_DEBUG -static char *resultStrings[] = { +static CONST char *CONST resultStrings[] = { "TCL_OK", "TCL_ERROR", "TCL_RETURN", "TCL_BREAK", "TCL_CONTINUE" }; #endif @@ -397,7 +397,7 @@ static void InitByteCodeExecution _ANSI_ARGS_(( Tcl_Interp *interp)); #ifdef TCL_COMPILE_DEBUG static void PrintByteCodeInfo _ANSI_ARGS_((ByteCode *codePtr)); -static char * StringForResultCode _ANSI_ARGS_((int result)); +static CONST char * StringForResultCode _ANSI_ARGS_((int result)); static void ValidatePcAndStackTop _ANSI_ARGS_(( ByteCode *codePtr, unsigned char *pc, int stackTop, int stackLowerBound)); @@ -6564,7 +6564,7 @@ EvalStatsCmd(unused, interp, objc, objv) *---------------------------------------------------------------------- */ -static char * +static CONST char * StringForResultCode(result) int result; /* The Tcl result code for which to * generate a string. */ diff --git a/generic/tclFileName.c b/generic/tclFileName.c index c70bed5..761c8be 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -2591,7 +2591,7 @@ TclDoGlob(interp, separators, headPtr, tail, types) Tcl_ListObjLength(NULL, paths, &end); while (repair < end) { - const char *bytes; + CONST char *bytes; int numBytes; Tcl_Obj *fixme, *newObj; Tcl_ListObjIndex(NULL, paths, repair, &fixme); diff --git a/generic/tclParseExpr.c b/generic/tclParseExpr.c index 9fdf8e5..e07b7e7 100644 --- a/generic/tclParseExpr.c +++ b/generic/tclParseExpr.c @@ -132,7 +132,7 @@ typedef struct ParseInfo { * entries must match the order and number of the lexeme definitions above. */ -static char *lexemeStrings[] = { +static CONST char *CONST lexemeStrings[] = { "LITERAL", "FUNCNAME", "[", "{", "(", ")", "$", "\"", ",", "END", "UNKNOWN", "UNKNOWN_CHAR", "*", "/", "%", "+", "-", diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 26a9cff..940d011 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -78,7 +78,7 @@ static void AddRequirementsToResult(Tcl_Interp* interp, int reqc, static void AddRequirementsToDString(Tcl_DString* dstring, int reqc, Tcl_Obj *CONST reqv[]); static Package * FindPackage(Tcl_Interp *interp, CONST char *name); -static const char * PkgRequireCore(Tcl_Interp *interp, CONST char *name, +static CONST char * PkgRequireCore(Tcl_Interp *interp, CONST char *name, int reqx, Tcl_Obj *CONST reqv[], ClientData *clientDataPtr); #endif @@ -261,7 +261,7 @@ Tcl_PkgRequireEx(interp, name, version, exact, clientDataPtr) Tcl_DString command; #else Tcl_Obj *ov; - const char *result = NULL; + CONST char *result = NULL; #endif /* @@ -373,7 +373,7 @@ Tcl_PkgRequireProc( * available. */ ClientData *clientDataPtr) { - const char *result = + CONST char *result = PkgRequireCore(interp, name, reqc, reqv, clientDataPtr); if (result == NULL) { @@ -383,7 +383,7 @@ Tcl_PkgRequireProc( return TCL_OK; } -static const char * +static CONST char * PkgRequireCore( Tcl_Interp *interp, /* Interpreter in which package is now * available. */ @@ -1077,7 +1077,7 @@ Tcl_PackageObjCmd(dummy, interp, objc, objv) break; } case PKG_PRESENT: { - const char *name; + CONST char *name; if (objc < 3) { goto require; } diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 7005223..8dba3c1 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -1017,7 +1017,7 @@ Tcl_SetUnicodeObj(objPtr, unicode, numChars) static int UnicodeLength( - const Tcl_UniChar *unicode) + CONST Tcl_UniChar *unicode) { int numChars = 0; diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index a5408f4..7fa070b 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -181,7 +181,7 @@ Tcl_WinTCharToUtf( # define TclWinGetPlatformId (int (*)()) TclpCreateTempFile # define TclWinGetTclInstance (void *(*)()) TclpCreateProcess # define TclWinNToHS (unsigned short (*) _ANSI_ARGS_((unsigned short ns))) TclpMakeFile -# define TclWinSetSockOpt (int (*) _ANSI_ARGS_((void *, int, int, const char *, int))) TclpOpenFile +# define TclWinSetSockOpt (int (*) _ANSI_ARGS_((void *, int, int, CONST char *, int))) TclpOpenFile # define TclWinAddProcess 0 # define TclWinNoBackslash 0 # define TclWinSetInterfaces 0 diff --git a/generic/tclTestProcBodyObj.c b/generic/tclTestProcBodyObj.c index 5a17260..c85b303 100644 --- a/generic/tclTestProcBodyObj.c +++ b/generic/tclTestProcBodyObj.c @@ -17,14 +17,14 @@ * name and version of this package */ -static char packageName[] = "procbodytest"; -static char packageVersion[] = "1.0"; +static CONST char packageName[] = "procbodytest"; +static CONST char packageVersion[] = "1.0"; /* * Name of the commands exported by this package */ -static char procCommand[] = "proc"; +static CONST char procCommand[] = "proc"; /* * this struct describes an entry in the table of command names and command @@ -33,7 +33,7 @@ static char procCommand[] = "proc"; typedef struct CmdTable { - char *cmdName; /* command name */ + CONST char *cmdName; /* command name */ Tcl_ObjCmdProc *proc; /* command proc */ int exportIt; /* if 1, export the command */ } CmdTable; @@ -47,7 +47,7 @@ static int ProcBodyTestProcObjCmd _ANSI_ARGS_((ClientData dummy, static int ProcBodyTestInitInternal _ANSI_ARGS_((Tcl_Interp *interp, int isSafe)); static int RegisterCommand _ANSI_ARGS_((Tcl_Interp* interp, - char *namespace, CONST CmdTable *cmdTablePtr)); + CONST char *namespace, CONST CmdTable *cmdTablePtr)); int Procbodytest_Init _ANSI_ARGS_((Tcl_Interp * interp)); int Procbodytest_SafeInit _ANSI_ARGS_((Tcl_Interp * interp)); @@ -137,7 +137,7 @@ Procbodytest_SafeInit(interp) static int RegisterCommand(interp, namespace, cmdTablePtr) Tcl_Interp* interp; /* the Tcl interpreter for which the * operation is performed */ - char *namespace; /* the namespace in which the command + CONST char *namespace; /* the namespace in which the command * is registered */ CONST CmdTable *cmdTablePtr; /* the command to register */ { -- cgit v0.12