diff options
author | dgp <dgp@users.sourceforge.net> | 2004-06-18 20:38:00 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2004-06-18 20:38:00 (GMT) |
commit | 1247e7630960b0ed9658d606b4a11e5855bf5298 (patch) | |
tree | 62641558728e9adf15391570df8b7c2fe4f8f179 /generic | |
parent | 5aa07287a0a3096095738841d801cd1fc7670a34 (diff) | |
download | tcl-1247e7630960b0ed9658d606b4a11e5855bf5298.zip tcl-1247e7630960b0ed9658d606b4a11e5855bf5298.tar.gz tcl-1247e7630960b0ed9658d606b4a11e5855bf5298.tar.bz2 |
* generic/tclEncoding.c: Static TclFindEncodings -> FindEncodings.
* generic/tclInt.h: Updated TclpFindExecutable() so that failed
* generic/tclUtil.c: attempts to find the executable are saved
* unix/tclUnixFile.c: just as successful finds are. [Patch 966053]
* unix/tclUnixTest.c:
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclEncoding.c | 28 | ||||
-rw-r--r-- | generic/tclInt.h | 3 | ||||
-rw-r--r-- | generic/tclUtil.c | 3 |
3 files changed, 19 insertions, 15 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 7552eb4..558487e 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclEncoding.c,v 1.22 2004/05/07 20:01:23 rmax Exp $ + * RCS: @(#) $Id: tclEncoding.c,v 1.23 2004/06/18 20:38:01 dgp Exp $ */ #include "tclInt.h" @@ -236,7 +236,7 @@ static int UtfExtToUtfIntProc _ANSI_ARGS_((ClientData clientData, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)); -static int TclFindEncodings _ANSI_ARGS_((CONST char *argv0)); +static int FindEncodings(); /* @@ -1142,7 +1142,7 @@ Tcl_FindExecutable(argv0) /* * The value returned from TclpNameOfExecutable is a UTF string that * is possibly dirty depending on when it was initialized. - * TclFindEncodings will indicate whether we must "clean" the UTF (as + * FindEncodings will indicate whether we must "clean" the UTF (as * reported by the underlying system). To assure that the UTF string * is a properly encoded native string for this system, convert the * UTF string to the default native encoding before the default @@ -1151,7 +1151,7 @@ Tcl_FindExecutable(argv0) */ Tcl_UtfToExternalDString(NULL, name, -1, &buffer); - mustCleanUtf = TclFindEncodings(argv0); + mustCleanUtf = FindEncodings(); /* * Now it is OK to convert the native string back to UTF and set @@ -1174,7 +1174,7 @@ Tcl_FindExecutable(argv0) return; done: - (void) TclFindEncodings(argv0); + (void) FindEncodings(); } /* @@ -2942,7 +2942,7 @@ unilen(src) /* *------------------------------------------------------------------------- * - * TclFindEncodings -- + * FindEncodings -- * * Find and load the encoding file for this operating system. * Before this is called, Tcl makes assumptions about the @@ -2959,10 +2959,8 @@ unilen(src) *------------------------------------------------------------------------- */ -int -TclFindEncodings(argv0) - CONST char *argv0; /* Name of executable from argv[0] to main() - * in native multi-byte encoding. */ +static int +FindEncodings() { int mustCleanUtf = 0; @@ -2974,7 +2972,6 @@ TclFindEncodings(argv0) TclpInitLock(); if (encodingsInitialized == 0) { - char *native; Tcl_Obj *pathPtr; Tcl_DString libPath, buffer; @@ -2985,8 +2982,13 @@ TclFindEncodings(argv0) encodingsInitialized = 1; - native = TclpFindExecutable(argv0); - mustCleanUtf = TclpInitLibraryPath(native); + /* + * NOTE: we can safely make direct use of tclNativeExecutableName + * because we know all our callers ( Tcl_FindExecutable() is the + * only one) have already called TclpFindExecutable(). + */ + + mustCleanUtf = TclpInitLibraryPath(tclNativeExecutableName); /* * The library path was set in the TclpInitLibraryPath routine. diff --git a/generic/tclInt.h b/generic/tclInt.h index e96b5a8..6723f03 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInt.h,v 1.164 2004/06/18 15:12:39 dkf Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.165 2004/06/18 20:38:01 dgp Exp $ */ #ifndef _TCLINT @@ -1641,6 +1641,7 @@ typedef Tcl_ObjCmdProc *TclObjCmdProcType; extern char * tclExecutableName; extern char * tclNativeExecutableName; +extern int tclFindExecutableSearchDone; extern char * tclDefaultEncodingDir; extern char * tclMemDumpFileName; extern TclPlatformType tclPlatform; diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 6acc643..41a4f0c 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUtil.c,v 1.44 2004/04/06 22:25:55 dgp Exp $ + * RCS: @(#) $Id: tclUtil.c,v 1.45 2004/06/18 20:38:01 dgp Exp $ */ #include "tclInt.h" @@ -25,6 +25,7 @@ char *tclExecutableName = NULL; char *tclNativeExecutableName = NULL; +int tclFindExecutableSearchDone = 0; /* * The following values are used in the flags returned by Tcl_ScanElement |