summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-04-26 13:52:58 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-04-26 13:52:58 (GMT)
commitf8900a54702510fa7e6068221cba71c5f8920f01 (patch)
tree502e16aa19987a0abef1d255638a9d39a00bd4ab
parentace56e587278e676259306f1a89602f3ca679f52 (diff)
parentf9c3c819472813905c28f23456d1e94d8a167aa1 (diff)
downloadtcl-f8900a54702510fa7e6068221cba71c5f8920f01.zip
tcl-f8900a54702510fa7e6068221cba71c5f8920f01.tar.gz
tcl-f8900a54702510fa7e6068221cba71c5f8920f01.tar.bz2
merge trunk
-rw-r--r--ChangeLog21
-rw-r--r--doc/FileSystem.34
-rw-r--r--generic/tclAssembly.c2
-rw-r--r--generic/tclCmdAH.c12
-rw-r--r--generic/tclFileName.c13
-rw-r--r--generic/tclIO.c2
-rw-r--r--generic/tclIOCmd.c4
-rw-r--r--generic/tclIndexObj.c2
-rw-r--r--generic/tclInt.decls42
-rw-r--r--generic/tclInt.h1
-rw-r--r--generic/tclIntPlatDecls.h189
-rw-r--r--generic/tclMain.c23
-rw-r--r--generic/tclPathObj.c5
-rw-r--r--generic/tclPipe.c2
-rw-r--r--generic/tclPort.h2
-rw-r--r--generic/tclRegexp.c4
-rw-r--r--generic/tclStubInit.c68
-rw-r--r--generic/tclTest.c2
-rw-r--r--generic/tclTrace.c2
-rw-r--r--generic/tclUtil.c58
-rw-r--r--generic/tclZlib.c8
-rw-r--r--library/dde/pkgIndex.tcl4
-rwxr-xr-xlibrary/reg/pkgIndex.tcl4
-rw-r--r--unix/Makefile.in5
-rwxr-xr-xunix/configure72
-rw-r--r--unix/configure.in14
-rw-r--r--unix/tcl.m42
-rw-r--r--unix/tclUnixChan.c2
-rw-r--r--unix/tclUnixCompat.c6
-rw-r--r--unix/tclUnixFCmd.c6
-rw-r--r--unix/tclUnixFile.c49
-rw-r--r--unix/tclUnixInit.c7
-rw-r--r--unix/tclUnixPort.h1
-rw-r--r--win/tclWinFCmd.c14
-rw-r--r--win/tclWinFile.c6
-rw-r--r--win/tclWinInit.c5
-rw-r--r--win/tclWinPipe.c4
-rw-r--r--win/tclWinReg.c2
-rw-r--r--win/tclWinTest.c2
39 files changed, 472 insertions, 199 deletions
diff --git a/ChangeLog b/ChangeLog
index 33d08fe..bf2201b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2012-04-25 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tclUtil.c (TclDStringToObj): Added internal function to make
+ the fairly-common operation of converting a DString into an Obj a more
+ efficient one; for long strings, it can just transfer the ownership of
+ the buffer directly. Replaces this:
+ obj=Tcl_NewStringObj(Tcl_DStringValue(&ds),Tcl_DStringLength(&ds));
+ Tcl_DStringFree(&ds);
+ with this:
+ obj=TclDStringToObj(&ds);
+
+2012-04-24 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tclInt.decls: [Bug 3508771] load tclreg.dll in cygwin tclsh
+ * generic/tclIntPlatDecls.h: Implement TclWinGetSockOpt, TclWinGetServByName
+ * generic/tclStubInit.c: and TclWinCPUID for Cygwin
+ * generic/tclUnixCompat.c:
+ * unix/configure.in:
+ * unix/configure:
+ * unix/tclUnixCompat.c:
+
2012-04-18 Kevin B. Kenny <kennykb@acm.org>
* library/tzdata/Africa/Casablanca:
diff --git a/doc/FileSystem.3 b/doc/FileSystem.3
index 52eeb23..d7198b1 100644
--- a/doc/FileSystem.3
+++ b/doc/FileSystem.3
@@ -1218,8 +1218,8 @@ In addition, if \fIinterp\fR is non-NULL, the
\fBTcl_FSOpenFileChannelProc\fR leaves an error message in \fIinterp\fR's
result after any error.
.PP
-The newly created channel must not registered in the supplied
-interpreter; that task is up to the caller of
+The newly created channel must not be registered in the supplied interpreter
+by a \fBTcl_FSOpenFileChannelProc\fR; that task is up to the caller of
\fBTcl_FSOpenFileChannel\fR (if necessary). If one of
the standard channels, \fBstdin\fR, \fBstdout\fR or \fBstderr\fR was
previously closed, the act of creating the new channel also assigns it
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index 5b32ab0..02144a1 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -492,7 +492,7 @@ TalInstDesc TalInstructionTable[] = {
* The instructions must be in ascending order by numeric operation code.
*/
-static unsigned char NonThrowingByteCodes[] = {
+static const unsigned char NonThrowingByteCodes[] = {
INST_PUSH1, INST_PUSH4, INST_POP, INST_DUP, /* 1-4 */
INST_JUMP1, INST_JUMP4, /* 34-35 */
INST_END_CATCH, INST_PUSH_RESULT, INST_PUSH_RETURN_CODE, /* 70-72 */
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index 1cbc4d2..70aef8d 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -563,9 +563,7 @@ Tcl_EncodingObjCmd(
* truncate the string at the first null byte.
*/
- Tcl_SetObjResult(interp, Tcl_NewStringObj(
- Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)));
- Tcl_DStringFree(&ds);
+ Tcl_SetObjResult(interp, TclDStringToObj(&ds));
} else {
/*
* Store the result as binary data.
@@ -1869,20 +1867,16 @@ PathNativeNameCmd(
int objc,
Tcl_Obj *const objv[])
{
- const char *fileName;
Tcl_DString ds;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
return TCL_ERROR;
}
- fileName = Tcl_TranslateFileName(interp, TclGetString(objv[1]), &ds);
- if (fileName == NULL) {
+ if (Tcl_TranslateFileName(interp, TclGetString(objv[1]), &ds) == NULL) {
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, Tcl_NewStringObj(fileName,
- Tcl_DStringLength(&ds)));
- Tcl_DStringFree(&ds);
+ Tcl_SetObjResult(interp, TclDStringToObj(&ds));
return TCL_OK;
}
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index b6b89dd..5048308 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.c
@@ -445,8 +445,7 @@ TclpGetNativePathType(
if ((rootEnd != path) && (driveNameLengthPtr != NULL)) {
*driveNameLengthPtr = rootEnd - path;
if (driveNameRef != NULL) {
- *driveNameRef = Tcl_NewStringObj(Tcl_DStringValue(&ds),
- Tcl_DStringLength(&ds));
+ *driveNameRef = TclDStringToObj(&ds);
Tcl_IncrRefCount(*driveNameRef);
}
}
@@ -724,8 +723,7 @@ SplitWinPath(
*/
if (p != path) {
- Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj(
- Tcl_DStringValue(&buf), Tcl_DStringLength(&buf)));
+ Tcl_ListObjAppendElement(NULL, result, TclDStringToObj(&buf));
}
Tcl_DStringFree(&buf);
@@ -1751,14 +1749,12 @@ TclGlob(
if (head != Tcl_DStringValue(&buffer)) {
Tcl_DStringAppend(&buffer, head, -1);
}
- pathPrefix = Tcl_NewStringObj(Tcl_DStringValue(&buffer),
- Tcl_DStringLength(&buffer));
+ pathPrefix = TclDStringToObj(&buffer);
Tcl_IncrRefCount(pathPrefix);
globFlags |= TCL_GLOBMODE_DIR;
if (c != '\0') {
tail++;
}
- Tcl_DStringFree(&buffer);
} else {
tail = pattern;
}
@@ -2423,8 +2419,7 @@ DoGlob(
*/
if (pathPtr == NULL) {
- joinedPtr = Tcl_NewStringObj(Tcl_DStringValue(&append),
- Tcl_DStringLength(&append));
+ joinedPtr = TclDStringToObj(&append);
} else if (flags) {
joinedPtr = TclNewFSPathObj(pathPtr, Tcl_DStringValue(&append),
Tcl_DStringLength(&append));
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 082cf70..96e6de3 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -8856,7 +8856,7 @@ Tcl_FileEventObjCmd(
int modeIndex; /* Index of mode argument. */
int mask;
static const char *const 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 349814a..b22d746 100644
--- a/generic/tclIOCmd.c
+++ b/generic/tclIOCmd.c
@@ -521,7 +521,7 @@ Tcl_SeekObjCmd(
static const char *const 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?");
@@ -648,7 +648,7 @@ Tcl_CloseObjCmd(
static const char *const dirOptions[] = {
"read", "write", NULL
};
- static int dirArray[] = {TCL_CLOSE_READ, TCL_CLOSE_WRITE};
+ static const int dirArray[] = {TCL_CLOSE_READ, TCL_CLOSE_WRITE};
if ((objc != 2) && (objc != 3)) {
Tcl_WrongNumArgs(interp, 1, objv, "channelId ?direction?");
diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c
index 8651542..b206b35 100644
--- a/generic/tclIndexObj.c
+++ b/generic/tclIndexObj.c
@@ -1350,7 +1350,7 @@ PrintUsage(
register const Tcl_ArgvInfo *infoPtr;
int width, numSpaces;
#define NUM_SPACES 20
- static char spaces[] = " ";
+ static const char spaces[] = " ";
char tmp[TCL_DOUBLE_SPACE];
/*
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index ddda097..ad755bc 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -1036,7 +1036,7 @@ declare 7 win {
const char *optval, int optlen)
}
declare 8 win {
- unsigned long TclpGetPid(Tcl_Pid pid)
+ int TclpGetPid(Tcl_Pid pid)
}
declare 9 win {
int TclWinGetPlatformId(void)
@@ -1135,12 +1135,14 @@ declare 0 unix {
declare 1 unix {
void TclWinConvertWSAError(unsigned int errCode)
}
+# On non-cygwin, this is actually a reference to TclpCreateCommandChannel
declare 2 unix {
- Tcl_Channel TclpCreateCommandChannel(TclFile readFile,
- TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr)
+ struct servent *TclWinGetServByName(const char *nm, const char *proto)
}
+# On non-cygwin, this is actually a reference to TclpCreatePipe
declare 3 unix {
- int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe)
+ int TclWinGetSockOpt(void *s, int level, int optname,
+ char *optval, int *optlen)
}
# On non-cygwin, this is actually a reference to TclpCreateProcess
declare 4 unix {
@@ -1160,8 +1162,9 @@ declare 7 unix {
int TclWinSetSockOpt(void *s, int level, int optname,
const char *optval, int optlen)
}
+# On non-cygwin, this is actually a reference to TclUnixWaitForFile
declare 8 unix {
- int TclUnixWaitForFile(int fd, int mask, int timeout)
+ int TclpGetPid(Tcl_Pid pid)
}
# Added in 8.1:
@@ -1186,8 +1189,10 @@ declare 11 unix {
declare 12 unix {
struct tm *TclpGmtime_unix(const time_t *clock)
}
+# On cygwin, this is a reference to TclpCreateCommandChannel
+# Otherwise, this is a reference to TclpInetNtoa
declare 13 unix {
- char *TclpInetNtoa(struct in_addr addr)
+ void TclIntPlatReserved13(void)
}
# Added in 8.5:
@@ -1250,7 +1255,30 @@ declare 30 unix {
declare 31 unix {
int TclpCloseFile(TclFile file)
}
-
+declare 32 unix {
+ Tcl_Channel TclpCreateCommandChannel(TclFile readFile,
+ TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr)
+}
+declare 33 unix {
+ int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe)
+}
+declare 34 unix {
+ int TclpCreateProcess(Tcl_Interp *interp,
+ int argc, const char **argv, TclFile inputFile,
+ TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr)
+}
+declare 35 unix {
+ char *TclpInetNtoa(struct in_addr addr)
+}
+declare 36 unix {
+ TclFile TclpMakeFile(Tcl_Channel channel, int direction)
+}
+declare 37 unix {
+ TclFile TclpOpenFile(const char *fname, int mode)
+}
+declare 38 unix {
+ int TclUnixWaitForFile(int fd, int mask, int timeout)
+}
# Local Variables:
# mode: tcl
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 08b3f70..9068dfb 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -2920,6 +2920,7 @@ MODULE_SCOPE void TclCreateLateExitHandler(Tcl_ExitProc *proc,
ClientData clientData);
MODULE_SCOPE void TclDeleteLateExitHandler(Tcl_ExitProc *proc,
ClientData clientData);
+MODULE_SCOPE Tcl_Obj * TclDStringToObj(Tcl_DString *dsPtr);
MODULE_SCOPE void TclFinalizeAllocSubsystem(void);
MODULE_SCOPE void TclFinalizeAsync(void);
MODULE_SCOPE void TclFinalizeDoubleConversion(void);
diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h
index bea9037..bc0f4fd 100644
--- a/generic/tclIntPlatDecls.h
+++ b/generic/tclIntPlatDecls.h
@@ -24,16 +24,6 @@
# endif
#endif
-#if !defined(__WIN32__) /* UNIX */
-EXTERN int TclpCreateProcess(Tcl_Interp *interp,
- int argc, CONST char **argv, TclFile inputFile,
- TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr);
-EXTERN TclFile TclpMakeFile(Tcl_Channel channel,
- int direction);
-EXTERN TclFile TclpOpenFile(CONST char *fname,
- int mode);
-#endif
-
/*
* WARNING: This file is automatically generated by the tools/genStubs.tcl
* script. Any modifications to the function declarations below should be made
@@ -52,11 +42,11 @@ EXTERN void TclWinConvertError(unsigned int errCode);
/* 1 */
EXTERN void TclWinConvertWSAError(unsigned int errCode);
/* 2 */
-EXTERN Tcl_Channel TclpCreateCommandChannel(TclFile readFile,
- TclFile writeFile, TclFile errorFile,
- int numPids, Tcl_Pid *pidPtr);
+EXTERN struct servent * TclWinGetServByName(const char *nm,
+ const char *proto);
/* 3 */
-EXTERN int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe);
+EXTERN int TclWinGetSockOpt(void *s, int level, int optname,
+ char *optval, int *optlen);
/* 4 */
EXTERN void * TclWinGetTclInstance(void);
/* Slot 5 is reserved */
@@ -66,7 +56,7 @@ EXTERN unsigned short TclWinNToHS(unsigned short ns);
EXTERN int TclWinSetSockOpt(void *s, int level, int optname,
const char *optval, int optlen);
/* 8 */
-EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout);
+EXTERN int TclpGetPid(Tcl_Pid pid);
/* 9 */
EXTERN int TclWinGetPlatformId(void);
/* 10 */
@@ -76,7 +66,7 @@ EXTERN struct tm * TclpLocaltime_unix(const time_t *clock);
/* 12 */
EXTERN struct tm * TclpGmtime_unix(const time_t *clock);
/* 13 */
-EXTERN char * TclpInetNtoa(struct in_addr addr);
+EXTERN void TclIntPlatReserved13(void);
/* 14 */
EXTERN int TclUnixCopyFile(const char *src, const char *dst,
const Tcl_StatBuf *statBufPtr,
@@ -117,6 +107,25 @@ EXTERN void TclGetAndDetachPids(Tcl_Interp *interp,
Tcl_Channel chan);
/* 31 */
EXTERN int TclpCloseFile(TclFile file);
+/* 32 */
+EXTERN Tcl_Channel TclpCreateCommandChannel(TclFile readFile,
+ TclFile writeFile, TclFile errorFile,
+ int numPids, Tcl_Pid *pidPtr);
+/* 33 */
+EXTERN int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe);
+/* 34 */
+EXTERN int TclpCreateProcess(Tcl_Interp *interp, int argc,
+ const char **argv, TclFile inputFile,
+ TclFile outputFile, TclFile errorFile,
+ Tcl_Pid *pidPtr);
+/* 35 */
+EXTERN char * TclpInetNtoa(struct in_addr addr);
+/* 36 */
+EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction);
+/* 37 */
+EXTERN TclFile TclpOpenFile(const char *fname, int mode);
+/* 38 */
+EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout);
#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
/* 0 */
@@ -138,7 +147,7 @@ EXTERN u_short TclWinNToHS(u_short ns);
EXTERN int TclWinSetSockOpt(SOCKET s, int level, int optname,
const char *optval, int optlen);
/* 8 */
-EXTERN unsigned long TclpGetPid(Tcl_Pid pid);
+EXTERN int TclpGetPid(Tcl_Pid pid);
/* 9 */
EXTERN int TclWinGetPlatformId(void);
/* Slot 10 is reserved */
@@ -188,11 +197,11 @@ EXTERN void TclWinConvertError(unsigned int errCode);
/* 1 */
EXTERN void TclWinConvertWSAError(unsigned int errCode);
/* 2 */
-EXTERN Tcl_Channel TclpCreateCommandChannel(TclFile readFile,
- TclFile writeFile, TclFile errorFile,
- int numPids, Tcl_Pid *pidPtr);
+EXTERN struct servent * TclWinGetServByName(const char *nm,
+ const char *proto);
/* 3 */
-EXTERN int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe);
+EXTERN int TclWinGetSockOpt(void *s, int level, int optname,
+ char *optval, int *optlen);
/* 4 */
EXTERN void * TclWinGetTclInstance(void);
/* Slot 5 is reserved */
@@ -202,7 +211,7 @@ EXTERN unsigned short TclWinNToHS(unsigned short ns);
EXTERN int TclWinSetSockOpt(void *s, int level, int optname,
const char *optval, int optlen);
/* 8 */
-EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout);
+EXTERN int TclpGetPid(Tcl_Pid pid);
/* 9 */
EXTERN int TclWinGetPlatformId(void);
/* 10 */
@@ -212,7 +221,7 @@ EXTERN struct tm * TclpLocaltime_unix(const time_t *clock);
/* 12 */
EXTERN struct tm * TclpGmtime_unix(const time_t *clock);
/* 13 */
-EXTERN char * TclpInetNtoa(struct in_addr addr);
+EXTERN void TclIntPlatReserved13(void);
/* 14 */
EXTERN int TclUnixCopyFile(const char *src, const char *dst,
const Tcl_StatBuf *statBufPtr,
@@ -259,6 +268,25 @@ EXTERN void TclGetAndDetachPids(Tcl_Interp *interp,
Tcl_Channel chan);
/* 31 */
EXTERN int TclpCloseFile(TclFile file);
+/* 32 */
+EXTERN Tcl_Channel TclpCreateCommandChannel(TclFile readFile,
+ TclFile writeFile, TclFile errorFile,
+ int numPids, Tcl_Pid *pidPtr);
+/* 33 */
+EXTERN int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe);
+/* 34 */
+EXTERN int TclpCreateProcess(Tcl_Interp *interp, int argc,
+ const char **argv, TclFile inputFile,
+ TclFile outputFile, TclFile errorFile,
+ Tcl_Pid *pidPtr);
+/* 35 */
+EXTERN char * TclpInetNtoa(struct in_addr addr);
+/* 36 */
+EXTERN TclFile TclpMakeFile(Tcl_Channel channel, int direction);
+/* 37 */
+EXTERN TclFile TclpOpenFile(const char *fname, int mode);
+/* 38 */
+EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout);
#endif /* MACOSX */
typedef struct TclIntPlatStubs {
@@ -268,18 +296,18 @@ typedef struct TclIntPlatStubs {
#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
void (*tclWinConvertError) (unsigned int errCode); /* 0 */
void (*tclWinConvertWSAError) (unsigned int errCode); /* 1 */
- Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 2 */
- int (*tclpCreatePipe) (TclFile *readPipe, TclFile *writePipe); /* 3 */
+ struct servent * (*tclWinGetServByName) (const char *nm, const char *proto); /* 2 */
+ int (*tclWinGetSockOpt) (void *s, int level, int optname, char *optval, int *optlen); /* 3 */
void * (*tclWinGetTclInstance) (void); /* 4 */
void (*reserved5)(void);
unsigned short (*tclWinNToHS) (unsigned short ns); /* 6 */
int (*tclWinSetSockOpt) (void *s, int level, int optname, const char *optval, int optlen); /* 7 */
- int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */
+ int (*tclpGetPid) (Tcl_Pid pid); /* 8 */
int (*tclWinGetPlatformId) (void); /* 9 */
Tcl_DirEntry * (*tclpReaddir) (DIR *dir); /* 10 */
struct tm * (*tclpLocaltime_unix) (const time_t *clock); /* 11 */
struct tm * (*tclpGmtime_unix) (const time_t *clock); /* 12 */
- char * (*tclpInetNtoa) (struct in_addr addr); /* 13 */
+ void (*tclIntPlatReserved13) (void); /* 13 */
int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 14 */
int (*tclMacOSXGetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr); /* 15 */
void (*reserved16)(void);
@@ -298,6 +326,13 @@ typedef struct TclIntPlatStubs {
int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */
void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 30 */
int (*tclpCloseFile) (TclFile file); /* 31 */
+ Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 32 */
+ int (*tclpCreatePipe) (TclFile *readPipe, TclFile *writePipe); /* 33 */
+ int (*tclpCreateProcess) (Tcl_Interp *interp, int argc, const char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr); /* 34 */
+ char * (*tclpInetNtoa) (struct in_addr addr); /* 35 */
+ TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 36 */
+ TclFile (*tclpOpenFile) (const char *fname, int mode); /* 37 */
+ int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 38 */
#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
void (*tclWinConvertError) (DWORD errCode); /* 0 */
@@ -308,7 +343,7 @@ typedef struct TclIntPlatStubs {
void (*reserved5)(void);
u_short (*tclWinNToHS) (u_short ns); /* 6 */
int (*tclWinSetSockOpt) (SOCKET s, int level, int optname, const char *optval, int optlen); /* 7 */
- unsigned long (*tclpGetPid) (Tcl_Pid pid); /* 8 */
+ int (*tclpGetPid) (Tcl_Pid pid); /* 8 */
int (*tclWinGetPlatformId) (void); /* 9 */
void (*reserved10)(void);
void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 11 */
@@ -334,18 +369,18 @@ typedef struct TclIntPlatStubs {
#ifdef MAC_OSX_TCL /* MACOSX */
void (*tclWinConvertError) (unsigned int errCode); /* 0 */
void (*tclWinConvertWSAError) (unsigned int errCode); /* 1 */
- Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 2 */
- int (*tclpCreatePipe) (TclFile *readPipe, TclFile *writePipe); /* 3 */
+ struct servent * (*tclWinGetServByName) (const char *nm, const char *proto); /* 2 */
+ int (*tclWinGetSockOpt) (void *s, int level, int optname, char *optval, int *optlen); /* 3 */
void * (*tclWinGetTclInstance) (void); /* 4 */
void (*reserved5)(void);
unsigned short (*tclWinNToHS) (unsigned short ns); /* 6 */
int (*tclWinSetSockOpt) (void *s, int level, int optname, const char *optval, int optlen); /* 7 */
- int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */
+ int (*tclpGetPid) (Tcl_Pid pid); /* 8 */
int (*tclWinGetPlatformId) (void); /* 9 */
Tcl_DirEntry * (*tclpReaddir) (DIR *dir); /* 10 */
struct tm * (*tclpLocaltime_unix) (const time_t *clock); /* 11 */
struct tm * (*tclpGmtime_unix) (const time_t *clock); /* 12 */
- char * (*tclpInetNtoa) (struct in_addr addr); /* 13 */
+ void (*tclIntPlatReserved13) (void); /* 13 */
int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 14 */
int (*tclMacOSXGetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr); /* 15 */
int (*tclMacOSXSetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj *attributePtr); /* 16 */
@@ -364,6 +399,13 @@ typedef struct TclIntPlatStubs {
int (*tclWinCPUID) (unsigned int index, unsigned int *regs); /* 29 */
void (*tclGetAndDetachPids) (Tcl_Interp *interp, Tcl_Channel chan); /* 30 */
int (*tclpCloseFile) (TclFile file); /* 31 */
+ Tcl_Channel (*tclpCreateCommandChannel) (TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid *pidPtr); /* 32 */
+ int (*tclpCreatePipe) (TclFile *readPipe, TclFile *writePipe); /* 33 */
+ int (*tclpCreateProcess) (Tcl_Interp *interp, int argc, const char **argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid *pidPtr); /* 34 */
+ char * (*tclpInetNtoa) (struct in_addr addr); /* 35 */
+ TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 36 */
+ TclFile (*tclpOpenFile) (const char *fname, int mode); /* 37 */
+ int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 38 */
#endif /* MACOSX */
} TclIntPlatStubs;
@@ -386,10 +428,10 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclWinConvertError) /* 0 */
#define TclWinConvertWSAError \
(tclIntPlatStubsPtr->tclWinConvertWSAError) /* 1 */
-#define TclpCreateCommandChannel \
- (tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 2 */
-#define TclpCreatePipe \
- (tclIntPlatStubsPtr->tclpCreatePipe) /* 3 */
+#define TclWinGetServByName \
+ (tclIntPlatStubsPtr->tclWinGetServByName) /* 2 */
+#define TclWinGetSockOpt \
+ (tclIntPlatStubsPtr->tclWinGetSockOpt) /* 3 */
#define TclWinGetTclInstance \
(tclIntPlatStubsPtr->tclWinGetTclInstance) /* 4 */
/* Slot 5 is reserved */
@@ -397,8 +439,8 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclWinNToHS) /* 6 */
#define TclWinSetSockOpt \
(tclIntPlatStubsPtr->tclWinSetSockOpt) /* 7 */
-#define TclUnixWaitForFile \
- (tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */
+#define TclpGetPid \
+ (tclIntPlatStubsPtr->tclpGetPid) /* 8 */
#define TclWinGetPlatformId \
(tclIntPlatStubsPtr->tclWinGetPlatformId) /* 9 */
#define TclpReaddir \
@@ -407,8 +449,8 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclpLocaltime_unix) /* 11 */
#define TclpGmtime_unix \
(tclIntPlatStubsPtr->tclpGmtime_unix) /* 12 */
-#define TclpInetNtoa \
- (tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */
+#define TclIntPlatReserved13 \
+ (tclIntPlatStubsPtr->tclIntPlatReserved13) /* 13 */
#define TclUnixCopyFile \
(tclIntPlatStubsPtr->tclUnixCopyFile) /* 14 */
#define TclMacOSXGetFileAttribute \
@@ -440,6 +482,20 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclGetAndDetachPids) /* 30 */
#define TclpCloseFile \
(tclIntPlatStubsPtr->tclpCloseFile) /* 31 */
+#define TclpCreateCommandChannel \
+ (tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 32 */
+#define TclpCreatePipe \
+ (tclIntPlatStubsPtr->tclpCreatePipe) /* 33 */
+#define TclpCreateProcess \
+ (tclIntPlatStubsPtr->tclpCreateProcess) /* 34 */
+#define TclpInetNtoa \
+ (tclIntPlatStubsPtr->tclpInetNtoa) /* 35 */
+#define TclpMakeFile \
+ (tclIntPlatStubsPtr->tclpMakeFile) /* 36 */
+#define TclpOpenFile \
+ (tclIntPlatStubsPtr->tclpOpenFile) /* 37 */
+#define TclUnixWaitForFile \
+ (tclIntPlatStubsPtr->tclUnixWaitForFile) /* 38 */
#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
#define TclWinConvertError \
@@ -501,10 +557,10 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclWinConvertError) /* 0 */
#define TclWinConvertWSAError \
(tclIntPlatStubsPtr->tclWinConvertWSAError) /* 1 */
-#define TclpCreateCommandChannel \
- (tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 2 */
-#define TclpCreatePipe \
- (tclIntPlatStubsPtr->tclpCreatePipe) /* 3 */
+#define TclWinGetServByName \
+ (tclIntPlatStubsPtr->tclWinGetServByName) /* 2 */
+#define TclWinGetSockOpt \
+ (tclIntPlatStubsPtr->tclWinGetSockOpt) /* 3 */
#define TclWinGetTclInstance \
(tclIntPlatStubsPtr->tclWinGetTclInstance) /* 4 */
/* Slot 5 is reserved */
@@ -512,8 +568,8 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclWinNToHS) /* 6 */
#define TclWinSetSockOpt \
(tclIntPlatStubsPtr->tclWinSetSockOpt) /* 7 */
-#define TclUnixWaitForFile \
- (tclIntPlatStubsPtr->tclUnixWaitForFile) /* 8 */
+#define TclpGetPid \
+ (tclIntPlatStubsPtr->tclpGetPid) /* 8 */
#define TclWinGetPlatformId \
(tclIntPlatStubsPtr->tclWinGetPlatformId) /* 9 */
#define TclpReaddir \
@@ -522,8 +578,8 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclpLocaltime_unix) /* 11 */
#define TclpGmtime_unix \
(tclIntPlatStubsPtr->tclpGmtime_unix) /* 12 */
-#define TclpInetNtoa \
- (tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */
+#define TclIntPlatReserved13 \
+ (tclIntPlatStubsPtr->tclIntPlatReserved13) /* 13 */
#define TclUnixCopyFile \
(tclIntPlatStubsPtr->tclUnixCopyFile) /* 14 */
#define TclMacOSXGetFileAttribute \
@@ -557,6 +613,20 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
(tclIntPlatStubsPtr->tclGetAndDetachPids) /* 30 */
#define TclpCloseFile \
(tclIntPlatStubsPtr->tclpCloseFile) /* 31 */
+#define TclpCreateCommandChannel \
+ (tclIntPlatStubsPtr->tclpCreateCommandChannel) /* 32 */
+#define TclpCreatePipe \
+ (tclIntPlatStubsPtr->tclpCreatePipe) /* 33 */
+#define TclpCreateProcess \
+ (tclIntPlatStubsPtr->tclpCreateProcess) /* 34 */
+#define TclpInetNtoa \
+ (tclIntPlatStubsPtr->tclpInetNtoa) /* 35 */
+#define TclpMakeFile \
+ (tclIntPlatStubsPtr->tclpMakeFile) /* 36 */
+#define TclpOpenFile \
+ (tclIntPlatStubsPtr->tclpOpenFile) /* 37 */
+#define TclUnixWaitForFile \
+ (tclIntPlatStubsPtr->tclUnixWaitForFile) /* 38 */
#endif /* MACOSX */
#endif /* defined(USE_TCL_STUBS) */
@@ -567,28 +637,13 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr;
#define TCL_STORAGE_CLASS DLLIMPORT
#undef TclpLocaltime_unix
#undef TclpGmtime_unix
+#undef TclIntPlatReserved13
#undef TclWinConvertWSAError
#define TclWinConvertWSAError TclWinConvertError
-
-#if !defined(__WIN32__) && defined(USE_TCL_STUBS)
-# ifdef __CYGWIN__
-# define TclpCreateProcess ((int (*) _ANSI_ARGS_((Tcl_Interp *, int, \
- CONST char **, TclFile, TclFile, TclFile, Tcl_Pid *))) \
- tclIntPlatStubsPtr->tclMacOSXGetFileAttribute)
-# define TclpMakeFile ((TclFile (*) _ANSI_ARGS_((Tcl_Channel channel, \
- int direction))) tclIntPlatStubsPtr->tclMacOSXMatchType)
-# define TclpOpenFile ((TclFile (*) _ANSI_ARGS_((CONST char *, int))) \
- tclIntPlatStubsPtr->tclMacOSXNotifierAddRunLoopMode)
-# else
-# define TclpCreateProcess ((int (*) _ANSI_ARGS_((Tcl_Interp *, int, \
- CONST char **, TclFile, TclFile, TclFile, Tcl_Pid *))) \
- tclIntPlatStubsPtr->tclWinGetTclInstance)
-# define TclpMakeFile ((TclFile (*) _ANSI_ARGS_((Tcl_Channel channel, \
- int direction))) tclIntPlatStubsPtr->tclWinNToHS)
-# define TclpOpenFile ((TclFile (*) _ANSI_ARGS_((CONST char *, int))) \
- tclIntPlatStubsPtr->tclWinNToHS)
-# endif
+#if !defined(__WIN32__)
+# undef TclpGetPid
+# define TclpGetPid(pid) ((unsigned long) (pid))
#endif
#endif /* _TCLINTPLATDECLS */
diff --git a/generic/tclMain.c b/generic/tclMain.c
index 373e3f6..88b4e51 100644
--- a/generic/tclMain.c
+++ b/generic/tclMain.c
@@ -53,20 +53,23 @@
#endif
/*
- * Further on, in UNICODE mode, we need to use Tcl_NewUnicodeObj,
- * while otherwise NewNativeObj is needed (which provides proper
- * conversion from native encoding to UTF-8).
+ * Further on, in UNICODE mode we just use Tcl_NewUnicodeObj, otherwise
+ * NewNativeObj is needed (which provides proper conversion from native
+ * encoding to UTF-8).
*/
+
#ifdef UNICODE
# define NewNativeObj Tcl_NewUnicodeObj
#else /* !UNICODE */
- static Tcl_Obj *NewNativeObj(char *string, int length) {
- Tcl_Obj *obj;
- Tcl_DString ds;
- Tcl_ExternalToUtfDString(NULL, string, length, &ds);
- obj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
- Tcl_DStringFree(&ds);
- return obj;
+static inline Tcl_Obj *
+NewNativeObj(
+ char *string,
+ int length)
+{
+ Tcl_DString ds;
+
+ Tcl_ExternalToUtfDString(NULL, string, length, &ds);
+ return TclDStringToObj(&ds);
}
#endif /* !UNICODE */
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index ba07808..4f86755 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -2373,7 +2373,6 @@ SetFsPathFromAny(
*/
if (name[0] == '~') {
- char *expandedUser;
Tcl_DString temp;
int split;
char separator = '/';
@@ -2442,8 +2441,7 @@ SetFsPathFromAny(
}
}
- expandedUser = Tcl_DStringValue(&temp);
- transPtr = Tcl_NewStringObj(expandedUser, Tcl_DStringLength(&temp));
+ transPtr = TclDStringToObj(&temp);
if (split != len) {
/*
@@ -2488,7 +2486,6 @@ SetFsPathFromAny(
transPtr = joined;
}
}
- Tcl_DStringFree(&temp);
} else {
transPtr = TclJoinPath(1, &pathPtr);
}
diff --git a/generic/tclPipe.c b/generic/tclPipe.c
index 5f59c38..d0b136d 100644
--- a/generic/tclPipe.c
+++ b/generic/tclPipe.c
@@ -284,7 +284,7 @@ TclCleanupChildren(
for (i = 0; i < numPids; i++) {
/*
* We need to get the resolved pid before we wait on it as the windows
- * implimentation of Tcl_WaitPid deletes the information such that any
+ * implementation of Tcl_WaitPid deletes the information such that any
* following calls to TclpGetPid fail.
*/
diff --git a/generic/tclPort.h b/generic/tclPort.h
index 79bea88..d9361ca 100644
--- a/generic/tclPort.h
+++ b/generic/tclPort.h
@@ -35,7 +35,7 @@
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 *);
+ //DLLIMPORT extern void __stdcall SetEnvironmentVariableA(const char*, const char *);
#endif
#if !defined(LLONG_MIN)
diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c
index 5c5af7b..53d7153 100644
--- a/generic/tclRegexp.c
+++ b/generic/tclRegexp.c
@@ -947,10 +947,8 @@ CompileRegexp(
*/
if (TclReToGlob(NULL, string, length, &stringBuf, &exact) == TCL_OK) {
- regexpPtr->globObjPtr = Tcl_NewStringObj(Tcl_DStringValue(&stringBuf),
- Tcl_DStringLength(&stringBuf));
+ regexpPtr->globObjPtr = TclDStringToObj(&stringBuf);
Tcl_IncrRefCount(regexpPtr->globObjPtr);
- Tcl_DStringFree(&stringBuf);
} else {
regexpPtr->globObjPtr = NULL;
}
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 42f5c43..8c0eff6 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -39,6 +39,7 @@
#undef Tcl_CreateHashEntry
#undef Tcl_Panic
#undef Tcl_FindExecutable
+#undef TclpGetPid
#undef TclSockMinimumBuffers
/* See bug 510001: TclSockMinimumBuffers needs plat imp */
@@ -46,9 +47,7 @@
# define TclSockMinimumBuffersOld 0
#else
#define TclSockMinimumBuffersOld sockMinimumBuffersOld
-static int TclSockMinimumBuffersOld(sock, size)
- int sock;
- int size;
+static int TclSockMinimumBuffersOld(int sock, int size)
{
return TclSockMinimumBuffers(INT2PTR(sock), size);
}
@@ -67,11 +66,15 @@ int __stdcall GetModuleHandleExW(unsigned int, const char *, void *);
#define TclWinGetTclInstance winGetTclInstance
#define TclWinNToHS winNToHS
#define TclWinSetSockOpt winSetSockOpt
+#define TclWinGetSockOpt winGetSockOpt
+#define TclWinGetServByName winGetServByName
#define TclWinNoBackslash winNoBackslash
#define TclWinSetInterfaces (void (*) (int)) doNothing
#define TclWinAddProcess (void (*) (void *, unsigned int)) doNothing
+#define TclIntPlatReserved13 (void (*) ()) TclpCreateCommandChannel
#define TclWinFlushDirtyChannels doNothing
#define TclWinResetInterfaces doNothing
+#define TclpGetPid getPid
static Tcl_Encoding winTCharEncoding;
@@ -104,6 +107,19 @@ TclWinSetSockOpt(void *s, int level, int optname,
return setsockopt((int) s, level, optname, optval, optlen);
}
+static int
+TclWinGetSockOpt(void *s, int level, int optname,
+ char *optval, int *optlen)
+{
+ return getsockopt((int) s, level, optname, optval, optlen);
+}
+
+struct servent *
+TclWinGetServByName(const char *name, const char *proto)
+{
+ return getservbyname(name, proto);
+}
+
static char *
TclWinNoBackslash(char *path)
{
@@ -117,6 +133,12 @@ TclWinNoBackslash(char *path)
return path;
}
+static int
+TclpGetPid(Tcl_Pid pid)
+{
+ return (int) (size_t) pid;
+}
+
static void
doNothing(void)
{
@@ -169,15 +191,19 @@ Tcl_WinTCharToUtf(
# 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 TclWinGetSockOpt (int (*) _ANSI_ARGS_((void *, int, int, char *, int))) TclpCreatePipe
+# define TclWinGetServByName (struct servent *(*) _ANSI_ARGS_((const char *nm, const char *proto))) TclpCreateCommandChannel
+# define TclIntPlatReserved13 (void (*) ()) TclpInetNtoa
# define TclWinAddProcess 0
# define TclWinNoBackslash 0
# define TclWinSetInterfaces 0
# define TclWinFlushDirtyChannels 0
# define TclWinResetInterfaces 0
-# define TclMacOSXGetFileAttribute 0 /* Only implemented in Tcl >= 8.5 */
-# define TclMacOSXMatchType 0 /* Only implemented in Tcl >= 8.5 */
-# define TclMacOSXNotifierAddRunLoopMode 0 /* Only implemented in Tcl >= 8.5 */
+# define TclpGetPid 0
# ifndef MAC_OSX_TCL
+# define TclMacOSXMatchType 0
+# define TclMacOSXNotifierAddRunLoopMode 0
+# define TclMacOSXGetFileAttribute 0
# define Tcl_MacOSXOpenBundleResources 0
# define Tcl_MacOSXOpenVersionedBundleResources 0
# endif
@@ -458,18 +484,18 @@ static const TclIntPlatStubs tclIntPlatStubs = {
#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */
TclWinConvertError, /* 0 */
TclWinConvertWSAError, /* 1 */
- TclpCreateCommandChannel, /* 2 */
- TclpCreatePipe, /* 3 */
+ TclWinGetServByName, /* 2 */
+ TclWinGetSockOpt, /* 3 */
TclWinGetTclInstance, /* 4 */
0, /* 5 */
TclWinNToHS, /* 6 */
TclWinSetSockOpt, /* 7 */
- TclUnixWaitForFile, /* 8 */
+ TclpGetPid, /* 8 */
TclWinGetPlatformId, /* 9 */
TclpReaddir, /* 10 */
TclpLocaltime_unix, /* 11 */
TclpGmtime_unix, /* 12 */
- TclpInetNtoa, /* 13 */
+ TclIntPlatReserved13, /* 13 */
TclUnixCopyFile, /* 14 */
TclMacOSXGetFileAttribute, /* 15 */
0, /* 16 */
@@ -488,6 +514,13 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclWinCPUID, /* 29 */
TclGetAndDetachPids, /* 30 */
TclpCloseFile, /* 31 */
+ TclpCreateCommandChannel, /* 32 */
+ TclpCreatePipe, /* 33 */
+ TclpCreateProcess, /* 34 */
+ TclpInetNtoa, /* 35 */
+ TclpMakeFile, /* 36 */
+ TclpOpenFile, /* 37 */
+ TclUnixWaitForFile, /* 38 */
#endif /* UNIX */
#ifdef __WIN32__ /* WIN */
TclWinConvertError, /* 0 */
@@ -524,18 +557,18 @@ static const TclIntPlatStubs tclIntPlatStubs = {
#ifdef MAC_OSX_TCL /* MACOSX */
TclWinConvertError, /* 0 */
TclWinConvertWSAError, /* 1 */
- TclpCreateCommandChannel, /* 2 */
- TclpCreatePipe, /* 3 */
+ TclWinGetServByName, /* 2 */
+ TclWinGetSockOpt, /* 3 */
TclWinGetTclInstance, /* 4 */
0, /* 5 */
TclWinNToHS, /* 6 */
TclWinSetSockOpt, /* 7 */
- TclUnixWaitForFile, /* 8 */
+ TclpGetPid, /* 8 */
TclWinGetPlatformId, /* 9 */
TclpReaddir, /* 10 */
TclpLocaltime_unix, /* 11 */
TclpGmtime_unix, /* 12 */
- TclpInetNtoa, /* 13 */
+ TclIntPlatReserved13, /* 13 */
TclUnixCopyFile, /* 14 */
TclMacOSXGetFileAttribute, /* 15 */
TclMacOSXSetFileAttribute, /* 16 */
@@ -554,6 +587,13 @@ static const TclIntPlatStubs tclIntPlatStubs = {
TclWinCPUID, /* 29 */
TclGetAndDetachPids, /* 30 */
TclpCloseFile, /* 31 */
+ TclpCreateCommandChannel, /* 32 */
+ TclpCreatePipe, /* 33 */
+ TclpCreateProcess, /* 34 */
+ TclpInetNtoa, /* 35 */
+ TclpMakeFile, /* 36 */
+ TclpOpenFile, /* 37 */
+ TclUnixWaitForFile, /* 38 */
#endif /* MACOSX */
};
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 37ec751..004fadc 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -3262,7 +3262,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/tclTrace.c b/generic/tclTrace.c
index 2e38086..25abdff 100644
--- a/generic/tclTrace.c
+++ b/generic/tclTrace.c
@@ -113,7 +113,7 @@ static const char *const traceTypeOptions[] = {
static Tcl_TraceTypeObjCmd *const traceSubCmds[] = {
TraceExecutionObjCmd,
TraceCommandObjCmd,
- TraceVariableObjCmd,
+ TraceVariableObjCmd
};
/*
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index a1c1996..d5a3b94 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -2715,6 +2715,64 @@ Tcl_DStringGetResult(
/*
*----------------------------------------------------------------------
*
+ * TclDStringToObj --
+ *
+ * This function moves a dynamic string's contents to a new Tcl_Obj. Be
+ * aware that this function does *not* check that the encoding of the
+ * contents of the dynamic string is correct; this is the caller's
+ * responsibility to enforce.
+ *
+ * Results:
+ * The newly-allocated untyped (i.e., typePtr==NULL) Tcl_Obj with a
+ * reference count of zero.
+ *
+ * Side effects:
+ * The string is "moved" to the object. dsPtr is reinitialized to an
+ * empty string; it does not need to be Tcl_DStringFree'd after this if
+ * not used further.
+ *
+ *----------------------------------------------------------------------
+ */
+
+Tcl_Obj *
+TclDStringToObj(
+ Tcl_DString *dsPtr)
+{
+ Tcl_Obj *result;
+
+ if (dsPtr->length == 0) {
+ TclNewObj(result);
+ } else if (dsPtr->string == dsPtr->staticSpace) {
+ /*
+ * Static buffer, so must copy.
+ */
+
+ TclNewStringObj(result, dsPtr->string, dsPtr->length);
+ } else {
+ /*
+ * Dynamic buffer, so transfer ownership and reset.
+ */
+
+ TclNewObj(result);
+ result->bytes = dsPtr->string;
+ result->length = dsPtr->length;
+ }
+
+ /*
+ * Re-establish the DString as empty with no buffer allocated.
+ */
+
+ dsPtr->string = dsPtr->staticSpace;
+ dsPtr->spaceAvl = TCL_DSTRING_STATIC_SIZE;
+ dsPtr->length = 0;
+ dsPtr->staticSpace[0] = '\0';
+
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* Tcl_DStringStartSublist --
*
* This function adds the necessary information to a dynamic string
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index 6290d60..51d6beb 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -417,9 +417,7 @@ ExtractHeader(
Tcl_ExternalToUtfDString(latin1enc, (char *) headerPtr->comment, -1,
&tmp);
- SetValue(dictObj, "comment", Tcl_NewStringObj(Tcl_DStringValue(&tmp),
- Tcl_DStringLength(&tmp)));
- Tcl_DStringFree(&tmp);
+ SetValue(dictObj, "comment", TclDStringToObj(&tmp));
}
SetValue(dictObj, "crc", Tcl_NewBooleanObj(headerPtr->hcrc));
if (headerPtr->name != Z_NULL) {
@@ -436,9 +434,7 @@ ExtractHeader(
Tcl_ExternalToUtfDString(latin1enc, (char *) headerPtr->name, -1,
&tmp);
- SetValue(dictObj, "filename", Tcl_NewStringObj(Tcl_DStringValue(&tmp),
- Tcl_DStringLength(&tmp)));
- Tcl_DStringFree(&tmp);
+ SetValue(dictObj, "filename", TclDStringToObj(&tmp));
}
if (headerPtr->os != 255) {
SetValue(dictObj, "os", Tcl_NewIntObj(headerPtr->os));
diff --git a/library/dde/pkgIndex.tcl b/library/dde/pkgIndex.tcl
index 194e4cd..9e62ac8 100644
--- a/library/dde/pkgIndex.tcl
+++ b/library/dde/pkgIndex.tcl
@@ -1,5 +1,5 @@
-if {![package vsatisfies [package provide Tcl] 8.5]} {return}
-if {[string compare $::tcl_platform(platform) windows]} {return}
+if {![package vsatisfies [package provide Tcl] 8.5]} return
+if {[string compare [info sharedlibextension] .dll]} return
if {[::tcl::pkgconfig get debug]} {
package ifneeded dde 1.3.2 [list load [file join $dir tcldde13g.dll] dde]
} else {
diff --git a/library/reg/pkgIndex.tcl b/library/reg/pkgIndex.tcl
index 92335f3..067425f 100755
--- a/library/reg/pkgIndex.tcl
+++ b/library/reg/pkgIndex.tcl
@@ -1,5 +1,5 @@
-if {![package vsatisfies [package provide Tcl] 8.5]} {return}
-if {[string compare $::tcl_platform(platform) windows]} {return}
+if {![package vsatisfies [package provide Tcl] 8.5]} return
+if {[string compare [info sharedlibextension] .dll]} return
if {[::tcl::pkgconfig get debug]} {
package ifneeded registry 1.3 \
[list load [file join $dir tclreg13g.dll] registry]
diff --git a/unix/Makefile.in b/unix/Makefile.in
index a9024db..0c63c3f 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -47,6 +47,7 @@ BIN_INSTALL_DIR = $(INSTALL_ROOT)$(bindir)
# Directory in which to install libtcl.so or libtcl.a:
LIB_INSTALL_DIR = $(INSTALL_ROOT)$(libdir)
+DLL_INSTALL_DIR = @DLL_INSTALL_DIR@
# Path name to use when installing library scripts.
SCRIPT_INSTALL_DIR = $(INSTALL_ROOT)$(TCL_LIBRARY)
@@ -782,9 +783,9 @@ install-binaries: binaries
else true; \
fi; \
done;
- @echo "Installing $(LIB_FILE) to @DLL_INSTALL_DIR@/"
+ @echo "Installing $(LIB_FILE) to $(DLL_INSTALL_DIR)/"
@@INSTALL_LIB@
- @chmod 555 "@DLL_INSTALL_DIR@"/$(LIB_FILE)
+ @chmod 555 "$(DLL_INSTALL_DIR)"/$(LIB_FILE)
@echo "Installing ${TCL_EXE} as $(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}"
@$(INSTALL_PROGRAM) ${TCL_EXE} "$(BIN_INSTALL_DIR)"/tclsh$(VERSION)${EXE_SUFFIX}
@echo "Installing tclConfig.sh to $(CONFIG_INSTALL_DIR)/"
diff --git a/unix/configure b/unix/configure
index d87b633..cb4f9f1 100755
--- a/unix/configure
+++ b/unix/configure
@@ -9132,7 +9132,7 @@ fi
UNSHARED_LIB_SUFFIX='${VERSION}.a'
fi
- DLL_INSTALL_DIR="\$(LIB_INSTALL_DIR)"
+ DLL_INSTALL_DIR="\$(LIB_INSTALL_DIR)"
if test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""; then
@@ -19340,6 +19340,76 @@ echo "$as_me:$LINENO: result: $tcl_ok" >&5
echo "${ECHO_T}$tcl_ok" >&6
#--------------------------------------------------------------------
+# The check below checks whether the cpuid instruction is usable.
+#--------------------------------------------------------------------
+
+echo "$as_me:$LINENO: checking whether the cpuid instruction is usable" >&5
+echo $ECHO_N "checking whether the cpuid instruction is usable... $ECHO_C" >&6
+if test "${tcl_cv_cpuid+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ int index,ax,bx,cx,dx;
+ __asm__ __volatile__ ("cpuid":\
+ "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (index));
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_cv_cpuid=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_cv_cpuid=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $tcl_cv_cpuid" >&5
+echo "${ECHO_T}$tcl_cv_cpuid" >&6
+if test $tcl_cv_cpuid = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_CPUID 1
+_ACEOF
+
+fi
+
+#--------------------------------------------------------------------
# The statements below define a collection of symbols related to
# building libtcl as a shared library instead of a static library.
#--------------------------------------------------------------------
diff --git a/unix/configure.in b/unix/configure.in
index 745e1e3..29dc027 100644
--- a/unix/configure.in
+++ b/unix/configure.in
@@ -750,6 +750,20 @@ fi
AC_MSG_RESULT([$tcl_ok])
#--------------------------------------------------------------------
+# The check below checks whether the cpuid instruction is usable.
+#--------------------------------------------------------------------
+
+AC_CACHE_CHECK([whether the cpuid instruction is usable], tcl_cv_cpuid, [
+ AC_TRY_LINK(, [
+ int index,ax,bx,cx,dx;
+ __asm__ __volatile__ ("cpuid":\
+ "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (index));
+ ], tcl_cv_cpuid=yes, tcl_cv_cpuid=no)])
+if test $tcl_cv_cpuid = yes; then
+ AC_DEFINE(HAVE_CPUID)
+fi
+
+#--------------------------------------------------------------------
# The statements below define a collection of symbols related to
# building libtcl as a shared library instead of a static library.
#--------------------------------------------------------------------
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 222c375..85b48fa 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -2088,7 +2088,7 @@ dnl # preprocessing tests use only CPPFLAGS.
SHARED_LIB_SUFFIX='${VERSION}${SHLIB_SUFFIX}'])
AS_IF([test "$UNSHARED_LIB_SUFFIX" = ""], [
UNSHARED_LIB_SUFFIX='${VERSION}.a'])
- DLL_INSTALL_DIR="\$(LIB_INSTALL_DIR)"
+ DLL_INSTALL_DIR="\$(LIB_INSTALL_DIR)"
AS_IF([test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""], [
LIB_SUFFIX=${SHARED_LIB_SUFFIX}
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index 866d77d..db137aa 100644
--- a/unix/tclUnixChan.c
+++ b/unix/tclUnixChan.c
@@ -981,7 +981,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/unix/tclUnixCompat.c b/unix/tclUnixCompat.c
index 48ba4d3..d3da962 100644
--- a/unix/tclUnixCompat.c
+++ b/unix/tclUnixCompat.c
@@ -990,7 +990,11 @@ TclWinCPUID(
{
int status = TCL_ERROR;
- /* There is no reason this couldn't be implemented on UNIX as well */
+#ifdef HAVE_CPUID
+ __asm__ __volatile__ ("cpuid":\
+ "=a" (regsPtr[0]), "=b" (regsPtr[1]), "=c" (regsPtr[2]), "=d" (regsPtr[3]) : "a" (index));
+ status = TCL_OK;
+#endif
return status;
}
diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c
index e3d9022..fce071f 100644
--- a/unix/tclUnixFCmd.c
+++ b/unix/tclUnixFCmd.c
@@ -1387,11 +1387,9 @@ GetOwnerAttribute(
*attributePtrPtr = Tcl_NewIntObj((int) statBuf.st_uid);
} else {
Tcl_DString ds;
- const char *utf;
- utf = Tcl_ExternalToUtfDString(NULL, pwPtr->pw_name, -1, &ds);
- *attributePtrPtr = Tcl_NewStringObj(utf, Tcl_DStringLength(&ds));
- Tcl_DStringFree(&ds);
+ (void) Tcl_ExternalToUtfDString(NULL, pwPtr->pw_name, -1, &ds);
+ *attributePtrPtr = TclDStringToObj(&ds);
}
return TCL_OK;
}
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index fe3c608..b4a1012 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.c
@@ -22,7 +22,8 @@ static int NativeMatchType(Tcl_Interp *interp, const char* nativeEntry,
* TclpFindExecutable --
*
* This function computes the absolute path name of the current
- * application, given its argv[0] value.
+ * application, given its argv[0] value. For Cygwin, argv[0] is
+ * ignored and the path is determined the same as under win32.
*
* Results:
* None.
@@ -38,6 +39,29 @@ TclpFindExecutable(
const char *argv0) /* The value of the application's argv[0]
* (native). */
{
+#ifdef __CYGWIN__
+ int length;
+ char buf[PATH_MAX * TCL_UTF_MAX + 1];
+ char name[PATH_MAX * TCL_UTF_MAX + 1];
+
+ /* Make some symbols available without including <windows.h> */
+# define CP_UTF8 65001
+ extern int cygwin_conv_to_full_posix_path(const char *, char *);
+ extern __stdcall int GetModuleFileNameW(void *, const char *, int);
+ extern __stdcall int WideCharToMultiByte(int, int, const char *, int,
+ const char *, int, const char *, const char *);
+
+ GetModuleFileNameW(NULL, name, PATH_MAX);
+ WideCharToMultiByte(CP_UTF8, 0, name, -1, buf, PATH_MAX, NULL, NULL);
+ cygwin_conv_to_full_posix_path(buf, name);
+ length = strlen(name);
+ if ((length > 4) && !strcasecmp(name + length - 4, ".exe")) {
+ /* Strip '.exe' part. */
+ length -= 4;
+ }
+ TclSetObjNameOfExecutable(
+ Tcl_NewStringObj(name, length), Tcl_GetEncoding(NULL, NULL));
+#else
const char *name, *p;
Tcl_StatBuf statBuf;
Tcl_DString buffer, nameString, cwd, utfName;
@@ -174,6 +198,7 @@ TclpFindExecutable(
done:
Tcl_DStringFree(&buffer);
+#endif
}
/*
@@ -974,12 +999,8 @@ TclpObjLink(
}
Tcl_ExternalToUtfDString(NULL, link, length, &ds);
- linkPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds),
- Tcl_DStringLength(&ds));
- Tcl_DStringFree(&ds);
- if (linkPtr != NULL) {
- Tcl_IncrRefCount(linkPtr);
- }
+ linkPtr = TclDStringToObj(&ds);
+ Tcl_IncrRefCount(linkPtr);
return linkPtr;
}
}
@@ -1041,19 +1062,9 @@ TclpNativeToNormalized(
ClientData clientData)
{
Tcl_DString ds;
- Tcl_Obj *objPtr;
- int len;
-
- const char *copy;
- Tcl_ExternalToUtfDString(NULL, (const char*)clientData, -1, &ds);
-
- copy = Tcl_DStringValue(&ds);
- len = Tcl_DStringLength(&ds);
-
- objPtr = Tcl_NewStringObj(copy,len);
- Tcl_DStringFree(&ds);
- return objPtr;
+ Tcl_ExternalToUtfDString(NULL, (const char *) clientData, -1, &ds);
+ return TclDStringToObj(&ds);
}
/*
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 8f872d5..bc1b0e7 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -454,8 +454,7 @@ TclpInitLibraryPath(
* If TCL_LIBRARY is set, search there.
*/
- objPtr = Tcl_NewStringObj(str, -1);
- Tcl_ListObjAppendElement(NULL, pathPtr, objPtr);
+ Tcl_ListObjAppendElement(NULL, pathPtr, Tcl_NewStringObj(str, -1));
Tcl_SplitPath(str, &pathc, &pathv);
if ((pathc > 0) && (strcasecmp(installLib + 4, pathv[pathc-1]) != 0)) {
@@ -469,9 +468,7 @@ TclpInitLibraryPath(
pathv[pathc - 1] = installLib + 4;
str = Tcl_JoinPath(pathc, pathv, &ds);
- objPtr = Tcl_NewStringObj(str, Tcl_DStringLength(&ds));
- Tcl_ListObjAppendElement(NULL, pathPtr, objPtr);
- Tcl_DStringFree(&ds);
+ Tcl_ListObjAppendElement(NULL, pathPtr, TclDStringToObj(&ds));
}
ckfree(pathv);
}
diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h
index 4adb36c..98ef3c8 100644
--- a/unix/tclUnixPort.h
+++ b/unix/tclUnixPort.h
@@ -668,7 +668,6 @@ typedef int socklen_t;
*---------------------------------------------------------------------------
*/
-#define TclpGetPid(pid) ((unsigned long) (pid))
#define TclpReleaseFile(file) /* Nothing. */
/*
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c
index fea9ddb..9d0131e 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};
@@ -1011,13 +1011,12 @@ TclpObjRemoveDirectory(
}
if (ret != TCL_OK) {
- int len = Tcl_DStringLength(&ds);
- if (len > 0) {
+ if (Tcl_DStringLength(&ds) > 0) {
if (normPtr != NULL &&
!strcmp(Tcl_DStringValue(&ds), TclGetString(normPtr))) {
*errorPtr = pathPtr;
} else {
- *errorPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds), -1);
+ *errorPtr = TclDStringToObj(&ds);
}
Tcl_IncrRefCount(*errorPtr);
}
@@ -1762,6 +1761,7 @@ ConvertFileNameFormat(
Tcl_DStringInit(&dsTemp);
Tcl_WinTCharToUtf(nativeName, -1, &dsTemp);
+ Tcl_DStringFree(&ds);
/*
* Deal with issues of tildes being absolute.
@@ -1771,13 +1771,11 @@ ConvertFileNameFormat(
TclNewLiteralStringObj(tempPath, "./");
Tcl_AppendToObj(tempPath, Tcl_DStringValue(&dsTemp),
Tcl_DStringLength(&dsTemp));
+ Tcl_DStringFree(&dsTemp);
} else {
- tempPath = Tcl_NewStringObj(Tcl_DStringValue(&dsTemp),
- Tcl_DStringLength(&dsTemp));
+ tempPath = TclDStringToObj(&dsTemp);
}
Tcl_ListObjReplace(NULL, splitPath, i, 1, 1, &tempPath);
- Tcl_DStringFree(&ds);
- Tcl_DStringFree(&dsTemp);
FindClose(handle);
}
}
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index dcc05bb..2cc14ec 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -2350,13 +2350,9 @@ TclpFilesystemPathType(
return NULL;
} else {
Tcl_DString ds;
- Tcl_Obj *objPtr;
Tcl_WinTCharToUtf(volType, -1, &ds);
- objPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds),
- Tcl_DStringLength(&ds));
- Tcl_DStringFree(&ds);
- return objPtr;
+ return TclDStringToObj(&ds);
}
#undef VOL_BUF_SIZE
}
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index fb53685..3bfff63 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -299,9 +299,8 @@ AppendEnvironment(
pathv[pathc - 1] = shortlib;
Tcl_DStringInit(&ds);
- str = Tcl_JoinPath(pathc, pathv, &ds);
- objPtr = Tcl_NewStringObj(str, Tcl_DStringLength(&ds));
- Tcl_DStringFree(&ds);
+ (void) Tcl_JoinPath(pathc, pathv, &ds);
+ objPtr = TclDStringToObj(&ds);
} else {
objPtr = Tcl_NewStringObj(buf, -1);
}
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index f1b18df..fd195c4 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.c
@@ -860,7 +860,7 @@ TclpCloseFile(
*--------------------------------------------------------------------------
*/
-unsigned long
+int
TclpGetPid(
Tcl_Pid pid) /* The HANDLE of the child process. */
{
@@ -1290,7 +1290,7 @@ ApplicationType(
Tcl_DString nameBuf, ds;
const TCHAR *nativeName;
TCHAR 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 1390415..937089c 100644
--- a/win/tclWinReg.c
+++ b/win/tclWinReg.c
@@ -67,7 +67,7 @@ static const char *const 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 6ef1157..392e830 100644
--- a/win/tclWinTest.c
+++ b/win/tclWinTest.c
@@ -430,7 +430,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,