Skip to content

Commit

Permalink
Make all Destroy??? functions match the Tcl_FreeProc signature. That …
Browse files Browse the repository at this point in the history
…will prevent compiler warnings in all thinkable situations.
  • Loading branch information
jan.nijtmans committed Oct 26, 2023
1 parent 7c6b201 commit c25f08d
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 12 deletions.
6 changes: 5 additions & 1 deletion generic/tkBusy.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static void BusyCustodyProc(void *clientData,
static int ConfigureBusy(Tcl_Interp *interp, Busy *busyPtr,
int objc, Tcl_Obj *const objv[]);
static Busy * CreateBusy(Tcl_Interp *interp, Tk_Window tkRef);
static void DestroyBusy(void *dataPtr);
static Tcl_FreeProc DestroyBusy;
static void DoConfigureNotify(Tk_FakeWin *winPtr);
static inline Tk_Window FirstChild(Tk_Window parent);
static Busy * GetBusy(Tcl_Interp *interp,
Expand Down Expand Up @@ -333,7 +333,11 @@ RefWinEventProc(

static void
DestroyBusy(
#if TCL_MAJOR_VERSION > 8
void *data) /* Busy window structure record */
#else
char *data)
#endif
{
Busy *busyPtr = (Busy *)data;

Expand Down
6 changes: 5 additions & 1 deletion generic/tkCanvas.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ static int ConfigureCanvas(Tcl_Interp *interp,
static void DefaultRotateImplementation(TkCanvas *canvasPtr,
Tk_Item *itemPtr, double x, double y,
double angleRadians);
static void DestroyCanvas(void *memPtr);
static Tcl_FreeProc DestroyCanvas;
static int DrawCanvas(Tcl_Interp *interp, void *clientData, Tk_PhotoHandle photohandle, int subsample, int zoom);
static void DisplayCanvas(void *clientData);
static void DoItem(Tcl_Obj *accumObj,
Expand Down Expand Up @@ -2242,7 +2242,11 @@ CanvasWidgetCmd(

static void
DestroyCanvas(
#if TCL_MAJOR_VERSION > 8
void *memPtr) /* Info about canvas widget. */
#else
char *memPtr)
#endif
{
TkCanvas *canvasPtr = (TkCanvas *)memPtr;
Tk_Item *itemPtr;
Expand Down
6 changes: 5 additions & 1 deletion generic/tkEntry.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ static const char *const selElementNames[] = {
static int ConfigureEntry(Tcl_Interp *interp, Entry *entryPtr,
int objc, Tcl_Obj *const objv[]);
static int DeleteChars(Entry *entryPtr, Tcl_Size index, Tcl_Size count);
static void DestroyEntry(void *memPtr);
static Tcl_FreeProc DestroyEntry;
static void DisplayEntry(void *clientData);
static void EntryBlinkProc(void *clientData);
static void EntryCmdDeletedProc(void *clientData);
Expand Down Expand Up @@ -1038,7 +1038,11 @@ EntryWidgetObjCmd(

static void
DestroyEntry(
#if TCL_MAJOR_VERSION > 8
void *memPtr) /* Info about entry widget. */
#else
char *memPtr)
#endif
{
Entry *entryPtr = (Entry *)memPtr;

Expand Down
6 changes: 5 additions & 1 deletion generic/tkFrame.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ static int ConfigureFrame(Tcl_Interp *interp, Frame *framePtr,
static int CreateFrame(void *clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[],
enum FrameType type, const char *appName);
static void DestroyFrame(void *memPtr);
static Tcl_FreeProc DestroyFrame;
static void DestroyFramePartly(Frame *framePtr);
static void DisplayFrame(void *clientData);
static void DrawFrameBackground(Tk_Window tkwin, Pixmap pixmap,
Expand Down Expand Up @@ -889,7 +889,11 @@ FrameWidgetObjCmd(

static void
DestroyFrame(
#if TCL_MAJOR_VERSION > 8
void *memPtr) /* Info about frame widget. */
#else
char *memPtr)
#endif
{
Frame *framePtr = (Frame *)memPtr;
Labelframe *labelframePtr = (Labelframe *)memPtr;
Expand Down
6 changes: 5 additions & 1 deletion generic/tkGrid.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ static int CheckSlotData(Gridder *containerPtr, int slot,
int slotType, int checkOnly);
static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin,
int objc, Tcl_Obj *const objv[]);
static void DestroyGrid(void *memPtr);
static Tcl_FreeProc DestroyGrid;
static Gridder * GetGrid(Tk_Window tkwin);
static int GridAnchorCommand(Tk_Window tkwin, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
Expand Down Expand Up @@ -2825,7 +2825,11 @@ Unlink(

static void
DestroyGrid(
#if TCL_MAJOR_VERSION > 8
void *memPtr) /* Info about window that is now dead. */
#else
char *memPtr)
#endif
{
Gridder *gridPtr = (Gridder *)memPtr;

Expand Down
8 changes: 6 additions & 2 deletions generic/tkImage.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static Tcl_ThreadDataKey dataKey;
*/

static void ImageTypeThreadExitProc(void *clientData);
static void DeleteImage(void *blockPtr);
static Tcl_FreeProc DeleteImage;
static void EventuallyDeleteImage(ImageModel *modelPtr,
int forgetImageHashNow);

Expand Down Expand Up @@ -406,7 +406,7 @@ Tk_ImageObjCmd(
if (modelPtr->deleted) {
goto alreadyDeleted;
}
DeleteImage(modelPtr);
DeleteImage((char *)modelPtr);
}
break;
case IMAGE_NAMES:
Expand Down Expand Up @@ -958,7 +958,11 @@ Tk_DeleteImage(

static void
DeleteImage(
#if TCL_MAJOR_VERSION > 8
void *blockPtr) /* Pointer to main data structure for image. */
#else
char *blockPtr)
#endif
{
Image *imagePtr;
Tk_ImageType *typePtr;
Expand Down
6 changes: 5 additions & 1 deletion generic/tkListbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ static int ConfigureListboxItem(Tcl_Interp *interp,
Tcl_Obj *const objv[], int index);
static int ListboxDeleteSubCmd(Listbox *listPtr,
int first, int last);
static void DestroyListbox(void *memPtr);
static Tcl_FreeProc DestroyListbox;
static void DestroyListboxOptionTables(void *clientData,
Tcl_Interp *interp);
static void DisplayListbox(void *clientData);
Expand Down Expand Up @@ -1438,7 +1438,11 @@ ListboxGetItemAttributes(

static void
DestroyListbox(
#if TCL_MAJOR_VERSION > 8
void *memPtr) /* Info about listbox widget. */
#else
char *memPtr)
#endif
{
Listbox *listPtr = (Listbox *)memPtr;
Tcl_HashEntry *entry;
Expand Down
6 changes: 5 additions & 1 deletion generic/tkMenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ static void DeleteMenuCloneEntries(TkMenu *menuPtr,
static void DestroyMenuHashTable(void *clientData,
Tcl_Interp *interp);
static void DestroyMenuInstance(TkMenu *menuPtr);
static void DestroyMenuEntry(void *memPtr);
static Tcl_FreeProc DestroyMenuEntry;
static Tcl_Size GetIndexFromCoords(Tcl_Interp *interp,
TkMenu *menuPtr, const char *string,
Tcl_Size *indexPtr);
Expand Down Expand Up @@ -1418,7 +1418,11 @@ UnhookCascadeEntry(

static void
DestroyMenuEntry(
#if TCL_MAJOR_VERSION > 8
void *memPtr) /* Pointer to entry to be freed. */
#else
char *memPtr)
#endif
{
TkMenuEntry *mePtr = (TkMenuEntry *)memPtr;
TkMenu *menuPtr = mePtr->menuPtr;
Expand Down
9 changes: 6 additions & 3 deletions generic/tkPack.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static const Tk_GeomMgr packerType = {
static void ArrangePacking(void *clientData);
static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin,
int objc, Tcl_Obj *const objv[]);
static void DestroyPacker(void *memPtr);
static Tcl_FreeProc DestroyPacker;
static Packer * GetPacker(Tk_Window tkwin);
#ifndef TK_NO_DEPRECATED
static int PackAfter(Tcl_Interp *interp, Packer *prevPtr,
Expand Down Expand Up @@ -1404,8 +1404,11 @@ Unlink(

static void
DestroyPacker(
void *memPtr) /* Info about packed window that is now
* dead. */
#if TCL_MAJOR_VERSION > 8
void *memPtr) /* Info about packed window that is now dead. */
#else
char *memPtr)
#endif
{
Packer *packPtr = (Packer *)memPtr;

Expand Down

0 comments on commit c25f08d

Please sign in to comment.