From 00d49f9867cee2ccb0107d42c242542bb1724968 Mon Sep 17 00:00:00 2001 From: nijtmans Date: Tue, 18 Nov 2008 23:49:42 +0000 Subject: 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 --- ChangeLog | 30 ++++++++++++++++++++++++++++++ generic/tkImgPhoto.c | 14 +++----------- generic/tkOldConfig.c | 8 ++++---- macosx/tkMacOSXWm.c | 7 ++++--- unix/tkUnixSend.c | 5 +++-- unix/tkUnixWm.c | 8 ++++---- win/tkWinWm.c | 10 ++++++---- 7 files changed, 54 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index fa58d7d..ccb6f71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-11-19 Jan Nijtmans + + * generic/tkImgPhoto.c Minor simplification in fix for [Bug 2312027]: + no need to malloc and copy photo type name because + it is a constant to begin with. + * generic/tkOldConfig.c Convert Tcl_SetResult(......, TCL_DYNAMIC) to + * mac/tkMacOSXWm.c Tcl_SetResult(......, TCL_VOLATILE), in preparation + * unix/tkUnixWm.c for TIP #340 + * unix/tkUnixSend.c + * win/tkWinWm.c + 2008-11-16 Joe English * generic/ttk/ttkWidget.c: Widget self-destruction is @@ -44,6 +55,24 @@ 2008-11-11 Jan Nijtmans +<<<<<<< ChangeLog + * win/tcl.m4: reverted change from 2008-11-06 (was under the impression + that "-Wno-implicit-int" added an extra warning) + * win/configure (regenerated) + * unix/tcl.m4: Use -O2 as gcc optimization compiler flag, and get + rid of -Wno-implicit-int for UNIX + * unix/configure (regenerated) + + * generic/tk.decls modify Tk_Create(Old)ImageType signature, relaxing + * generic/tk.h the constraint that every Tk_ImageType can only + * generic/tkImage.c be passed to this function once. This allows + * generic/tkImgBmap.c tkImg to be loaded in multiple interpreters + * generic/tkImgPhoto.c in a thread-enabled build of Tk. [Bug 2312027] + * generic/tkTest.c This CONSTification complies with TIP #27. It is + * doc/CrtImgType.3 binary compatible with the old interface, but not + fully source compatible (although tkImg does not suffer). + * generic/tkDecls.h (regenerated) +======= * win/tcl.m4: Reverted change from 2008-11-06 (was under the impression that "-Wno-implicit-int" added an extra warning). @@ -62,6 +91,7 @@ but not fully source compatible (although tkImg does not suffer). * generic/tkDecls.h: (regenerated) +>>>>>>> 1.2071 *** POTENTIAL INCOMPATIBILITY *** 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; diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index 51c16c6..731944d 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.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: tkOldConfig.c,v 1.26 2008/11/08 18:44:40 dkf Exp $ + * RCS: @(#) $Id: tkOldConfig.c,v 1.27 2008/11/18 23:49:43 nijtmans Exp $ */ #include "tkPort.h" @@ -632,9 +632,9 @@ Tk_ConfigureInfo( if (specPtr == NULL) { return TCL_ERROR; } - Tcl_SetResult(interp, - FormatConfigInfo(interp, tkwin, specPtr, widgRec), - TCL_DYNAMIC); + list = FormatConfigInfo(interp, tkwin, specPtr, widgRec); + Tcl_SetResult(interp, list, TCL_VOLATILE); + ckfree(list); return TCL_OK; } diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 9374f43..bf2100b 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -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: tkMacOSXWm.c,v 1.71 2008/11/15 00:00:27 patthoyts Exp $ + * RCS: @(#) $Id: tkMacOSXWm.c,v 1.72 2008/11/18 23:49:43 nijtmans Exp $ */ #include "tkMacOSXPrivate.h" @@ -1258,8 +1258,9 @@ WmCommandCmd( } if (objc == 3) { if (wmPtr->cmdArgv != NULL) { - Tcl_SetResult(interp, Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv), - TCL_DYNAMIC); + argv3 = Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv); + Tcl_SetResult(interp, argv3, TCL_VOLATILE); + ckfree(argv3); } return TCL_OK; } diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c index 60cdf86..7394ec5 100644 --- a/unix/tkUnixSend.c +++ b/unix/tkUnixSend.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: tkUnixSend.c,v 1.23 2008/11/05 22:48:58 nijtmans Exp $ + * RCS: @(#) $Id: tkUnixSend.c,v 1.24 2008/11/18 23:49:43 nijtmans Exp $ */ #include "tkUnixInt.h" @@ -1134,7 +1134,8 @@ Tk_SendCmd( Tcl_SetObjErrorCode(interp, errorObjPtr); ckfree(pending.errorCode); } - Tcl_SetResult(interp, pending.result, TCL_DYNAMIC); + Tcl_SetResult(interp, pending.result, TCL_VOLATILE); + ckfree(pending.result); return pending.code; } diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index 2218d86..1b9cbdf 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -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: tkUnixWm.c,v 1.65 2008/11/15 00:00:27 patthoyts Exp $ + * RCS: @(#) $Id: tkUnixWm.c,v 1.66 2008/11/18 23:49:43 nijtmans Exp $ */ #include "tkUnixInt.h" @@ -1632,9 +1632,9 @@ WmCommandCmd( } if (objc == 3) { if (wmPtr->cmdArgv != NULL) { - Tcl_SetResult(interp, - Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv), - TCL_DYNAMIC); + argv3 = Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv); + Tcl_SetResult(interp, argv3, TCL_VOLATILE); + ckfree(argv3); } return TCL_OK; } diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 7660c04..8ffc4d5 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -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: tkWinWm.c,v 1.132 2008/11/15 00:00:27 patthoyts Exp $ + * RCS: @(#) $Id: tkWinWm.c,v 1.133 2008/11/18 23:49:42 nijtmans Exp $ */ #include "tkWinInt.h" @@ -3537,8 +3537,9 @@ WmCommandCmd( } if (objc == 3) { if (wmPtr->cmdArgv != NULL) { - Tcl_SetResult(interp, - Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv), TCL_DYNAMIC); + argv3 = Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv); + Tcl_SetResult(interp, argv3, TCL_VOLATILE); + ckfree(argv3); } return TCL_OK; } @@ -3713,7 +3714,8 @@ WmForgetCmd( /* Already not managed by wm - ignore it */ } return TCL_OK; -} +} + /* *---------------------------------------------------------------------- * -- cgit v0.12