Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
97867b2c
Commit
97867b2c
authored
Aug 08, 1996
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add optional casts to free() calls. (Jack)
Set Tk variable argv0 to classname passed in to Tkapp_New. (Fred)
parent
82df03e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
5 deletions
+24
-5
Modules/_tkinter.c
Modules/_tkinter.c
+24
-5
No files found.
Modules/_tkinter.c
View file @
97867b2c
...
...
@@ -26,6 +26,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* _tkinter.c -- Interface to libtk.a and libtcl.a. */
#include "Python.h"
#include <ctype.h>
#include <tcl.h>
#include <tk.h>
...
...
@@ -49,9 +50,12 @@ extern struct { Tk_Window win; } *tkMainWindowList;
/*
** Additional cruft needed by Tcl/Tk on the Mac.
** This is for Tcl 7.5 and Tk 4.1 (
final releases
).
** This is for Tcl 7.5 and Tk 4.1 (
patch release 1
).
*/
/* free() expects a char* */
#define FREECAST (char *)
#include <Events.h>
/* For EventRecord */
typedef
int
(
*
TclMacConvertEventPtr
)
Py_PROTO
((
EventRecord
*
eventPtr
));
...
...
@@ -62,6 +66,10 @@ staticforward int PyMacConvertEvent Py_PROTO((EventRecord *eventPtr));
#endif
/* macintosh */
#ifndef FREECAST
#define FREECAST
#endif
/**** Tkapp Object Declaration ****/
staticforward
PyTypeObject
Tkapp_Type
;
...
...
@@ -201,9 +209,9 @@ Merge (args)
for
(
i
=
0
;
i
<
argc
;
i
++
)
if
(
fv
[
i
])
free
(
argv
[
i
]);
if
(
argv
!=
argvStore
)
free
(
argv
);
free
(
FREECAST
argv
);
if
(
fv
!=
fvStore
)
free
(
fv
);
free
(
FREECAST
fv
);
return
res
;
}
...
...
@@ -239,7 +247,7 @@ Split (self, list)
PyTuple_SetItem
(
v
,
i
,
Split
(
self
,
argv
[
i
]));
}
free
(
argv
);
free
(
FREECAST
argv
);
return
v
;
}
...
...
@@ -276,6 +284,7 @@ Tkapp_New (screenName, baseName, className, interactive)
int
interactive
;
{
TkappObject
*
v
;
char
*
argv0
;
v
=
PyObject_NEW
(
TkappObject
,
&
Tkapp_Type
);
if
(
v
==
NULL
)
...
...
@@ -300,6 +309,16 @@ Tkapp_New (screenName, baseName, className, interactive)
else
Tcl_SetVar
(
v
->
interp
,
"tcl_interactive"
,
"0"
,
TCL_GLOBAL_ONLY
);
/* This is used to get the application class for Tk 4.1 and up */
argv0
=
(
char
*
)
malloc
(
strlen
(
className
)
+
1
);
if
(
argv0
!=
NULL
)
{
strcpy
(
argv0
,
className
);
if
(
isupper
(
argv0
[
0
]))
argv0
[
0
]
=
tolower
(
argv0
[
0
]);
Tcl_SetVar
(
v
->
interp
,
"argv0"
,
argv0
,
TCL_GLOBAL_ONLY
);
free
(
argv0
);
}
if
(
Tcl_AppInit
(
v
->
interp
)
!=
TCL_OK
)
return
(
TkappObject
*
)
Tkinter_Error
(
v
);
...
...
@@ -677,7 +696,7 @@ Tkapp_SplitList (self, args)
for
(
i
=
0
;
i
<
argc
;
i
++
)
PyTuple_SetItem
(
v
,
i
,
PyString_FromString
(
argv
[
i
]));
free
(
argv
);
free
(
FREECAST
argv
);
return
v
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment