From d315baab70f48cdc5618152774cecd5ac3b5fa50 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 14 Feb 2024 15:03:26 +0000 Subject: Tcl_Alloc -> ckalloc. Remove unnecessary type-casts. --- generic/tkCmds.c | 2 +- generic/tkEntry.c | 2 +- generic/tkImage.c | 2 +- generic/tkOldConfig.c | 4 ++-- generic/tkText.c | 2 +- unix/tkUnixWm.c | 2 +- win/tkWinButton.c | 4 ++-- win/tkWinDialog.c | 4 ++-- win/tkWinGDI.c | 58 +++++++++++++++++++++++++-------------------------- win/tkWinSendCom.c | 2 +- win/tkWinSysTray.c | 16 +++++++------- win/ttkWinXPTheme.c | 8 +++---- 12 files changed, 53 insertions(+), 53 deletions(-) diff --git a/generic/tkCmds.c b/generic/tkCmds.c index ff73952..eebddaf 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -383,7 +383,7 @@ Tk_BindtagsObjCmd( } else { for (i = 0; i < winPtr->numTags; i++) { Tcl_ListObjAppendElement(NULL, listPtr, - Tcl_NewStringObj(winPtr->tagPtr[i], TCL_INDEX_NONE)); + Tcl_NewStringObj((const char *)winPtr->tagPtr[i], TCL_INDEX_NONE)); } } Tcl_SetObjResult(interp, listPtr); diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 92080e4..79e1d5f 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -1051,7 +1051,7 @@ DestroyEntry( * Tk_FreeOptions handle all the standard option-related stuff. */ - ckfree((char *)entryPtr->string); + ckfree(entryPtr->string); if (entryPtr->textVarName != NULL) { Tcl_UntraceVar2(entryPtr->interp, entryPtr->textVarName, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, diff --git a/generic/tkImage.c b/generic/tkImage.c index fc469d7..77b2c62 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -951,7 +951,7 @@ Tk_DeleteImage( if (hPtr == NULL) { return; } - DeleteImage(Tcl_GetHashValue(hPtr)); + DeleteImage((char *)Tcl_GetHashValue(hPtr)); } /* diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index a25861d..6b3edfa 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -958,9 +958,9 @@ Tk_ConfigureValue( Tcl_SetObjResult(interp, Tcl_NewStringObj(result, TCL_INDEX_NONE)); if (freeProc != NULL) { if (freeProc == TCL_DYNAMIC) { - ckfree((char *) result); + ckfree((char *)result); } else { - freeProc((char *) result); + freeProc((char *)result); } } return TCL_OK; diff --git a/generic/tkText.c b/generic/tkText.c index 665fe54..c3568ec 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -5603,7 +5603,7 @@ TkTextRunAfterSyncCmd( */ if (textPtr->refCount-- <= 1) { - ckfree((char *) textPtr); + ckfree(textPtr); } return; } diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index 8fe1cc2..7526e3a 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -2490,7 +2490,7 @@ WmIconphotoCmd( for (i = 3 + isDefault; i < objc; i++) { photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i])); if (photo == NULL) { - ckfree((char *) iconPropertyData); + ckfree(iconPropertyData); Tcl_SetObjResult(interp, Tcl_ObjPrintf( "failed to create an iconphoto with image \"%s\"", Tcl_GetString(objv[i]))); diff --git a/win/tkWinButton.c b/win/tkWinButton.c index 6dfc2be..a60fec2 100644 --- a/win/tkWinButton.c +++ b/win/tkWinButton.c @@ -113,7 +113,7 @@ static Window CreateProc(Tk_Window tkwin, Window parent, void *instanceData); static void InitBoxes(Tk_Window tkwin); static void ColorToStr(COLORREF color, char *colorStr); -static void ImageChanged(ClientData clientData, +static void ImageChanged(void *clientData, int x, int y, int width, int height, int imageWidth, int imageHeight); static void TkpDrawIndicator(TkButton *butPtr, Drawable d, @@ -333,7 +333,7 @@ ColorToStr( static void ImageChanged( - ClientData clientData, + void *clientData, int x, int y, int width, int height, int imageWidth, int imageHeight) { diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index 1502720..4aef6ce 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -2166,9 +2166,9 @@ static void FreeFilterVista(DWORD count, TCLCOMDLG_FILTERSPEC *dlgFilterPtr) DWORD dw; for (dw = 0; dw < count; ++dw) { if (dlgFilterPtr[dw].pszName != NULL) - ckfree((char *)dlgFilterPtr[dw].pszName); + ckfree(dlgFilterPtr[dw].pszName); if (dlgFilterPtr[dw].pszSpec != NULL) - ckfree((char *)dlgFilterPtr[dw].pszSpec); + ckfree(dlgFilterPtr[dw].pszSpec); } ckfree(dlgFilterPtr); } diff --git a/win/tkWinGDI.c b/win/tkWinGDI.c index 4cb63b1..33cfc5a 100644 --- a/win/tkWinGDI.c +++ b/win/tkWinGDI.c @@ -85,22 +85,22 @@ static void GetDisplaySize(LONG *width, LONG *height); static int GdiWordToWeight(const char *str); static int GdiParseFontWords(Tcl_Interp *interp, LOGFONTW *lf, const char *str[], int numargs); -static int PrintSelectPrinter(ClientData clientData, +static int PrintSelectPrinter(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int PrintOpenPrinter(ClientData clientData, +static int PrintOpenPrinter(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int PrintClosePrinter(ClientData clientData, +static int PrintClosePrinter(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int PrintOpenDoc(ClientData clientData, Tcl_Interp *interp, +static int PrintOpenDoc(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int PrintCloseDoc(ClientData clientData, Tcl_Interp *interp, +static int PrintCloseDoc(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int PrintOpenPage(ClientData clientData, Tcl_Interp *interp, +static int PrintOpenPage(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int PrintClosePage(ClientData clientData, +static int PrintClosePage(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -481,7 +481,7 @@ static int GdiPhoto( * recoverable. */ - pbuf = (char *) Tcl_AttemptAlloc(sll * ny * sizeof(char)); + pbuf = (char *)attemptckalloc(sll * ny * sizeof(char)); if (pbuf == 0) { /* Memory allocation failure. */ Tcl_AppendResult(interp, "::tk::print::_gdi photo failed--out of memory", NULL); @@ -546,7 +546,7 @@ static int GdiPhoto( SetBrushOrgEx(dst, pt.x, pt.y, &pt); } - Tcl_Free(pbuf); + ckfree(pbuf); if (retval == TCL_OK) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -582,7 +582,7 @@ static int Bezierize( int nbpoints = 0; POINT* bpoints; - inPointList = (double *) Tcl_AttemptAlloc(2 * sizeof(double) * npoly); + inPointList = (double *)attemptckalloc(2 * sizeof(double) * npoly); if (inPointList == 0) { /* TODO: unreachable */ return nbpoints; /* 0. */ @@ -594,21 +594,21 @@ static int Bezierize( } nbpoints = 1 + npoly * nStep; /* this is the upper limit. */ - outPointList = (double *) Tcl_AttemptAlloc(2 * sizeof(double) * nbpoints); + outPointList = (double *)attemptckalloc(2 * sizeof(double) * nbpoints); if (outPointList == 0) { /* TODO: unreachable */ - Tcl_Free((void *) inPointList); + ckfree((void *) inPointList); return 0; } nbpoints = TkMakeBezierCurve(NULL, inPointList, npoly, nStep, NULL, outPointList); - Tcl_Free((void *) inPointList); - bpoints = (POINT *) Tcl_AttemptAlloc(sizeof(POINT)*nbpoints); + ckfree((void *) inPointList); + bpoints = (POINT *)attemptckalloc(sizeof(POINT)*nbpoints); if (bpoints == 0) { /* TODO: unreachable */ - Tcl_Free((void *) outPointList); + ckfree((void *) outPointList); return 0; } @@ -616,7 +616,7 @@ static int Bezierize( bpoints[n].x = (long) outPointList[2*n]; bpoints[n].y = (long) outPointList[2*n + 1]; } - Tcl_Free((void *) outPointList); + ckfree((void *) outPointList); *bpointptr = *bpoints; return nbpoints; } @@ -681,7 +681,7 @@ static int GdiLine( hDC = printDC; - polypoints = (POINT *) Tcl_AttemptAlloc((argc - 1) * sizeof(POINT)); + polypoints = (POINT *)attemptckalloc((argc - 1) * sizeof(POINT)); if (polypoints == 0) { Tcl_AppendResult(interp, "Out of memory in GdiLine", NULL); return TCL_ERROR; @@ -712,7 +712,7 @@ static int GdiLine( objv += 2; } else { /* Only one number... Assume a usage error. */ - Tcl_Free((void *)polypoints); + ckfree((void *)polypoints); Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } @@ -826,7 +826,7 @@ static int GdiLine( Polyline(hDC, polypoints, npoly); /* Out of memory? Just draw a regular line. */ } if (bpoints != 0) { - Tcl_Free((void *)bpoints); + ckfree((void *)bpoints); } } else { Polyline(hDC, polypoints, npoly); @@ -918,7 +918,7 @@ static int GdiLine( GdiFreeBrush(interp, hDC, hBrush); } - Tcl_Free((void *)polypoints); + ckfree((void *)polypoints); return TCL_OK; } @@ -1091,7 +1091,7 @@ static int GdiPolygon( hDC = printDC; - polypoints = (POINT *) Tcl_AttemptAlloc((argc - 1) * sizeof(POINT)); + polypoints = (POINT *)attemptckalloc((argc - 1) * sizeof(POINT)); if (polypoints == 0) { /* TODO: unreachable */ Tcl_AppendResult(interp, "Out of memory in GdiLine", NULL); @@ -1122,7 +1122,7 @@ static int GdiPolygon( objv += 2; } else { /* Only one number... Assume a usage error. */ - Tcl_Free((void *) polypoints); + ckfree((void *) polypoints); Tcl_AppendResult(interp, usage_message, NULL); return TCL_ERROR; } @@ -1198,7 +1198,7 @@ static int GdiPolygon( Polygon(hDC, polypoints, npoly); } if (bpoints != 0) { - Tcl_Free((void *)bpoints); + ckfree((void *)bpoints); } } else { Polygon(hDC, polypoints, npoly); @@ -1213,7 +1213,7 @@ static int GdiPolygon( SelectObject(hDC, oldobj); } - Tcl_Free((void *)polypoints); + ckfree((void *)polypoints); return TCL_OK; } @@ -2642,7 +2642,7 @@ static int GdiMakeLogFont( GdiParseFontWords(interp, lf, list+2, count-2); } - Tcl_Free((char *)list); + ckfree(list); return 1; } @@ -2706,7 +2706,7 @@ static int GdiMakePen( if (dashstyle != 0 && dashstyledata != 0) { const char *cp; size_t i; - char *dup = (char *) Tcl_Alloc(strlen(dashstyledata) + 1); + char *dup = (char *) ckalloc(strlen(dashstyledata) + 1); strcpy(dup, dashstyledata); /* DEBUG. */ Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -2749,7 +2749,7 @@ static int GdiMakePen( dashstyle = 0; } if (dup) { - Tcl_Free(dup); + ckfree(dup); } } @@ -3654,8 +3654,8 @@ static int PrintSelectPrinter( * script level. */ if (localPrinterName != NULL) { - char* varlink1 = (char*)Tcl_Alloc(100 * sizeof(char)); - char** varlink2 = (char**)Tcl_Alloc(sizeof(char*)); + char* varlink1 = (char*)ckalloc(100 * sizeof(char)); + char** varlink2 = (char**)ckalloc(sizeof(char*)); *varlink2 = varlink1; WideCharToMultiByte(CP_UTF8, 0, localPrinterName, -1, varlink1, 0, NULL, NULL); diff --git a/win/tkWinSendCom.c b/win/tkWinSendCom.c index b67e27a..7bd7258 100644 --- a/win/tkWinSendCom.c +++ b/win/tkWinSendCom.c @@ -144,7 +144,7 @@ static void TkWinSendCom_Destroy( LPDISPATCH pdisp) { - CoTaskMemFree((void *) pdisp); + CoTaskMemFree(pdisp); } /* diff --git a/win/tkWinSysTray.c b/win/tkWinSysTray.c index 8399abb..6c8893e 100644 --- a/win/tkWinSysTray.c +++ b/win/tkWinSysTray.c @@ -191,7 +191,7 @@ DrawANDMask( lpIcon->lpAND, lpbi, DIB_RGB_COLORS); /* clean up */ - ckfree((char *) lpbi); + ckfree(lpbi); return TRUE; } @@ -851,7 +851,7 @@ CreateTaskbarHandlerWindow(void) { static void WinIcoDestroy( - ClientData clientData, + void *clientData, XEvent *eventPtr) { IcoInterpInfo *icoInterpPtr = (IcoInterpInfo*) clientData; @@ -878,7 +878,7 @@ WinIcoDestroy( nextPtr = icoPtr->nextPtr; FreeIcoPtr(icoInterpPtr, icoPtr); } - ckfree((char *) icoInterpPtr); + ckfree(icoInterpPtr); } /* @@ -899,7 +899,7 @@ WinIcoDestroy( static int WinSystrayCmd( - ClientData clientData, + void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1060,7 +1060,7 @@ WinSystrayCmd( static int WinSysNotifyCmd( - ClientData clientData, + void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1159,12 +1159,12 @@ WinIcoInit( icoInterpPtr->nextPtr = firstIcoInterpPtr; firstIcoInterpPtr = icoInterpPtr; Tcl_CreateObjCommand(interp, "::tk::systray::_systray", WinSystrayCmd, - (ClientData) icoInterpPtr, NULL); + icoInterpPtr, NULL); Tcl_CreateObjCommand(interp, "::tk::sysnotify::_sysnotify", WinSysNotifyCmd, - (ClientData) icoInterpPtr, NULL); + icoInterpPtr, NULL); Tk_CreateEventHandler(mainWindow, StructureNotifyMask, - WinIcoDestroy, (ClientData) icoInterpPtr); + WinIcoDestroy, icoInterpPtr); return TCL_OK; } diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 484dfa1..8f65e26 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -426,10 +426,10 @@ static void DestroyElementData(void *clientData) { ElementData *elementData = (ElementData *)clientData; if (elementData->info->flags & HEAP_ELEMENT) { - ckfree((char *)elementData->info->statemap); - ckfree((char *)elementData->info->className); - ckfree((char *)elementData->info->elementName); - ckfree((char *)elementData->info); + ckfree(elementData->info->statemap); + ckfree(elementData->info->className); + ckfree(elementData->info->elementName); + ckfree(elementData->info); } ckfree(clientData); } -- cgit v0.12