summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-02-26 13:45:40 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-02-26 13:45:40 (GMT)
commita4154b246b048a378dd83998031d103263856c8f (patch)
tree521abd6a25b1866875951f26920b2643e0a4c778 /generic
parent14276a3feb131ef52ed60ccce8f66df43cdd98b2 (diff)
downloadtcl-a4154b246b048a378dd83998031d103263856c8f.zip
tcl-a4154b246b048a378dd83998031d103263856c8f.tar.gz
tcl-a4154b246b048a378dd83998031d103263856c8f.tar.bz2
Resolve a number of shadowed variables (discovered by compiling with -Wshadow)
Diffstat (limited to 'generic')
-rw-r--r--generic/tclAssembly.c4
-rw-r--r--generic/tclClock.c64
-rw-r--r--generic/tclCmdIL.c6
-rw-r--r--generic/tclEnv.c6
4 files changed, 39 insertions, 41 deletions
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index f05814fa..15e36ac 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -1697,9 +1697,7 @@ AssembleOneLine(
goto cleanup;
}
{
- int flags = TCL_REG_ADVANCED | (opnd ? TCL_REG_NOCASE : 0);
-
- BBEmitInstInt1(assemEnvPtr, tblIdx, flags, 0);
+ BBEmitInstInt1(assemEnvPtr, tblIdx, TCL_REG_ADVANCED | (opnd ? TCL_REG_NOCASE : 0), 0);
}
break;
diff --git a/generic/tclClock.c b/generic/tclClock.c
index 1629cb8..01058f5 100644
--- a/generic/tclClock.c
+++ b/generic/tclClock.c
@@ -337,7 +337,7 @@ ClockConvertlocaltoutcObjCmd(
Tcl_Obj *const *objv) /* Parameter vector */
{
ClockClientData *data = clientData;
- Tcl_Obj *const *literals = data->literals;
+ Tcl_Obj *const *lit = data->literals;
Tcl_Obj *secondsObj;
Tcl_Obj *dict;
int changeover;
@@ -354,7 +354,7 @@ ClockConvertlocaltoutcObjCmd(
return TCL_ERROR;
}
dict = objv[1];
- if (Tcl_DictObjGet(interp, dict, literals[LIT_LOCALSECONDS],
+ if (Tcl_DictObjGet(interp, dict, lit[LIT_LOCALSECONDS],
&secondsObj)!= TCL_OK) {
return TCL_ERROR;
}
@@ -380,7 +380,7 @@ ClockConvertlocaltoutcObjCmd(
created = 1;
Tcl_IncrRefCount(dict);
}
- status = Tcl_DictObjPut(interp, dict, literals[LIT_SECONDS],
+ status = Tcl_DictObjPut(interp, dict, lit[LIT_SECONDS],
Tcl_NewWideIntObj(fields.seconds));
if (status == TCL_OK) {
Tcl_SetObjResult(interp, dict);
@@ -431,7 +431,7 @@ ClockGetdatefieldsObjCmd(
TclDateFields fields;
Tcl_Obj *dict;
ClockClientData *data = clientData;
- Tcl_Obj *const *literals = data->literals;
+ Tcl_Obj *const *lit = data->literals;
int changeover;
/*
@@ -453,7 +453,7 @@ ClockGetdatefieldsObjCmd(
*/
if (objv[1]->typePtr == &tclBignumType) {
- Tcl_SetObjResult(interp, literals[LIT_INTEGER_VALUE_TOO_LARGE]);
+ Tcl_SetObjResult(interp, lit[LIT_INTEGER_VALUE_TOO_LARGE]);
return TCL_ERROR;
}
@@ -481,33 +481,33 @@ ClockGetdatefieldsObjCmd(
GetYearWeekDay(&fields, changeover);
dict = Tcl_NewDictObj();
- Tcl_DictObjPut(NULL, dict, literals[LIT_LOCALSECONDS],
+ Tcl_DictObjPut(NULL, dict, lit[LIT_LOCALSECONDS],
Tcl_NewWideIntObj(fields.localSeconds));
- Tcl_DictObjPut(NULL, dict, literals[LIT_SECONDS],
+ Tcl_DictObjPut(NULL, dict, lit[LIT_SECONDS],
Tcl_NewWideIntObj(fields.seconds));
- Tcl_DictObjPut(NULL, dict, literals[LIT_TZNAME], fields.tzName);
+ Tcl_DictObjPut(NULL, dict, lit[LIT_TZNAME], fields.tzName);
Tcl_DecrRefCount(fields.tzName);
- Tcl_DictObjPut(NULL, dict, literals[LIT_TZOFFSET],
+ Tcl_DictObjPut(NULL, dict, lit[LIT_TZOFFSET],
Tcl_NewIntObj(fields.tzOffset));
- Tcl_DictObjPut(NULL, dict, literals[LIT_JULIANDAY],
+ Tcl_DictObjPut(NULL, dict, lit[LIT_JULIANDAY],
Tcl_NewIntObj(fields.julianDay));
- Tcl_DictObjPut(NULL, dict, literals[LIT_GREGORIAN],
+ Tcl_DictObjPut(NULL, dict, lit[LIT_GREGORIAN],
Tcl_NewIntObj(fields.gregorian));
- Tcl_DictObjPut(NULL, dict, literals[LIT_ERA],
- literals[fields.era ? LIT_BCE : LIT_CE]);
- Tcl_DictObjPut(NULL, dict, literals[LIT_YEAR],
+ Tcl_DictObjPut(NULL, dict, lit[LIT_ERA],
+ lit[fields.era ? LIT_BCE : LIT_CE]);
+ Tcl_DictObjPut(NULL, dict, lit[LIT_YEAR],
Tcl_NewIntObj(fields.year));
- Tcl_DictObjPut(NULL, dict, literals[LIT_DAYOFYEAR],
+ Tcl_DictObjPut(NULL, dict, lit[LIT_DAYOFYEAR],
Tcl_NewIntObj(fields.dayOfYear));
- Tcl_DictObjPut(NULL, dict, literals[LIT_MONTH],
+ Tcl_DictObjPut(NULL, dict, lit[LIT_MONTH],
Tcl_NewIntObj(fields.month));
- Tcl_DictObjPut(NULL, dict, literals[LIT_DAYOFMONTH],
+ Tcl_DictObjPut(NULL, dict, lit[LIT_DAYOFMONTH],
Tcl_NewIntObj(fields.dayOfMonth));
- Tcl_DictObjPut(NULL, dict, literals[LIT_ISO8601YEAR],
+ Tcl_DictObjPut(NULL, dict, lit[LIT_ISO8601YEAR],
Tcl_NewIntObj(fields.iso8601Year));
- Tcl_DictObjPut(NULL, dict, literals[LIT_ISO8601WEEK],
+ Tcl_DictObjPut(NULL, dict, lit[LIT_ISO8601WEEK],
Tcl_NewIntObj(fields.iso8601Week));
- Tcl_DictObjPut(NULL, dict, literals[LIT_DAYOFWEEK],
+ Tcl_DictObjPut(NULL, dict, lit[LIT_DAYOFWEEK],
Tcl_NewIntObj(fields.dayOfWeek));
Tcl_SetObjResult(interp, dict);
@@ -585,7 +585,7 @@ ClockGetjuliandayfromerayearmonthdayObjCmd(
TclDateFields fields;
Tcl_Obj *dict;
ClockClientData *data = clientData;
- Tcl_Obj *const *literals = data->literals;
+ Tcl_Obj *const *lit = data->literals;
int changeover;
int copied = 0;
int status;
@@ -600,12 +600,12 @@ ClockGetjuliandayfromerayearmonthdayObjCmd(
return TCL_ERROR;
}
dict = objv[1];
- if (FetchEraField(interp, dict, literals[LIT_ERA], &era) != TCL_OK
- || FetchIntField(interp, dict, literals[LIT_YEAR], &fields.year)
+ if (FetchEraField(interp, dict, lit[LIT_ERA], &era) != TCL_OK
+ || FetchIntField(interp, dict, lit[LIT_YEAR], &fields.year)
!= TCL_OK
- || FetchIntField(interp, dict, literals[LIT_MONTH], &fields.month)
+ || FetchIntField(interp, dict, lit[LIT_MONTH], &fields.month)
!= TCL_OK
- || FetchIntField(interp, dict, literals[LIT_DAYOFMONTH],
+ || FetchIntField(interp, dict, lit[LIT_DAYOFMONTH],
&fields.dayOfMonth) != TCL_OK
|| TclGetIntFromObj(interp, objv[2], &changeover) != TCL_OK) {
return TCL_ERROR;
@@ -627,7 +627,7 @@ ClockGetjuliandayfromerayearmonthdayObjCmd(
Tcl_IncrRefCount(dict);
copied = 1;
}
- status = Tcl_DictObjPut(interp, dict, literals[LIT_JULIANDAY],
+ status = Tcl_DictObjPut(interp, dict, lit[LIT_JULIANDAY],
Tcl_NewIntObj(fields.julianDay));
if (status == TCL_OK) {
Tcl_SetObjResult(interp, dict);
@@ -669,7 +669,7 @@ ClockGetjuliandayfromerayearweekdayObjCmd(
TclDateFields fields;
Tcl_Obj *dict;
ClockClientData *data = clientData;
- Tcl_Obj *const *literals = data->literals;
+ Tcl_Obj *const *lit = data->literals;
int changeover;
int copied = 0;
int status;
@@ -684,12 +684,12 @@ ClockGetjuliandayfromerayearweekdayObjCmd(
return TCL_ERROR;
}
dict = objv[1];
- if (FetchEraField(interp, dict, literals[LIT_ERA], &era) != TCL_OK
- || FetchIntField(interp, dict, literals[LIT_ISO8601YEAR],
+ if (FetchEraField(interp, dict, lit[LIT_ERA], &era) != TCL_OK
+ || FetchIntField(interp, dict, lit[LIT_ISO8601YEAR],
&fields.iso8601Year) != TCL_OK
- || FetchIntField(interp, dict, literals[LIT_ISO8601WEEK],
+ || FetchIntField(interp, dict, lit[LIT_ISO8601WEEK],
&fields.iso8601Week) != TCL_OK
- || FetchIntField(interp, dict, literals[LIT_DAYOFWEEK],
+ || FetchIntField(interp, dict, lit[LIT_DAYOFWEEK],
&fields.dayOfWeek) != TCL_OK
|| TclGetIntFromObj(interp, objv[2], &changeover) != TCL_OK) {
return TCL_ERROR;
@@ -711,7 +711,7 @@ ClockGetjuliandayfromerayearweekdayObjCmd(
Tcl_IncrRefCount(dict);
copied = 1;
}
- status = Tcl_DictObjPut(interp, dict, literals[LIT_JULIANDAY],
+ status = Tcl_DictObjPut(interp, dict, lit[LIT_JULIANDAY],
Tcl_NewIntObj(fields.julianDay));
if (status == TCL_OK) {
Tcl_SetObjResult(interp, dict);
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index a73a292..7e685bd 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -3729,7 +3729,7 @@ Tcl_LsortObjCmd(
sortInfo.isIncreasing = 1;
break;
case LSORT_INDEX: {
- int indexc;
+ int sortindex;
Tcl_Obj **indexv;
if (i == objc-2) {
@@ -3740,7 +3740,7 @@ Tcl_LsortObjCmd(
sortInfo.resultCode = TCL_ERROR;
goto done;
}
- if (TclListObjGetElements(interp, objv[i+1], &indexc,
+ if (TclListObjGetElements(interp, objv[i+1], &sortindex,
&indexv) != TCL_OK) {
sortInfo.resultCode = TCL_ERROR;
goto done;
@@ -3754,7 +3754,7 @@ Tcl_LsortObjCmd(
* options is done.
*/
- for (j=0 ; j<indexc ; j++) {
+ for (j=0 ; j<sortindex ; j++) {
int encoded = 0;
int result = TclIndexEncode(interp, indexv[j],
TCL_INDEX_BEFORE, TCL_INDEX_AFTER, &encoded);
diff --git a/generic/tclEnv.c b/generic/tclEnv.c
index da05f93..487c1a2 100644
--- a/generic/tclEnv.c
+++ b/generic/tclEnv.c
@@ -254,7 +254,7 @@ TclSetEnv(
oldValue = NULL;
nameLength = strlen(name);
} else {
- const char *env;
+ const char *oldEnv;
/*
* Compare the new value to the existing value. If they're the same
@@ -264,8 +264,8 @@ TclSetEnv(
* interpreters.
*/
- env = Tcl_ExternalToUtfDString(NULL, environ[index], -1, &envString);
- if (strcmp(value, env + (length + 1)) == 0) {
+ oldEnv = Tcl_ExternalToUtfDString(NULL, environ[index], -1, &envString);
+ if (strcmp(value, oldEnv + (length + 1)) == 0) {
Tcl_DStringFree(&envString);
Tcl_MutexUnlock(&envMutex);
return;