summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-03-07 08:31:44 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-03-07 08:31:44 (GMT)
commitefadd7170eafc8ffacab61f82cf3878cc7285ff1 (patch)
tree99d87a4b0c5e77209cb0eb3c1f462d6bcd5a0f3c
parent3e2014216af5a54eec83355257ed2f95f9d8bf41 (diff)
parent65baf6c706d7cfa12cfbc06610f7e9a51c5c81e8 (diff)
downloadtcl-efadd7170eafc8ffacab61f82cf3878cc7285ff1.zip
tcl-efadd7170eafc8ffacab61f82cf3878cc7285ff1.tar.gz
tcl-efadd7170eafc8ffacab61f82cf3878cc7285ff1.tar.bz2
Merge 8.6. Remove unneeded code from init.tcl
-rw-r--r--generic/tclCmdMZ.c19
-rw-r--r--generic/tclEnv.c12
-rw-r--r--library/init.tcl36
-rw-r--r--unix/tclUnixTime.c2
-rw-r--r--win/nmakehlp.c2
-rw-r--r--win/tclWinTime.c22
6 files changed, 34 insertions, 59 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index 7349515..01d9c27 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -4074,8 +4074,8 @@ Tcl_TimeObjCmd(
* Tcl_TimeRateObjCmd --
*
* This object-based procedure is invoked to process the "timerate" Tcl
- * command.
- * This is similar to command "time", except the execution limited by
+ * command.
+ * This is similar to command "time", except the execution limited by
* given time (in milliseconds) instead of repetition count.
*
* Example:
@@ -4097,8 +4097,7 @@ Tcl_TimeRateObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- static
- double measureOverhead = 0; /* global measure-overhead */
+ static double measureOverhead = 0; /* global measure-overhead */
double overhead = -1; /* given measure-overhead */
register Tcl_Obj *objPtr;
register int result, i;
@@ -4186,13 +4185,13 @@ usage:
Tcl_Obj *clobjv[6];
Tcl_WideInt maxCalTime = 5000;
double lastMeasureOverhead = measureOverhead;
-
- clobjv[0] = objv[0];
+
+ clobjv[0] = objv[0];
i = 1;
if (direct) {
clobjv[i++] = direct;
}
- clobjv[i++] = objPtr;
+ clobjv[i++] = objPtr;
/* reset last measurement overhead */
measureOverhead = (double)0;
@@ -4209,7 +4208,7 @@ usage:
i--;
clobjv[i++] = calibrate;
- clobjv[i++] = objPtr;
+ clobjv[i++] = objPtr;
/* set last measurement overhead to max */
measureOverhead = (double)UWIDE_MAX;
@@ -4310,7 +4309,7 @@ usage:
maxcnt = 0;
result = TCL_OK;
}
-
+
/* don't check time up to threshold */
if (--threshold > 0) continue;
@@ -4409,7 +4408,7 @@ usage:
}
objs[2] = Tcl_NewWideIntObj(count); /* iterations */
-
+
/* calculate speed as rate (count) per sec */
if (!middle) middle++; /* +1 ms, just to avoid divide by zero */
if (count < (WIDE_MAX / 1000000)) {
diff --git a/generic/tclEnv.c b/generic/tclEnv.c
index 2c7db0d..36c3cf9 100644
--- a/generic/tclEnv.c
+++ b/generic/tclEnv.c
@@ -135,6 +135,18 @@ TclSetupEnv(
}
p2++;
p2[-1] = '\0';
+#if defined(_WIN32)
+ /*
+ * Enforce PATH and COMSPEC to be all uppercase. This eliminates
+ * additional trace logic otherwise required in init.tcl.
+ */
+
+ if (strcasecmp(p1, "PATH") == 0) {
+ p1 = "PATH";
+ } else if (strcasecmp(p1, "COMSPEC") == 0) {
+ p1 = "COMSPEC";
+ }
+#endif
obj1 = Tcl_NewStringObj(p1, -1);
obj2 = Tcl_NewStringObj(p2, -1);
Tcl_DStringFree(&envString);
diff --git a/library/init.tcl b/library/init.tcl
index 1ccce27..d5b9c03 100644
--- a/library/init.tcl
+++ b/library/init.tcl
@@ -80,42 +80,6 @@ namespace eval tcl {
namespace eval tcl::Pkg {}
-# Windows specific end of initialization
-
-if {(![interp issafe]) && ($tcl_platform(platform) eq "windows")} {
- namespace eval tcl {
- proc EnvTraceProc {lo n1 n2 op} {
- global env
- set x $env($n2)
- set env($lo) $x
- set env([string toupper $lo]) $x
- }
- proc InitWinEnv {} {
- global env tcl_platform
- foreach p [array names env] {
- set u [string toupper $p]
- if {$u ne $p} {
- switch -- $u {
- COMSPEC -
- PATH {
- set temp $env($p)
- unset env($p)
- set env($u) $temp
- trace add variable env($p) write \
- [namespace code [list EnvTraceProc $p]]
- trace add variable env($u) write \
- [namespace code [list EnvTraceProc $p]]
- }
- }
- }
- }
- if {![info exists env(COMSPEC)]} {
- set env(COMSPEC) cmd.exe
- }
- }
- InitWinEnv
- }
-}
# Setup the unknown package handler
diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c
index d95d39b..1d8b351 100644
--- a/unix/tclUnixTime.c
+++ b/unix/tclUnixTime.c
@@ -251,7 +251,7 @@ TclpWideClicksToNanoseconds(
*
* TclpWideClickInMicrosec --
*
- * This procedure return scale to convert click values from the
+ * This procedure return scale to convert click values from the
* TclpGetWideClicks native resolution to microsecond resolution
* and back.
*
diff --git a/win/nmakehlp.c b/win/nmakehlp.c
index 1655d48..c21de63 100644
--- a/win/nmakehlp.c
+++ b/win/nmakehlp.c
@@ -793,7 +793,7 @@ static int LocateDependencyHelper(const char *dir, const char *keypath)
static int LocateDependency(const char *keypath)
{
int i, ret;
- static char *paths[] = {"..", "..\\..", "..\\..\\.."};
+ static const char *paths[] = {"..", "..\\..", "..\\..\\.."};
for (i = 0; i < (sizeof(paths)/sizeof(paths[0])); ++i) {
ret = LocateDependencyHelper(paths[i], keypath);
diff --git a/win/tclWinTime.c b/win/tclWinTime.c
index 19c53c8..bfebbe6 100644
--- a/win/tclWinTime.c
+++ b/win/tclWinTime.c
@@ -261,7 +261,7 @@ TclpGetWideClicks(void)
/*
* The frequency of the performance counter is fixed at system boot and
- * is consistent across all processors. Therefore, the frequency need
+ * is consistent across all processors. Therefore, the frequency need
* only be queried upon application initialization.
*/
if (QueryPerformanceFrequency(&perfCounterFreq)) {
@@ -272,7 +272,7 @@ TclpGetWideClicks(void)
wideClick.perfCounter = 0;
wideClick.microsecsScale = 1;
}
-
+
wideClick.initialized = 1;
}
if (wideClick.perfCounter) {
@@ -293,7 +293,7 @@ TclpGetWideClicks(void)
*
* TclpWideClickInMicrosec --
*
- * This procedure return scale to convert wide click values from the
+ * This procedure return scale to convert wide click values from the
* TclpGetWideClicks native resolution to microsecond resolution
* and back.
*
@@ -332,7 +332,7 @@ TclpWideClickInMicrosec(void)
*----------------------------------------------------------------------
*/
-Tcl_WideInt
+Tcl_WideInt
TclpGetMicroseconds(void)
{
Tcl_WideInt usecSincePosixEpoch;
@@ -451,7 +451,7 @@ NativeCalc100NsTicks(
LONGLONG curCounterFreq,
LONGLONG curCounter
) {
- return fileTimeLastCall +
+ return fileTimeLastCall +
((curCounter - perfCounterLastCall) * 10000000 / curCounterFreq);
}
@@ -1071,7 +1071,7 @@ UpdateTimeEachSecond(void)
return;
}
QueryPerformanceCounter(&curPerfCounter);
-
+
lastFileTime.QuadPart = curFileTime.QuadPart;
/*
@@ -1139,7 +1139,7 @@ UpdateTimeEachSecond(void)
/* calculate new frequency and estimate drift to the next second */
vt1 = 20000000 + curFileTime.QuadPart;
driftFreq = (estFreq * 20000000 / (vt1 - vt0));
- /*
+ /*
* Avoid too large drifts (only half of the current difference),
* that allows also be more accurate (aspire to the smallest tdiff),
* so then we can prolong calibration interval by tdiff < 100000
@@ -1147,13 +1147,13 @@ UpdateTimeEachSecond(void)
driftFreq = timeInfo.curCounterFreq.QuadPart +
(driftFreq - timeInfo.curCounterFreq.QuadPart) / 2;
- /*
+ /*
* Average between estimated, 2 current and 5 drifted frequencies,
* (do the soft drifting as possible)
*/
estFreq = (estFreq + 2 * timeInfo.curCounterFreq.QuadPart + 5 * driftFreq) / 8;
}
-
+
/* Avoid too large discrepancy from nominal frequency */
if (estFreq > 1003*timeInfo.nominalFreq.QuadPart/1000) {
estFreq = 1003*timeInfo.nominalFreq.QuadPart/1000;
@@ -1162,9 +1162,9 @@ UpdateTimeEachSecond(void)
estFreq = 997*timeInfo.nominalFreq.QuadPart/1000;
vt0 = curFileTime.QuadPart;
} else if (vt0 != curFileTime.QuadPart) {
- /*
+ /*
* Be sure the clock ticks never backwards (avoid it by negative drifting)
- * just compare native time (in 100-ns) before and hereafter using
+ * just compare native time (in 100-ns) before and hereafter using
* new calibrated values) and do a small adjustment (short time freeze)
*/
LARGE_INTEGER newPerfCounter;