Tcl Source Code

Artifact [02d5b6e97f]
Login

Artifact 02d5b6e97fa6ff613ba0a875a155893b1763cf26:

Attachment "tk-conststubs.diff" to ticket [1938497fff] added by das 2008-04-16 21:51:15.
Index: generic/tkStubInit.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tkStubInit.c,v
retrieving revision 1.61
diff -u -p -r1.61 tkStubInit.c
--- generic/tkStubInit.c	2 Apr 2008 21:32:33 -0000	1.61
+++ generic/tkStubInit.c	16 Apr 2008 13:19:29 -0000
@@ -41,12 +41,6 @@
 #define Tk_GetCanvasVisitor \
     ((VOID * (*)(Tcl_Interp * interp, CONST char * name)) NULL)
 
-MODULE_SCOPE TkIntStubs tkIntStubs;
-MODULE_SCOPE TkIntPlatStubs tkIntPlatStubs;
-MODULE_SCOPE TkIntXlibStubs tkIntXlibStubs;
-MODULE_SCOPE TkPlatStubs tkPlatStubs;
-MODULE_SCOPE TkStubs tkStubs;
-
 /*
  * WARNING: The contents of this file is automatically generated by the
  * tools/genStubs.tcl script. Any modifications to the function declarations
@@ -55,7 +49,7 @@ MODULE_SCOPE TkStubs tkStubs;
 
 /* !BEGIN!: Do not edit below this line. */
 
-TkIntStubs tkIntStubs = {
+static const TkIntStubs tkIntStubs = {
     TCL_STUB_MAGIC,
     NULL,
     TkAllocWindow, /* 0 */
@@ -317,7 +311,7 @@ TkIntStubs tkIntStubs = {
     TkpTesttextCmd, /* 157 */
 };
 
-TkIntPlatStubs tkIntPlatStubs = {
+static const TkIntPlatStubs tkIntPlatStubs = {
     TCL_STUB_MAGIC,
     NULL,
 #ifdef __WIN32__ /* WIN */
@@ -432,7 +426,7 @@ TkIntPlatStubs tkIntPlatStubs = {
 #endif /* X11 */
 };
 
-TkIntXlibStubs tkIntXlibStubs = {
+static const TkIntXlibStubs tkIntXlibStubs = {
     TCL_STUB_MAGIC,
     NULL,
 #ifdef __WIN32__ /* WIN */
@@ -640,7 +634,7 @@ TkIntXlibStubs tkIntXlibStubs = {
 #endif /* AQUA */
 };
 
-TkPlatStubs tkPlatStubs = {
+static const TkPlatStubs tkPlatStubs = {
     TCL_STUB_MAGIC,
     NULL,
 #ifdef __WIN32__ /* WIN */
@@ -673,7 +667,7 @@ static const TkStubHooks tkStubHooks = {
     &tkIntXlibStubs
 };
 
-TkStubs tkStubs = {
+static const TkStubs tkStubs = {
     TCL_STUB_MAGIC,
     &tkStubHooks,
     Tk_MainLoop, /* 0 */
@@ -954,5 +948,13 @@ TkStubs tkStubs = {
 
 /* !END!: Do not edit above this line. */
 
+/* 
+ * Module-scope pointer to the main static stubs table, used for package
+ * initialization via Tcl_PkgProvideEx().
+ */
+
+MODULE_SCOPE const TkStubs * const tkConstStubsPtr;
+
+const TkStubs * const tkConstStubsPtr = &tkStubs;
+
 #undef UNIX_TK
-#undef MAC_OSX_TK
Index: generic/tkWindow.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tkWindow.c,v
retrieving revision 1.93
diff -u -p -r1.93 tkWindow.c
--- generic/tkWindow.c	7 Apr 2008 23:14:36 -0000	1.93
+++ generic/tkWindow.c	16 Apr 2008 13:19:43 -0000
@@ -2912,7 +2912,7 @@ Tk_SafeInit(
     return Initialize(interp);
 }
 
-extern TkStubs tkStubs;
+MODULE_SCOPE const TkStubs * const tkConstStubsPtr;
 
 /*
  *----------------------------------------------------------------------
@@ -3190,7 +3190,7 @@ Initialize(
      */
 
     code = Tcl_PkgProvideEx(interp, "Tk", TK_PATCH_LEVEL,
-	    (ClientData) &tkStubs);
+	    (ClientData) tkConstStubsPtr);
     if (code != TCL_OK) {
 	goto done;
     }