summaryrefslogtreecommitdiffstats
path: root/generic/tkImgPhoto.c
diff options
context:
space:
mode:
authornijtmans <nijtmans>2008-11-18 23:49:42 (GMT)
committernijtmans <nijtmans>2008-11-18 23:49:42 (GMT)
commit00d49f9867cee2ccb0107d42c242542bb1724968 (patch)
tree977344186af30768099bdf29836d163bc796c6e0 /generic/tkImgPhoto.c
parentd9fafe1f52ff004f0ff69bd9c137f8ac0ffa1a85 (diff)
downloadtk-00d49f9867cee2ccb0107d42c242542bb1724968.zip
tk-00d49f9867cee2ccb0107d42c242542bb1724968.tar.gz
tk-00d49f9867cee2ccb0107d42c242542bb1724968.tar.bz2
Minor simplification in fix for [Bug 2312027]:
no need to malloc and copy photo type name because it is a constant to begin with. Convert Tcl_SetResult(......, TCL_DYNAMIC) to Tcl_SetResult(......, TCL_VOLATILE), in preparation for TIP #340
Diffstat (limited to 'generic/tkImgPhoto.c')
-rw-r--r--generic/tkImgPhoto.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 44a63fe..1513607 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -17,7 +17,7 @@
* Department of Computer Science,
* Australian National University.
*
- * RCS: @(#) $Id: tkImgPhoto.c,v 1.87 2008/11/12 01:19:27 nijtmans Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.88 2008/11/18 23:49:43 nijtmans Exp $
*/
#include "tkImgPhoto.h"
@@ -229,13 +229,11 @@ PhotoFormatThreadExitProc(
while (tsdPtr->oldFormatList != NULL) {
freePtr = tsdPtr->oldFormatList;
tsdPtr->oldFormatList = tsdPtr->oldFormatList->nextPtr;
- ckfree((char *) freePtr->name);
ckfree((char *) freePtr);
}
while (tsdPtr->formatList != NULL) {
freePtr = tsdPtr->formatList;
tsdPtr->formatList = tsdPtr->formatList->nextPtr;
- ckfree((char *) freePtr->name);
ckfree((char *) freePtr);
}
}
@@ -264,8 +262,7 @@ Tk_CreateOldPhotoImageFormat(
const Tk_PhotoImageFormat *formatPtr)
/* Structure describing the format. All of the
* fields except "nextPtr" must be filled in
- * by caller. Must not have been passed to
- * Tk_CreatePhotoImageFormat previously. */
+ * by caller. */
{
Tk_PhotoImageFormat *copyPtr;
ThreadSpecificData *tsdPtr =
@@ -277,8 +274,6 @@ Tk_CreateOldPhotoImageFormat(
}
copyPtr = (Tk_PhotoImageFormat *) ckalloc(sizeof(Tk_PhotoImageFormat));
*copyPtr = *formatPtr;
- copyPtr->name = ckalloc((unsigned) (strlen(formatPtr->name) + 1));
- strcpy((char *) copyPtr->name, formatPtr->name);
copyPtr->nextPtr = tsdPtr->oldFormatList;
tsdPtr->oldFormatList = copyPtr;
}
@@ -288,8 +283,7 @@ Tk_CreatePhotoImageFormat(
const Tk_PhotoImageFormat *formatPtr)
/* Structure describing the format. All of the
* fields except "nextPtr" must be filled in
- * by caller. Must not have been passed to
- * Tk_CreatePhotoImageFormat previously. */
+ * by caller. */
{
Tk_PhotoImageFormat *copyPtr;
ThreadSpecificData *tsdPtr =
@@ -301,8 +295,6 @@ Tk_CreatePhotoImageFormat(
}
copyPtr = (Tk_PhotoImageFormat *) ckalloc(sizeof(Tk_PhotoImageFormat));
*copyPtr = *formatPtr;
- copyPtr->name = ckalloc((unsigned) (strlen(formatPtr->name) + 1));
- strcpy((char *)copyPtr->name, formatPtr->name);
if (isupper((unsigned char) *formatPtr->name)) {
copyPtr->nextPtr = tsdPtr->oldFormatList;
tsdPtr->oldFormatList = copyPtr;