summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-23 13:17:12 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-23 13:17:12 (GMT)
commitab4c7318fd564b0196bd38b6573eb84c9d51e2d1 (patch)
tree3326a12bac5c8ff056623f23c433b10d6d915585
parent75d9b50fe87d98b7e6ef6058d0e39cd0c46e8c66 (diff)
parent6f14ff020a548ab6adcb30836c498ab0fe921970 (diff)
downloadtcl-ab4c7318fd564b0196bd38b6573eb84c9d51e2d1.zip
tcl-ab4c7318fd564b0196bd38b6573eb84c9d51e2d1.tar.gz
tcl-ab4c7318fd564b0196bd38b6573eb84c9d51e2d1.tar.bz2
make some more internal tables const
-rw-r--r--generic/tclDate.c12
-rw-r--r--generic/tclExecute.c4
-rw-r--r--generic/tclGetDate.y12
-rw-r--r--generic/tclIO.c2
-rw-r--r--generic/tclIOCmd.c2
-rw-r--r--generic/tclIOGT.c2
-rw-r--r--generic/tclPort.h1
-rw-r--r--generic/tclTest.c2
-rw-r--r--generic/tclTestProcBodyObj.c14
-rw-r--r--generic/tclTrace.c4
-rw-r--r--unix/tclUnixChan.c2
-rw-r--r--win/tclWinFCmd.c2
-rw-r--r--win/tclWinPipe.c2
-rw-r--r--win/tclWinReg.c2
-rw-r--r--win/tclWinTest.c2
-rw-r--r--win/tclWinTime.c6
16 files changed, 35 insertions, 36 deletions
diff --git a/generic/tclDate.c b/generic/tclDate.c
index b77c7fd..59da2ea 100644
--- a/generic/tclDate.c
+++ b/generic/tclDate.c
@@ -2299,7 +2299,7 @@ MODULE_SCOPE int yynerrs;
* Month and day table.
*/
-static TABLE MonthDayTable[] = {
+static const TABLE MonthDayTable[] = {
{ "january", tMONTH, 1 },
{ "february", tMONTH, 2 },
{ "march", tMONTH, 3 },
@@ -2331,7 +2331,7 @@ static TABLE MonthDayTable[] = {
* Time units table.
*/
-static TABLE UnitsTable[] = {
+static const TABLE UnitsTable[] = {
{ "year", tMONTH_UNIT, 12 },
{ "month", tMONTH_UNIT, 1 },
{ "fortnight", tDAY_UNIT, 14 },
@@ -2349,7 +2349,7 @@ static TABLE UnitsTable[] = {
* Assorted relative-time words.
*/
-static TABLE OtherTable[] = {
+static const TABLE OtherTable[] = {
{ "tomorrow", tDAY_UNIT, 1 },
{ "yesterday", tDAY_UNIT, -1 },
{ "today", tDAY_UNIT, 0 },
@@ -2382,7 +2382,7 @@ static TABLE OtherTable[] = {
* point constants to work around an SGI compiler bug).
*/
-static TABLE TimezoneTable[] = {
+static const TABLE TimezoneTable[] = {
{ "gmt", tZONE, HOUR( 0) }, /* Greenwich Mean */
{ "ut", tZONE, HOUR( 0) }, /* Universal (Coordinated) */
{ "utc", tZONE, HOUR( 0) },
@@ -2467,7 +2467,7 @@ static TABLE TimezoneTable[] = {
* Military timezone table.
*/
-static TABLE MilitaryTable[] = {
+static const TABLE MilitaryTable[] = {
{ "a", tZONE, -HOUR( 1) },
{ "b", tZONE, -HOUR( 2) },
{ "c", tZONE, -HOUR( 3) },
@@ -2560,7 +2560,7 @@ LookupWord(
{
register char *p;
register char *q;
- register TABLE *tp;
+ register const TABLE *tp;
int i, abbrev;
/*
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 8d97392..f2efa0f 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -116,7 +116,7 @@ long tclObjsShared[TCL_MAX_SHARED_OBJ_STATS] = { 0, 0, 0, 0, 0 };
*/
typedef struct {
- char *name; /* Name of function. */
+ const char *name; /* Name of function. */
int numArgs; /* Number of arguments for function. */
} BuiltinFunc;
@@ -126,7 +126,7 @@ typedef struct {
* operand byte.
*/
-static BuiltinFunc tclBuiltinFuncTable[] = {
+static const BuiltinFunc tclBuiltinFuncTable[] = {
{"acos", 1},
{"asin", 1},
{"atan", 1},
diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y
index e22e40c..551b1ed 100644
--- a/generic/tclGetDate.y
+++ b/generic/tclGetDate.y
@@ -510,7 +510,7 @@ MODULE_SCOPE int yynerrs;
* Month and day table.
*/
-static TABLE MonthDayTable[] = {
+static const TABLE MonthDayTable[] = {
{ "january", tMONTH, 1 },
{ "february", tMONTH, 2 },
{ "march", tMONTH, 3 },
@@ -542,7 +542,7 @@ static TABLE MonthDayTable[] = {
* Time units table.
*/
-static TABLE UnitsTable[] = {
+static const TABLE UnitsTable[] = {
{ "year", tMONTH_UNIT, 12 },
{ "month", tMONTH_UNIT, 1 },
{ "fortnight", tDAY_UNIT, 14 },
@@ -560,7 +560,7 @@ static TABLE UnitsTable[] = {
* Assorted relative-time words.
*/
-static TABLE OtherTable[] = {
+static const TABLE OtherTable[] = {
{ "tomorrow", tDAY_UNIT, 1 },
{ "yesterday", tDAY_UNIT, -1 },
{ "today", tDAY_UNIT, 0 },
@@ -593,7 +593,7 @@ static TABLE OtherTable[] = {
* point constants to work around an SGI compiler bug).
*/
-static TABLE TimezoneTable[] = {
+static const TABLE TimezoneTable[] = {
{ "gmt", tZONE, HOUR( 0) }, /* Greenwich Mean */
{ "ut", tZONE, HOUR( 0) }, /* Universal (Coordinated) */
{ "utc", tZONE, HOUR( 0) },
@@ -678,7 +678,7 @@ static TABLE TimezoneTable[] = {
* Military timezone table.
*/
-static TABLE MilitaryTable[] = {
+static const TABLE MilitaryTable[] = {
{ "a", tZONE, -HOUR( 1) },
{ "b", tZONE, -HOUR( 2) },
{ "c", tZONE, -HOUR( 3) },
@@ -771,7 +771,7 @@ LookupWord(
{
register char *p;
register char *q;
- register TABLE *tp;
+ register const TABLE *tp;
int i, abbrev;
/*
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 0f01baa..b9fa18d 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -8401,7 +8401,7 @@ Tcl_FileEventObjCmd(
int modeIndex; /* Index of mode argument. */
int mask;
static const char *modeOptions[] = {"readable", "writable", NULL};
- static int maskArray[] = {TCL_READABLE, TCL_WRITABLE};
+ static CONST int maskArray[] = {TCL_READABLE, TCL_WRITABLE};
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 1, objv, "channelId event ?script?");
diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c
index 0c05cbf..21dcd71 100644
--- a/generic/tclIOCmd.c
+++ b/generic/tclIOCmd.c
@@ -518,7 +518,7 @@ Tcl_SeekObjCmd(
static const char *originOptions[] = {
"start", "current", "end", NULL
};
- static int modeArray[] = {SEEK_SET, SEEK_CUR, SEEK_END};
+ static CONST int modeArray[] = {SEEK_SET, SEEK_CUR, SEEK_END};
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 1, objv, "channelId offset ?origin?");
diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c
index 5dae459..eed21fb 100644
--- a/generic/tclIOGT.c
+++ b/generic/tclIOGT.c
@@ -133,7 +133,7 @@ static Tcl_ChannelType transformChannelType = {
TransformNotifyProc, /* Handling of events bubbling up. */
TransformWideSeekProc, /* Wide seek proc. */
NULL, /* Thread action. */
- NULL, /* Truncate. */
+ NULL /* Truncate. */
};
/*
diff --git a/generic/tclPort.h b/generic/tclPort.h
index 79bea88..7c9bf3c 100644
--- a/generic/tclPort.h
+++ b/generic/tclPort.h
@@ -35,7 +35,6 @@
DLLIMPORT extern int cygwin_conv_to_win32_path(const char *, char *);
DLLIMPORT extern int cygwin_posix_to_win32_path_list_buf_size(char *value);
DLLIMPORT extern void cygwin_posix_to_win32_path_list(char *buf, char *value);
- DLLIMPORT extern void __stdcall SetEnvironmentVariableA(const char*, const char *);
#endif
#if !defined(LLONG_MIN)
diff --git a/generic/tclTest.c b/generic/tclTest.c
index c08f281..57c17e3 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -3259,7 +3259,7 @@ TestlocaleCmd(
"ctype", "numeric", "time", "collate", "monetary",
"all", NULL
};
- static int lcTypes[] = {
+ static CONST int lcTypes[] = {
LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY,
LC_ALL
};
diff --git a/generic/tclTestProcBodyObj.c b/generic/tclTestProcBodyObj.c
index 88bd1c3..644179b 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;
@@ -46,7 +46,7 @@ static int ProcBodyTestProcObjCmd(ClientData dummy,
Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
static int ProcBodyTestInitInternal(Tcl_Interp *interp, int isSafe);
static int RegisterCommand(Tcl_Interp* interp,
- char *namespace, CONST CmdTable *cmdTablePtr);
+ const char *namespace, const CmdTable *cmdTablePtr);
int Procbodytest_Init(Tcl_Interp * interp);
int Procbodytest_SafeInit(Tcl_Interp * interp);
@@ -132,9 +132,9 @@ Procbodytest_SafeInit(
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 is
+ const char *namespace; /* the namespace in which the command is
* registered */
- CONST CmdTable *cmdTablePtr;/* the command to register */
+ const CmdTable *cmdTablePtr;/* the command to register */
{
char buf[128];
diff --git a/generic/tclTrace.c b/generic/tclTrace.c
index 3ea182f..fa29160 100644
--- a/generic/tclTrace.c
+++ b/generic/tclTrace.c
@@ -110,10 +110,10 @@ static Tcl_TraceTypeObjCmd TraceExecutionObjCmd;
static const char *traceTypeOptions[] = {
"execution", "command", "variable", NULL
};
-static Tcl_TraceTypeObjCmd *traceSubCmds[] = {
+static Tcl_TraceTypeObjCmd *const traceSubCmds[] = {
TraceExecutionObjCmd,
TraceCommandObjCmd,
- TraceVariableObjCmd,
+ TraceVariableObjCmd
};
/*
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index 53c5c47..93bb1fe 100644
--- a/unix/tclUnixChan.c
+++ b/unix/tclUnixChan.c
@@ -1063,7 +1063,7 @@ TtyGetOptionProc(
# define TtyGetBaud(speed) ((int) (speed))
#else /* !DIRECT_BAUD */
-static struct {int baud; unsigned long speed;} speeds[] = {
+static CONST struct {int baud; unsigned long speed;} speeds[] = {
#ifdef B0
{0, B0},
#endif
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c
index a1338a7..d918b4a 100644
--- a/win/tclWinFCmd.c
+++ b/win/tclWinFCmd.c
@@ -50,7 +50,7 @@ enum {
WIN_SYSTEM_ATTRIBUTE
};
-static int attributeArray[] = {FILE_ATTRIBUTE_ARCHIVE, FILE_ATTRIBUTE_HIDDEN,
+static const int attributeArray[] = {FILE_ATTRIBUTE_ARCHIVE, FILE_ATTRIBUTE_HIDDEN,
0, FILE_ATTRIBUTE_READONLY, 0, FILE_ATTRIBUTE_SYSTEM};
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index b29dde4..842228a 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.c
@@ -1369,7 +1369,7 @@ ApplicationType(
Tcl_DString nameBuf, ds;
const TCHAR *nativeName;
WCHAR nativeFullPath[MAX_PATH];
- static char extensions[][5] = {"", ".com", ".exe", ".bat"};
+ static const char extensions[][5] = {"", ".com", ".exe", ".bat"};
/*
* Look for the program as an external program. First try the name as it
diff --git a/win/tclWinReg.c b/win/tclWinReg.c
index 8eaf2a7..f2ac367 100644
--- a/win/tclWinReg.c
+++ b/win/tclWinReg.c
@@ -52,7 +52,7 @@ static CONST char *rootKeyNames[] = {
"HKEY_PERFORMANCE_DATA", "HKEY_DYN_DATA", NULL
};
-static HKEY rootKeys[] = {
+static const HKEY rootKeys[] = {
HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CLASSES_ROOT, HKEY_CURRENT_USER,
HKEY_CURRENT_CONFIG, HKEY_PERFORMANCE_DATA, HKEY_DYN_DATA
};
diff --git a/win/tclWinTest.c b/win/tclWinTest.c
index d0bbb09..34aea42 100644
--- a/win/tclWinTest.c
+++ b/win/tclWinTest.c
@@ -428,7 +428,7 @@ TestExceptionCmd(
"invalid_disp", "guard_page", "invalid_handle", "ctrl+c",
NULL
};
- static DWORD exceptions[] = {
+ static const DWORD exceptions[] = {
EXCEPTION_ACCESS_VIOLATION, EXCEPTION_DATATYPE_MISALIGNMENT,
EXCEPTION_ARRAY_BOUNDS_EXCEEDED, EXCEPTION_FLT_DENORMAL_OPERAND,
EXCEPTION_FLT_DIVIDE_BY_ZERO, EXCEPTION_FLT_INEXACT_RESULT,
diff --git a/win/tclWinTime.c b/win/tclWinTime.c
index 3ae108b..f34884a 100644
--- a/win/tclWinTime.c
+++ b/win/tclWinTime.c
@@ -27,11 +27,11 @@
* month, where index 1 is January.
*/
-static int normalDays[] = {
+static const int normalDays[] = {
-1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364
};
-static int leapDays[] = {
+static const int leapDays[] = {
-1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
};
@@ -734,7 +734,7 @@ ComputeGMT(
struct tm *tmPtr;
long tmp, rem;
int isLeap;
- int *days;
+ const int *days;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
tmPtr = &tsdPtr->tm;