From 67523410e4e667700dc7c151d1573e2ac4abc1d7 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 21 Aug 2008 09:43:51 +0000 Subject: Use ckrealloc to resize arrays... --- ChangeLog | 159 ++++++++++++++++++++++++++--------------------------- generic/tkOption.c | 18 +++--- 2 files changed, 84 insertions(+), 93 deletions(-) diff --git a/ChangeLog b/ChangeLog index a0eeba4..d709841 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,89 +1,85 @@ -2008-08-19 George Peter Staplin - - After some discussion with Joe English and subsequently the - X.org developers (Keith Packard in particular), it was discovered - that Tk is doing management of XIDs that it shouldn't need to do. - The very common XC-MISC extension which has come with every version - of X for the last 15 years is used with Xlib now, to retrieve the - information about the used/unused XIDs. - - The public Tk_FreeXId is now a no-op. - - Joe English reviewed the patch, and said "please commit." - The patch is associated with the bug tracker id: 2039720 +2008-08-21 Donal K. Fellows - generic/tkError.c: Remove the usage of TkpWindowWasRecentlyDeleted. - generic/tkInt.decls: Update the declarations for the now unused - internalstubs. - generic/tkIntDecls.h: Regenerated based on tkInt.decls. - generic/tkIntPlatDecls.h: Regenerated based on tkInt.decls. - generic/tkStubInit.c - generic/tkWindow.c: Remove the calls to TkInitXId, and TkFreeWindowId. + * generic/tkOption.c (ExtendArray): Rework so that the code uses + ckrealloc (idiomatically) rather than its home-brewed version. - macosx/tkMaxOSXPort.h: Remove TkFreeWindowId and TkInitXId macro - definitions. - macosx/tkMacOSXXStubs.c: Remove the no-op - TkpWindowWasRecentlyDeleted. - - unix/tkUnixEvent.c: Remove call to TkFreeXId. - unix/tkUnixXId.c: Remove a lot of unnecessary code (see above). - - win/tkWinPort.h: Remove TkFreeWindowId and TkInitXId. - win/tkWinWindow.c: Remove TkpWindowWasRecentlyDeleted. +2008-08-19 George Peter Staplin - tests/id.test: Remove this unnecessary test. + After some discussion with Joe English and subsequently the X.org + developers (Keith Packard in particular), it was discovered that Tk is + doing management of XIDs that it shouldn't need to do. The very common + XC-MISC extension which has come with every version of X for the last + 15 years is used with Xlib now, to retrieve the information about the + used/unused XIDs. The public Tk_FreeXId is now a no-op. [Bug 2039720] + + * generic/tkError.c: Remove the usage of TkpWindowWasRecentlyDeleted. + * generic/tkInt.decls: Update the declarations for the now unused + internal stubs. + * generic/tkIntDecls.h: Regenerated based on tkInt.decls. + * generic/tkIntPlatDecls.h: Regenerated based on tkInt.decls. + * generic/tkStubInit.c + * generic/tkWindow.c: Remove the calls to TkInitXId, and + TkFreeWindowId. + * macosx/tkMaxOSXPort.h: Remove TkFreeWindowId and TkInitXId macro + definitions. + * macosx/tkMacOSXXStubs.c: Remove the no-op + TkpWindowWasRecentlyDeleted. + * unix/tkUnixEvent.c: Remove call to TkFreeXId. + * unix/tkUnixXId.c: Remove a lot of unnecessary code (see above). + * win/tkWinPort.h: Remove TkFreeWindowId and TkInitXId. + * win/tkWinWindow.c: Remove TkpWindowWasRecentlyDeleted. + * tests/id.test: Remove this unnecessary test. 2008-08-19 Joe English - * generic/ttk/ttkScroll.c: Don't use sprintf "%g" to - format floating point numbers in -[xy]scrollcommand callbacks - or [xy]view methods. Minor incompatibility: 0 and 1 now - formatted as "0.0" resp "1.0". - * tests/ttk/entry.test, tests/ttk/treeview.test: Updated - to account for above change. + * generic/ttk/ttkScroll.c: Don't use sprintf "%g" to format floating + point numbers in -[xy]scrollcommand callbacks or [xy]view methods. + Minor incompatibility: 0 and 1 now formatted as "0.0" resp "1.0". + * tests/ttk/entry.test, tests/ttk/treeview.test: Updated to account + for above change. 2008-08-19 Daniel Steffen - * macosx/tkMacOSXFont.c (SetFontFeatures): Disable antialiasing of - fixed-width fonts with - size <= 10. + * macosx/tkMacOSXFont.c (SetFontFeatures): Disable antialiasing of + fixed-width fonts with + size <= 10. 2008-08-18 Ania Pawelczyk - * tests/canvWind.test: Update to tcltest2 - * tests/menubut.test: - * tests/raise.test: - * tests/unixButton.test: - * tests/unixEmbed.test: - * tests/winClipboard.test: + * tests/canvWind.test: Update to tcltest2 + * tests/menubut.test: + * tests/raise.test: + * tests/unixButton.test: + * tests/unixEmbed.test: + * tests/winClipboard.test: 2008-08-17 Ania Pawelczyk - * tests/focus.test: Update to tcltest2 - * tests/focusTcl.test: - * tests/geometry.test: - * tests/grab.test: - * tests/grid.test: - * tests/imgBmap.test: - * tests/imgPhoto.test: - * tests/imgPPM.test: - * tests/listbox.test: - * tests/safe.test: - * tests/tk.test: - * tests/util.test: + * tests/focus.test: Update to tcltest2 + * tests/focusTcl.test: + * tests/geometry.test: + * tests/grab.test: + * tests/grid.test: + * tests/imgBmap.test: + * tests/imgPhoto.test: + * tests/imgPPM.test: + * tests/listbox.test: + * tests/safe.test: + * tests/tk.test: + * tests/util.test: 2008-08-15 Ania Pawelczyk - * tests/clrpick.test: Update to tcltest2 - * tests/frame.test: - * tests/font.test: - * tests/image.test: + * tests/clrpick.test: Update to tcltest2 + * tests/frame.test: + * tests/font.test: + * tests/image.test: 2008-08-14 Ania Pawelczyk - * test/event.test: Update to tcltest2 - * test/id.test: - * test/menu.test: + * test/event.test: Update to tcltest2 + * test/id.test: + * test/menu.test: 2008-08-14 Daniel Steffen @@ -128,9 +124,9 @@ 2008-08-05 Joe English - * generic/tk.h, generic/tkEvent.c: Fix for [Bug 2010422] - "no event type or button # or keysym while executing - "bind Listbox [...]". + * generic/tk.h, generic/tkEvent.c: Fix for [Bug 2010422] "no event + type or button # or keysym while executing "bind Listbox + [...]". 2008-08-03 Ania Pawelczyk @@ -141,19 +137,18 @@ 2008-08-01 Pat Thoyts - * win/tkWinWm.c: Check wmPtr is valid in TopLevelReqProc - * test/wm.test: to fix [Bug 2028703] + * win/tkWinWm.c: Check wmPtr is valid in TopLevelReqProc to fix + * test/wm.test: [Bug 2028703] 2008-07-31 Don Porter * generic/tk.h: Added missing EXTERN for the Tcl_PkgInitStubsCheck declaration to fix inability to embed non-stub-enabled Tk on Windows. - -2008-07-29 Ania Pawelczyk - * test/constraints.tcl: -highlightthickness entry's option - (fonts constraint) +2008-07-29 Ania Pawelczyk + * test/constraints.tcl: -highlightthickness entry's option (fonts + constraint) 2008-07-28 Ania Pawelczyk @@ -198,7 +193,7 @@ 2008-07-22 Daniel Steffen * library/ttk/aquaTheme.tcl: Use system color names and TIP145 named - font instead of hardcoded color values and deprecated native font name. + font instead of hardcoded color values and deprecated native font name * macosx/tkMacOSXHLEvents.c: factor out common code; formatting. @@ -209,7 +204,7 @@ 2008-07-04 Joe English * generic/ttk/ttkDefaultTheme.c, generic/ttk/ttkClamTheme.c, - generic/ttk/ttkClassicTheme.c, generic/ttk/ttkElements.c: Audit: + * generic/ttk/ttkClassicTheme.c, generic/ttk/ttkElements.c: Audit: ensure that output arguments to Tk_Get*FromObj() are initialized, in case of erroneous style specifications. [Bug 2009213] @@ -460,7 +455,7 @@ 2008-04-07 Jeff Hobbs * generic/tkWindow.c (Initialize): Fix double-free on Tk_ParseArgv - * tests/main.test (main-3.*): error. [Bug 1937135] + * tests/main.test (main-3.*): error. [Bug 1937135] * generic/tkArgv.c: fix -help mem explosion. [Bug 1936238] (kenny) @@ -4177,12 +4172,12 @@ * macosx/tkMacOSXWindowEvent.c: registered appleevents [FR 1105284], implement print applevent handling, style/whitespace cleanup. - * macosx/tkMacOSXDraw.c (TkMacOSXInitCGDrawing): prevent multiple init. + * macosx/tkMacOSXDraw.c (TkMacOSXInitCGDrawing): prevent multiple init * macosx/tkMacOSXFont.c: remove #ifdef'd text measuring codepaths now * macosx/tkMacOSXInit.c: known to be incorrect, cleanup obsolete text - * macosx/README: antialiasing control code, document ATSUI text - antialiasing changes. + * macosx/README: antialiasing control code, document ATSUI + text antialiasing changes. * macosx/tkMacOSXInt.h: Implemented 'zoomed' window state * macosx/tkMacOSXWindowEvent.c: handling for TkAqua, via titlebar @@ -4192,8 +4187,8 @@ 2006-04-10 Donal K. Fellows * library/tkfbox.tcl (::tk::IconList_Goto): Fix prefix searching so - that the start location is reasonable, and the prefix matching is using - the correct Tcl command for this. [Bug 1467938] + that the start location is reasonable, and the prefix matching is + using the correct Tcl command for this. [Bug 1467938] 2006-04-10 Benjamin Riefenstahl diff --git a/generic/tkOption.c b/generic/tkOption.c index 06b67f9..b5a147e 100644 --- a/generic/tkOption.c +++ b/generic/tkOption.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: tkOption.c,v 1.25 2008/04/27 22:38:56 dkf Exp $ + * RCS: @(#) $Id: tkOption.c,v 1.26 2008/08/21 09:43:53 dkf Exp $ */ #include "tkInt.h" @@ -1188,16 +1188,12 @@ ExtendArray( */ if (arrayPtr->numUsed >= arrayPtr->arraySize) { - register ElArray *newPtr; - - newPtr = (ElArray *) ckalloc(EL_ARRAY_SIZE(2*arrayPtr->arraySize)); - newPtr->arraySize = 2*arrayPtr->arraySize; - newPtr->numUsed = arrayPtr->numUsed; - newPtr->nextToUse = &newPtr->els[newPtr->numUsed]; - memcpy(newPtr->els, arrayPtr->els, - arrayPtr->arraySize * sizeof(Element)); - ckfree((char *) arrayPtr); - arrayPtr = newPtr; + register int newSize = 2*arrayPtr->arraySize; + + arrayPtr = (ElArray *) + ckrealloc((char *) arrayPtr, EL_ARRAY_SIZE(newSize)); + arrayPtr->arraySize = newSize; + arrayPtr->nextToUse = &arrayPtr->els[arrayPtr->numUsed]; } *arrayPtr->nextToUse = *elPtr; -- cgit v0.12