diff options
author | nijtmans <nijtmans> | 2008-10-05 22:25:35 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2008-10-05 22:25:35 (GMT) |
commit | 06d77e88c1820d6b44d1450d66d93d5950779ea8 (patch) | |
tree | 578409d445995ed8603c1288507ce8ce7ae0bf0c | |
parent | c095ba4368ae987448c8141e73b12276031ed168 (diff) | |
download | tcl-06d77e88c1820d6b44d1450d66d93d5950779ea8.zip tcl-06d77e88c1820d6b44d1450d66d93d5950779ea8.tar.gz tcl-06d77e88c1820d6b44d1450d66d93d5950779ea8.tar.bz2 |
* doc/FileSystem.3: CONSTified Tcl_FSFileAttrStringsProc
* generic/tclFCmd.c: and tclpFileAttrStrings. This allows
* generic/tclIOUtil.c: FileSystems to report their attributes
* generic/tclTest.c: as const strings, without worrying that
* unix/tclUnixFCmd.c: Tcl modifies them (which Tcl should not
* win/tclWinFCmd.c: do anyway, but the API didn't indicate that)
* generic/tcl.decls
* generic/tclDecls.h: regenerated
* generic/tcl.h: make sure that if CONST84 is defined
as empty, CONST86 should be defined
as empty as well (unless overridden).
This change complies with TIP #27
*** POTENTIAL INCOMPATIBILITY ***
-rw-r--r-- | ChangeLog | 23 | ||||
-rw-r--r-- | doc/FileSystem.3 | 4 | ||||
-rw-r--r-- | generic/tcl.decls | 4 | ||||
-rw-r--r-- | generic/tcl.h | 6 | ||||
-rw-r--r-- | generic/tclDecls.h | 6 | ||||
-rw-r--r-- | generic/tclFCmd.c | 16 | ||||
-rw-r--r-- | generic/tclIOUtil.c | 10 | ||||
-rw-r--r-- | generic/tclTest.c | 6 | ||||
-rw-r--r-- | unix/tclUnixFCmd.c | 8 | ||||
-rw-r--r-- | win/tclWinFCmd.c | 4 |
10 files changed, 50 insertions, 37 deletions
@@ -1,3 +1,19 @@ +2008-10-05 Jan Nijtmans <nijtmans@users.sf.net> + + * doc/FileSystem.3: CONSTified Tcl_FSFileAttrStringsProc + * generic/tclFCmd.c: and tclpFileAttrStrings. This allows + * generic/tclIOUtil.c: FileSystems to report their attributes + * generic/tclTest.c: as const strings, without worrying that + * unix/tclUnixFCmd.c: Tcl modifies them (which Tcl should not + * win/tclWinFCmd.c: do anyway, but the API didn't indicate that) + * generic/tcl.decls + * generic/tclDecls.h: regenerated + * generic/tcl.h: make sure that if CONST84 is defined + as empty, CONST86 should be defined + as empty as well (unless overridden). + This change complies with TIP #27 + *** POTENTIAL INCOMPATIBILITY *** + 2008-10-05 Kevin B, Kenny <kennykb@acm.org> * libtommath/bn_mp_sqrt.c (bn_mp_sqrt): Handle the case where @@ -13,14 +29,13 @@ for an index of 'end+1', which has the effect of appending an element to the list. -2008-10-04 Jan Nijtmans <nijtmans@users.sf.net> +2008-10-05 Jan Nijtmans <nijtmans@users.sf.net> * generic/tclInt.decls: CONSTified the AuxDataType argument * generic/tclCompCmds.c: of TclCreateAuxData and * generic/tclCompile.c TclRegisterAuxDataType and the return * generic/tclCompile.h values of TclGetAuxDataType and * generic/tclExecute.c TclGetInstructionTable - * ChangeLog * generic/tclIntDecls.h: regenerated This change complies with TIP #27 (even though it only involves internal function, so this is not even necessary). @@ -57,7 +72,6 @@ * generic/tcl.h * generic/tclIO.h * generic/tclIO.c - * ChangeLog * generic/tclDecls.h: regenerated This change complies with TIP #27. @@ -67,7 +81,6 @@ * generic/tcl.decls: of Tcl_InitCustomHashTable. * generic/tcl.h * generic/tclHash.c - * ChangeLog * generic/tclDecls.h: regenerated This change complies with TIP #27. @@ -78,7 +91,6 @@ * generic/tcl.h * generic/tclConfig.c * generic/tclPkgConfig.c - * ChangeLog * generic/tclDecls.h: regenerated This change complies with TIP #27. @@ -87,7 +99,6 @@ * doc/GetIndex.3: CONSTified the tablePtr argument * generic/tcl.decls: of Tcl_GetIndexFromObj. * generic/tclIndexObj.c - * ChangeLog * generic/tclDecls.h: regenerated This change complies with TIP #27. diff --git a/doc/FileSystem.3 b/doc/FileSystem.3 index eef980b..b3baf8f 100644 --- a/doc/FileSystem.3 +++ b/doc/FileSystem.3 @@ -5,7 +5,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: FileSystem.3,v 1.65 2008/09/24 09:41:12 dkf Exp $ +'\" RCS: @(#) $Id: FileSystem.3,v 1.66 2008/10/05 22:25:35 nijtmans Exp $ '\" .so man.macros .TH Filesystem 3 8.4 Tcl "Tcl Library Procedures" @@ -1351,7 +1351,7 @@ not implemented, there is no need to implement the \fBget\fR and \fBset\fR methods. .PP .CS -typedef const char **\fBTcl_FSFileAttrStringsProc\fR( +typedef const char *const *\fBTcl_FSFileAttrStringsProc\fR( Tcl_Obj *\fIpathPtr\fR, Tcl_Obj **\fIobjPtrRef\fR); .CE diff --git a/generic/tcl.decls b/generic/tcl.decls index b64df6d..9290dcc 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -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: tcl.decls,v 1.151 2008/10/04 12:33:34 nijtmans Exp $ +# RCS: @(#) $Id: tcl.decls,v 1.152 2008/10/05 22:25:35 nijtmans Exp $ library tcl @@ -1613,7 +1613,7 @@ declare 452 generic { int index, Tcl_Obj *pathPtr, Tcl_Obj *objPtr) } declare 453 generic { - CONST char ** Tcl_FSFileAttrStrings(Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef) + CONST char *CONST86 * Tcl_FSFileAttrStrings(Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef) } declare 454 generic { int Tcl_FSStat(Tcl_Obj *pathPtr, Tcl_StatBuf *buf) diff --git a/generic/tcl.h b/generic/tcl.h index 26187e3..909b9e8 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tcl.h,v 1.274 2008/10/04 12:33:34 nijtmans Exp $ + * RCS: @(#) $Id: tcl.h,v 1.275 2008/10/05 22:25:35 nijtmans Exp $ */ #ifndef _TCL @@ -268,7 +268,7 @@ extern "C" { #endif #ifndef CONST86 -# define CONST86 CONST +# define CONST86 CONST84 #endif /* @@ -1618,7 +1618,7 @@ typedef int (Tcl_FSNormalizePathProc) (Tcl_Interp *interp, Tcl_Obj *pathPtr, int nextCheckpoint); typedef int (Tcl_FSFileAttrsGetProc) (Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef); -typedef CONST char ** (Tcl_FSFileAttrStringsProc) (Tcl_Obj *pathPtr, +typedef CONST char *CONST86 * (Tcl_FSFileAttrStringsProc) (Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef); typedef int (Tcl_FSFileAttrsSetProc) (Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, Tcl_Obj *objPtr); diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 2650172..8b7beaa 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -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: tclDecls.h,v 1.153 2008/10/04 12:33:34 nijtmans Exp $ + * RCS: @(#) $Id: tclDecls.h,v 1.154 2008/10/05 22:25:35 nijtmans Exp $ */ #ifndef _TCLDECLS @@ -2760,7 +2760,7 @@ EXTERN int Tcl_FSFileAttrsSet (Tcl_Interp * interp, int index, #ifndef Tcl_FSFileAttrStrings_TCL_DECLARED #define Tcl_FSFileAttrStrings_TCL_DECLARED /* 453 */ -EXTERN CONST char ** Tcl_FSFileAttrStrings (Tcl_Obj * pathPtr, +EXTERN CONST char *CONST86 * Tcl_FSFileAttrStrings (Tcl_Obj * pathPtr, Tcl_Obj ** objPtrRef); #endif #ifndef Tcl_FSStat_TCL_DECLARED @@ -4169,7 +4169,7 @@ typedef struct TclStubs { int (*tcl_FSUtime) (Tcl_Obj * pathPtr, struct utimbuf * tval); /* 450 */ int (*tcl_FSFileAttrsGet) (Tcl_Interp * interp, int index, Tcl_Obj * pathPtr, Tcl_Obj ** objPtrRef); /* 451 */ int (*tcl_FSFileAttrsSet) (Tcl_Interp * interp, int index, Tcl_Obj * pathPtr, Tcl_Obj * objPtr); /* 452 */ - CONST char ** (*tcl_FSFileAttrStrings) (Tcl_Obj * pathPtr, Tcl_Obj ** objPtrRef); /* 453 */ + CONST char *CONST86 * (*tcl_FSFileAttrStrings) (Tcl_Obj * pathPtr, Tcl_Obj ** objPtrRef); /* 453 */ int (*tcl_FSStat) (Tcl_Obj * pathPtr, Tcl_StatBuf * buf); /* 454 */ int (*tcl_FSAccess) (Tcl_Obj * pathPtr, int mode); /* 455 */ Tcl_Channel (*tcl_FSOpenFileChannel) (Tcl_Interp * interp, Tcl_Obj * pathPtr, CONST char * modeString, int permissions); /* 456 */ diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c index d385f8e..6f92304 100644 --- a/generic/tclFCmd.c +++ b/generic/tclFCmd.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclFCmd.c,v 1.47 2008/09/24 19:31:29 dgp Exp $ + * RCS: @(#) $Id: tclFCmd.c,v 1.48 2008/10/05 22:25:35 nijtmans Exp $ */ #include "tclInt.h" @@ -944,7 +944,8 @@ TclFileAttrsCmd( Tcl_Obj *const objv[]) /* The command line objects. */ { int result; - const char ** attributeStrings; + const char *const *attributeStrings; + const char **attributeStringsAllocated = NULL; Tcl_Obj *objStrings = NULL; int numObjStrings = -1; Tcl_Obj *filePtr; @@ -997,13 +998,14 @@ TclFileAttrsCmd( if (Tcl_ListObjLength(interp, objStrings, &numObjStrings) != TCL_OK) { goto end; } - attributeStrings = (const char **) + attributeStringsAllocated = (const char **) TclStackAlloc(interp, (1+numObjStrings) * sizeof(char *)); for (index = 0; index < numObjStrings; index++) { Tcl_ListObjIndex(interp, objStrings, index, &objPtr); - attributeStrings[index] = TclGetString(objPtr); + attributeStringsAllocated[index] = TclGetString(objPtr); } - attributeStrings[index] = NULL; + attributeStringsAllocated[index] = NULL; + attributeStrings = attributeStringsAllocated; } if (objc == 0) { /* @@ -1103,12 +1105,12 @@ TclFileAttrsCmd( result = TCL_OK; end: - if (numObjStrings != -1) { + if (attributeStringsAllocated != NULL) { /* * Free up the array we allocated. */ - TclStackFree(interp, (void *)attributeStrings); + TclStackFree(interp, attributeStringsAllocated); /* * We don't need this object that was passed to us any more. diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index d4e3325..077eb96 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -17,7 +17,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOUtil.c,v 1.157 2008/09/30 16:29:47 dgp Exp $ + * RCS: @(#) $Id: tclIOUtil.c,v 1.158 2008/10/05 22:25:35 nijtmans Exp $ */ #include "tclInt.h" @@ -49,7 +49,7 @@ static void FsRecacheFilesystemList(void); * they are not (and should not be) used anywhere else. */ -MODULE_SCOPE const char * tclpFileAttrStrings[]; +MODULE_SCOPE const char *const tclpFileAttrStrings[]; MODULE_SCOPE const TclFileAttrProcs tclpFileAttrProcs[]; /* @@ -2133,7 +2133,7 @@ Tcl_FSUtime( *---------------------------------------------------------------------- */ -static const char ** +static const char *const * NativeFileAttrStrings( Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef) @@ -2226,7 +2226,7 @@ NativeFileAttrsSet( *---------------------------------------------------------------------- */ -const char ** +const char *const * Tcl_FSFileAttrStrings( Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef) @@ -2265,7 +2265,7 @@ TclFSFileAttrIndex( int *indexPtr) /* Where to write the found index. */ { Tcl_Obj *listObj = NULL; - const char **attrTable; + const char *const *attrTable; /* * Get the attribute table for the file. diff --git a/generic/tclTest.c b/generic/tclTest.c index b6230df..76252eb 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclTest.c,v 1.125 2008/10/02 20:59:45 dgp Exp $ + * RCS: @(#) $Id: tclTest.c,v 1.126 2008/10/05 22:25:35 nijtmans Exp $ */ #define TCL_TEST @@ -372,7 +372,7 @@ static int TestReportLoadFile(Tcl_Interp *interp, Tcl_FSUnloadFileProc **unloadProcPtr); static Tcl_Obj * TestReportLink(Tcl_Obj *path, Tcl_Obj *to, int linkType); -static const char ** TestReportFileAttrStrings( +static const char *const *TestReportFileAttrStrings( Tcl_Obj *fileName, Tcl_Obj **objPtrRef); static int TestReportFileAttrsGet(Tcl_Interp *interp, int index, Tcl_Obj *fileName, Tcl_Obj **objPtrRef); @@ -6173,7 +6173,7 @@ TestReportRemoveDirectory( errorPtr); } -static const char ** +static const char *const * TestReportFileAttrStrings( Tcl_Obj *fileName, Tcl_Obj **objPtrRef) diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index 689f995..082449a 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixFCmd.c,v 1.67 2008/09/27 19:48:06 dkf Exp $ + * RCS: @(#) $Id: tclUnixFCmd.c,v 1.68 2008/10/05 22:25:35 nijtmans Exp $ * * Portions of this code were derived from NetBSD source code which has the * following copyright notice: @@ -116,7 +116,7 @@ typedef int (TraversalProc)(Tcl_DString *srcPtr, Tcl_DString *dstPtr, */ extern TclFileAttrProcs tclpFileAttrProcs[]; -extern char *tclpFileAttrStrings[]; +extern const char *const tclpFileAttrStrings[]; #else enum { @@ -131,8 +131,8 @@ enum { UNIX_INVALID_ATTRIBUTE /* lint - last enum value needs no trailing , */ }; -MODULE_SCOPE const char *tclpFileAttrStrings[]; -const char *tclpFileAttrStrings[] = { +MODULE_SCOPE const char *const tclpFileAttrStrings[]; +const char *const tclpFileAttrStrings[] = { "-group", "-owner", "-permissions", #if defined(HAVE_CHFLAGS) && defined(UF_IMMUTABLE) "-readonly", diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index 73fb8a1..92ef2e9 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinFCmd.c,v 1.53 2008/04/27 22:21:36 dkf Exp $ + * RCS: @(#) $Id: tclWinFCmd.c,v 1.54 2008/10/05 22:25:35 nijtmans Exp $ */ #include "tclWinInt.h" @@ -56,7 +56,7 @@ static int attributeArray[] = {FILE_ATTRIBUTE_ARCHIVE, FILE_ATTRIBUTE_HIDDEN, 0, FILE_ATTRIBUTE_READONLY, 0, FILE_ATTRIBUTE_SYSTEM}; -const char *tclpFileAttrStrings[] = { +const char *const tclpFileAttrStrings[] = { "-archive", "-hidden", "-longname", "-readonly", "-shortname", "-system", (char *) NULL }; |