summaryrefslogtreecommitdiffstats
path: root/carbon
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2011-03-12 17:45:37 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2011-03-12 17:45:37 (GMT)
commite0b895874d5fa39f6d4134b407e930b80ee3ecd7 (patch)
tree08a6b50f74f697e9ebc1f689f06d7318c0aa83a2 /carbon
parent77d7867fd5b20233f0fa9163bd8a44d2ac274b0e (diff)
downloadtk-e0b895874d5fa39f6d4134b407e930b80ee3ecd7.zip
tk-e0b895874d5fa39f6d4134b407e930b80ee3ecd7.tar.gz
tk-e0b895874d5fa39f6d4134b407e930b80ee3ecd7.tar.bz2
Remove casts from uses of ckalloc/ckfree/... now that Tcl declares them to be
using useful casts internally.
Diffstat (limited to 'carbon')
-rw-r--r--carbon/tkMacOSXBitmap.c6
-rw-r--r--carbon/tkMacOSXButton.c2
-rw-r--r--carbon/tkMacOSXColor.c8
-rw-r--r--carbon/tkMacOSXCursor.c6
-rw-r--r--carbon/tkMacOSXDialog.c14
-rw-r--r--carbon/tkMacOSXDraw.c4
-rw-r--r--carbon/tkMacOSXEmbed.c13
-rw-r--r--carbon/tkMacOSXFont.c8
-rw-r--r--carbon/tkMacOSXHLEvents.c2
-rw-r--r--carbon/tkMacOSXKeyboard.c8
-rw-r--r--carbon/tkMacOSXMenu.c17
-rw-r--r--carbon/tkMacOSXMenubutton.c2
-rw-r--r--carbon/tkMacOSXScale.c2
-rw-r--r--carbon/tkMacOSXScrlbr.c2
-rw-r--r--carbon/tkMacOSXSend.c2
-rw-r--r--carbon/tkMacOSXSubwindows.c12
-rw-r--r--carbon/tkMacOSXWm.c50
-rw-r--r--carbon/tkMacOSXXStubs.c18
18 files changed, 83 insertions, 93 deletions
diff --git a/carbon/tkMacOSXBitmap.c b/carbon/tkMacOSXBitmap.c
index a5891eb..70dc9e7 100644
--- a/carbon/tkMacOSXBitmap.c
+++ b/carbon/tkMacOSXBitmap.c
@@ -100,10 +100,8 @@ TkpDefineNativeBitmaps(void)
name = Tk_GetUid(builtInPtr->name);
predefHashPtr = Tcl_CreateHashEntry(tablePtr, name, &isNew);
if (isNew) {
- TkPredefBitmap *predefPtr = (TkPredefBitmap *)
- ckalloc(sizeof(TkPredefBitmap));
- NativeIcon *nativeIconPtr = (NativeIcon *)
- ckalloc(sizeof(NativeIcon));
+ TkPredefBitmap *predefPtr = ckalloc(sizeof(TkPredefBitmap));
+ NativeIcon *nativeIconPtr = ckalloc(sizeof(NativeIcon));
nativeIconPtr->id = builtInPtr->id;
nativeIconPtr->type = builtInPtr->type;
diff --git a/carbon/tkMacOSXButton.c b/carbon/tkMacOSXButton.c
index 4bd2cbe..d02c8ad 100644
--- a/carbon/tkMacOSXButton.c
+++ b/carbon/tkMacOSXButton.c
@@ -146,7 +146,7 @@ TkButton *
TkpCreateButton(
Tk_Window tkwin)
{
- MacButton *macButtonPtr = (MacButton *) ckalloc(sizeof(MacButton));
+ MacButton *macButtonPtr = ckalloc(sizeof(MacButton));
Tk_CreateEventHandler(tkwin, ActivateMask,
ButtonEventProc, (ClientData) macButtonPtr);
diff --git a/carbon/tkMacOSXColor.c b/carbon/tkMacOSXColor.c
index 3ac8207..e139038 100644
--- a/carbon/tkMacOSXColor.c
+++ b/carbon/tkMacOSXColor.c
@@ -594,11 +594,11 @@ TkpGetColor(
}
if (XParseColor(display, colormap, name, &color) == 0) {
- return (TkColor *) NULL;
+ return NULL;
}
-validXColor:
- tkColPtr = (TkColor *) ckalloc(sizeof(TkColor));
+ validXColor:
+ tkColPtr = ckalloc(sizeof(TkColor));
tkColPtr->color = color;
return tkColPtr;
@@ -632,7 +632,7 @@ TkpGetColorByValue(
XColor *colorPtr) /* Red, green, and blue fields indicate
* desired color. */
{
- TkColor *tkColPtr = (TkColor *) ckalloc(sizeof(TkColor));
+ TkColor *tkColPtr = ckalloc(sizeof(TkColor));
tkColPtr->color.red = colorPtr->red;
tkColPtr->color.green = colorPtr->green;
diff --git a/carbon/tkMacOSXCursor.c b/carbon/tkMacOSXCursor.c
index 61afab5..d4d0019 100644
--- a/carbon/tkMacOSXCursor.c
+++ b/carbon/tkMacOSXCursor.c
@@ -198,7 +198,7 @@ TkGetCursorByName(
TkMacOSXCursor *macCursorPtr;
int count = -1;
- macCursorPtr = (TkMacOSXCursor *) ckalloc(sizeof(TkMacOSXCursor));
+ macCursorPtr = ckalloc(sizeof(TkMacOSXCursor));
macCursorPtr->info.cursor = (Tk_Cursor) macCursorPtr;
/*
@@ -260,13 +260,13 @@ TkGetCursorByName(
if (argc > 1) {
FindCursorByName(macCursorPtr, argv[0]);
}
- ckfree((char *) argv);
+ ckfree(argv);
}
}
}
if (macCursorPtr->macCursor == NULL) {
- ckfree((char *)macCursorPtr);
+ ckfree(macCursorPtr);
Tcl_AppendResult(interp, "bad cursor spec \"", string, "\"", NULL);
return NULL;
}
diff --git a/carbon/tkMacOSXDialog.c b/carbon/tkMacOSXDialog.c
index 968daf6..3525dae 100644
--- a/carbon/tkMacOSXDialog.c
+++ b/carbon/tkMacOSXDialog.c
@@ -830,7 +830,7 @@ NavServicesGetFile(
int index = 0;
ofdPtr->curType = 0;
- menuItemNames = (CFStringRef *)
+ menuItemNames =
ckalloc(ofdPtr->fl.numFilters * sizeof(CFStringRef));
for (filterPtr = ofdPtr->fl.filters; filterPtr != NULL;
@@ -1021,7 +1021,7 @@ NavServicesGetFile(
for (i = 0; i < ofdPtr->fl.numFilters; i++) {
CFRelease(menuItemNames[i]);
}
- ckfree((void *) menuItemNames);
+ ckfree(menuItemNames);
}
if (options.popupExtension) {
CFRelease(options.popupExtension);
@@ -1885,13 +1885,12 @@ TkMacOSXProcessFontEvent(
result = Tcl_ListObjGetElements(fontchooserInterp,
fcdPtr->cmdObj, &objc, &objv);
if (result == TCL_OK) {
- tmpv = (Tcl_Obj **) ckalloc(sizeof(Tcl_Obj *) *
- (unsigned)(objc + 2));
+ tmpv = ckalloc(sizeof(Tcl_Obj *) * (objc + 2));
memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc);
tmpv[objc] = fontObj;
result = TkBackgroundEvalObjv(fontchooserInterp,
objc + 1, tmpv, TCL_EVAL_GLOBAL);
- ckfree((char *)tmpv);
+ ckfree(tmpv);
}
}
TkSendVirtualEvent(fcdPtr->parent, "TkFontchooserFontChanged");
@@ -2259,7 +2258,7 @@ DeleteFontchooserData(
if (fcdPtr->cmdObj) {
Tcl_DecrRefCount(fcdPtr->cmdObj);
}
- ckfree((char *)fcdPtr);
+ ckfree(fcdPtr);
if (fontchooserInterp == interp) {
fontchooserInterp = NULL;
@@ -2288,8 +2287,7 @@ TkInitFontchooser(
Tcl_Interp *interp,
ClientData clientData)
{
- FontchooserData *fcdPtr = (FontchooserData*)
- ckalloc(sizeof(FontchooserData));
+ FontchooserData *fcdPtr = ckalloc(sizeof(FontchooserData));
bzero(fcdPtr, sizeof(FontchooserData));
Tcl_SetAssocData(interp, "::tk::fontchooser", DeleteFontchooserData,
diff --git a/carbon/tkMacOSXDraw.c b/carbon/tkMacOSXDraw.c
index da4603c..60240d8 100644
--- a/carbon/tkMacOSXDraw.c
+++ b/carbon/tkMacOSXDraw.c
@@ -498,7 +498,7 @@ TkPutImage(
sliceWidth = (long) image->width * maxRowBytes / rowBytes;
lastSliceWidth = image->width - (sliceWidth * slices);
dataPtr = image->data + image->xoffset;
- newData = (char *) ckalloc(image->height * sliceRowBytes);
+ newData = ckalloc(image->height * sliceRowBytes);
do {
if (slices) {
pixmap.bounds.right = pixmap.bounds.left + sliceWidth;
@@ -2007,7 +2007,7 @@ TkMacOSXMakeStippleMap(
GetPortBounds(TkMacOSXGetDrawablePort(drawable), &portRect);
width = portRect.right - portRect.left;
height = portRect.bottom - portRect.top;
- bitmapPtr = (BitMap *) ckalloc(sizeof(BitMap));
+ bitmapPtr = ckalloc(sizeof(BitMap));
bitmapPtr->bounds.top = bitmapPtr->bounds.left = 0;
bitmapPtr->bounds.right = (short) width;
bitmapPtr->bounds.bottom = (short) height;
diff --git a/carbon/tkMacOSXEmbed.c b/carbon/tkMacOSXEmbed.c
index 9f80401..275f61d 100644
--- a/carbon/tkMacOSXEmbed.c
+++ b/carbon/tkMacOSXEmbed.c
@@ -92,8 +92,7 @@ Tk_MacOSXSetEmbedHandler(
Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc)
{
if (tkMacOSXEmbedHandler == NULL) {
- tkMacOSXEmbedHandler = (TkMacOSXEmbedHandler *)
- ckalloc(sizeof(TkMacOSXEmbedHandler));
+ tkMacOSXEmbedHandler = ckalloc(sizeof(TkMacOSXEmbedHandler));
}
tkMacOSXEmbedHandler->registerWinProc = registerWinProc;
tkMacOSXEmbedHandler->getPortProc = getPortProc;
@@ -137,7 +136,7 @@ TkpMakeWindow(
* Allocate sub window
*/
- macWin = (MacDrawable *) ckalloc(sizeof(MacDrawable));
+ macWin = ckalloc(sizeof(MacDrawable));
if (macWin == NULL) {
winPtr->privatePtr = NULL;
return None;
@@ -263,7 +262,7 @@ TkpUseWindow(
* Make the embedded window.
*/
- macWin = (MacDrawable *) ckalloc(sizeof(MacDrawable));
+ macWin = ckalloc(sizeof(MacDrawable));
if (macWin == NULL) {
winPtr->privatePtr = NULL;
return TCL_ERROR;
@@ -319,7 +318,7 @@ TkpUseWindow(
" does not correspond to a valid Tk Window.", NULL);
return TCL_ERROR;
} else {
- containerPtr = (Container *) ckalloc(sizeof(Container));
+ containerPtr = ckalloc(sizeof(Container));
containerPtr->parentPtr = NULL;
containerPtr->embedded = (Window) macWin;
@@ -392,7 +391,7 @@ TkpMakeContainer(
*/
Tk_MakeWindowExist(tkwin);
- containerPtr = (Container *) ckalloc(sizeof(Container));
+ containerPtr = ckalloc(sizeof(Container));
containerPtr->parent = Tk_WindowId(tkwin);
containerPtr->parentPtr = winPtr;
containerPtr->embedded = None;
@@ -1117,7 +1116,7 @@ EmbedWindowDeleted(
} else {
prevPtr->nextPtr = containerPtr->nextPtr;
}
- ckfree((char *) containerPtr);
+ ckfree(containerPtr);
}
}
diff --git a/carbon/tkMacOSXFont.c b/carbon/tkMacOSXFont.c
index cfc1b79..3ee7551 100644
--- a/carbon/tkMacOSXFont.c
+++ b/carbon/tkMacOSXFont.c
@@ -474,7 +474,7 @@ TkpGetNativeFont(
}
CopyPascalStringToC(fontName, (char*)fontName);
- fontPtr = (MacFont *) ckalloc(sizeof(MacFont));
+ fontPtr = ckalloc(sizeof(MacFont));
InitFont(fontFamily, (char*)fontName, fontSize, fontStyle, fontPtr);
return (TkFont *) fontPtr;
@@ -549,7 +549,7 @@ TkpGetFontFromAttributes(
qdStyle |= underline;
}
if (tkFontPtr == NULL) {
- fontPtr = (MacFont *) ckalloc(sizeof(MacFont));
+ fontPtr = ckalloc(sizeof(MacFont));
} else {
fontPtr = (MacFont *) tkFontPtr;
ReleaseFont(fontPtr);
@@ -2328,7 +2328,7 @@ AddFontFamily(
if (familyListNextFree >= familyListSize) {
familyListSize += 100;
- familyList = (MacFontFamily *) ckrealloc((void*) familyList,
+ familyList = ckrealloc(familyList,
familyListSize * sizeof(*familyList));
}
@@ -2442,7 +2442,7 @@ AddString(
if (stringMemory == NULL
|| (stringMemory->nextFree+len) > STRING_BLOCK_MAX) {
- StringBlock * newblock = (StringBlock *) ckalloc(sizeof(StringBlock));
+ StringBlock *newblock = ckalloc(sizeof(StringBlock));
newblock->next = stringMemory;
newblock->nextFree = 0;
diff --git a/carbon/tkMacOSXHLEvents.c b/carbon/tkMacOSXHLEvents.c
index c9ee7c7..61c9eec 100644
--- a/carbon/tkMacOSXHLEvents.c
+++ b/carbon/tkMacOSXHLEvents.c
@@ -172,7 +172,7 @@ QuitHandler(
* quickly as possible.
*/
- eventPtr = (KillEvent *) ckalloc(sizeof(KillEvent));
+ eventPtr = ckalloc(sizeof(KillEvent));
eventPtr->header.proc = ReallyKillMe;
eventPtr->interp = interp;
diff --git a/carbon/tkMacOSXKeyboard.c b/carbon/tkMacOSXKeyboard.c
index d7638fd..2e40a31 100644
--- a/carbon/tkMacOSXKeyboard.c
+++ b/carbon/tkMacOSXKeyboard.c
@@ -372,7 +372,7 @@ XGetModifierMapping(
* don't generate them either. So there is no modifier map.
*/
- modmap = (XModifierKeymap *) ckalloc(sizeof(XModifierKeymap));
+ modmap = ckalloc(sizeof(XModifierKeymap));
modmap->max_keypermod = 0;
modmap->modifiermap = NULL;
return modmap;
@@ -399,9 +399,9 @@ XFreeModifiermap(
XModifierKeymap *modmap)
{
if (modmap->modifiermap != NULL) {
- ckfree((char *) modmap->modifiermap);
+ ckfree(modmap->modifiermap);
}
- ckfree((char *) modmap);
+ ckfree(modmap);
}
/*
@@ -826,7 +826,7 @@ TkpInitKeymapInfo(
*/
if (dispPtr->modKeyCodes != NULL) {
- ckfree((char *) dispPtr->modKeyCodes);
+ ckfree(dispPtr->modKeyCodes);
}
dispPtr->numModKeyCodes = 0;
dispPtr->modKeyCodes = NULL;
diff --git a/carbon/tkMacOSXMenu.c b/carbon/tkMacOSXMenu.c
index aaf8ea9..a31daf8 100644
--- a/carbon/tkMacOSXMenu.c
+++ b/carbon/tkMacOSXMenu.c
@@ -702,7 +702,7 @@ TkpNewMenu(
return TCL_ERROR;
}
- menuPtr->platformData = (TkMenuPlatformData) ckalloc(sizeof(MacMenu));
+ menuPtr->platformData = ckalloc(sizeof(MacMenu));
((MacMenu *) menuPtr->platformData)->menuHdl = macMenuHdl;
#ifdef USE_TK_MDEF
@@ -791,7 +791,7 @@ TkpDestroyMenu(
DeleteMenu(menuID);
TkMacOSXFreeMenuID(menuID);
DisposeMenu(macMenuHdl);
- ckfree((char *) menuPtr->platformData);
+ ckfree(menuPtr->platformData);
menuPtr->platformData = NULL;
}
}
@@ -853,7 +853,7 @@ TkpDestroyMenuEntry(
{
TkMenu *menuPtr = mePtr->menuPtr;
- ckfree((char *) mePtr->platformEntryData);
+ ckfree(mePtr->platformEntryData);
if ((menuPtr->platformData != NULL)
&& !(menuPtr->menuFlags & MENU_RECONFIGURE_PENDING)) {
menuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
@@ -1625,8 +1625,7 @@ int
TkpMenuNewEntry(
TkMenuEntry *mePtr) /* The menu we are adding an entry to */
{
- EntryGeometry *geometryPtr = (EntryGeometry *)
- ckalloc(sizeof(EntryGeometry));
+ EntryGeometry *geometryPtr = ckalloc(sizeof(EntryGeometry));
TkMenu *menuPtr = mePtr->menuPtr;
geometryPtr->accelTextStart = 0;
@@ -1822,8 +1821,7 @@ DrawMenuBarWhenIdle(
TkMacOSXGetNewMenuID(appleMenuPtr->interp, appleMenuPtr, 0,
&appleID);
macMenuHdl = NewMenu(appleID, "\p\024");
- appleMenuPtr->platformData = (TkMenuPlatformData)
- ckalloc(sizeof(MacMenu));
+ appleMenuPtr->platformData = ckalloc(sizeof(MacMenu));
((MacMenu *)appleMenuPtr->platformData)->menuHdl
= macMenuHdl;
appleMenuPtr->menuFlags |= MENU_APPLE_MENU;
@@ -2148,11 +2146,11 @@ TkpSetWindowMenuBar(
} else {
windowListPtr = listPtr->nextPtr;
}
- ckfree((char *) listPtr);
+ ckfree(listPtr);
}
if (menuPtr != NULL) {
- listPtr = (TopLevelMenubarList *) ckalloc(sizeof(TopLevelMenubarList));
+ listPtr = ckalloc(sizeof(TopLevelMenubarList));
listPtr->nextPtr = windowListPtr;
windowListPtr = listPtr;
listPtr->tkwin = tkwin;
@@ -2265,7 +2263,6 @@ TkMacOSXDispatchMenuEvent(
result = TCL_OK;
} else {
struct MenuCommandHandlerData *data =
- (struct MenuCommandHandlerData *)
ckalloc(sizeof(struct MenuCommandHandlerData));
Tcl_Preserve(menuPtr->interp);
diff --git a/carbon/tkMacOSXMenubutton.c b/carbon/tkMacOSXMenubutton.c
index 7891760..7e603e4 100644
--- a/carbon/tkMacOSXMenubutton.c
+++ b/carbon/tkMacOSXMenubutton.c
@@ -109,7 +109,7 @@ TkMenuButton *
TkpCreateMenuButton(
Tk_Window tkwin)
{
- MacMenuButton *mbPtr = (MacMenuButton *) ckalloc(sizeof(MacMenuButton));
+ MacMenuButton *mbPtr = ckalloc(sizeof(MacMenuButton));
Tk_CreateEventHandler(tkwin, ActivateMask,
MenuButtonEventProc, (ClientData) mbPtr);
diff --git a/carbon/tkMacOSXScale.c b/carbon/tkMacOSXScale.c
index 98f5397..8adcc73 100644
--- a/carbon/tkMacOSXScale.c
+++ b/carbon/tkMacOSXScale.c
@@ -76,7 +76,7 @@ TkScale *
TkpCreateScale(
Tk_Window tkwin)
{
- MacScale *macScalePtr = (MacScale *) ckalloc(sizeof(MacScale));
+ MacScale *macScalePtr = ckalloc(sizeof(MacScale));
macScalePtr->scaleHandle = NULL;
if (scaleActionProc == NULL) {
diff --git a/carbon/tkMacOSXScrlbr.c b/carbon/tkMacOSXScrlbr.c
index 8c83965..b6b9976 100644
--- a/carbon/tkMacOSXScrlbr.c
+++ b/carbon/tkMacOSXScrlbr.c
@@ -172,7 +172,7 @@ TkpCreateScrollbar(
TkMacOSXInitScrollbarMetrics();
initialized = 1;
}
- macScrollPtr = (MacScrollbar *) ckalloc(sizeof(MacScrollbar));
+ macScrollPtr = ckalloc(sizeof(MacScrollbar));
macScrollPtr->sbHandle = NULL;
macScrollPtr->macFlags = 0;
SetRect(&macScrollPtr->eraseRect, 0, 0, 0, 0);
diff --git a/carbon/tkMacOSXSend.c b/carbon/tkMacOSXSend.c
index 642dd5c..2eb0b31 100644
--- a/carbon/tkMacOSXSend.c
+++ b/carbon/tkMacOSXSend.c
@@ -283,7 +283,7 @@ Tk_SetAppName(
* We have found a unique name. Now add it to the registry.
*/
- riPtr = (RegisteredInterp *) ckalloc(sizeof(RegisteredInterp));
+ riPtr = ckalloc(sizeof(RegisteredInterp));
riPtr->interp = interp;
riPtr->name = ckalloc(strlen(actualName) + 1);
riPtr->nextPtr = interpListPtr;
diff --git a/carbon/tkMacOSXSubwindows.c b/carbon/tkMacOSXSubwindows.c
index a90f171..48aef2d 100644
--- a/carbon/tkMacOSXSubwindows.c
+++ b/carbon/tkMacOSXSubwindows.c
@@ -105,9 +105,9 @@ XDestroyWindow(
}
if (macWin->toplevel->referenceCount == 0) {
- ckfree((char *) macWin->toplevel);
+ ckfree(macWin->toplevel);
}
- ckfree((char *) macWin);
+ ckfree(macWin);
return;
}
@@ -203,7 +203,7 @@ XDestroyWindow(
} else {
prevPtr->nextPtr = listPtr->nextPtr;
}
- ckfree((char *) listPtr);
+ ckfree(listPtr);
break;
}
}
@@ -218,7 +218,7 @@ XDestroyWindow(
*/
if (macWin->toplevel->referenceCount == 0) {
- ckfree((char *) macWin->toplevel);
+ ckfree(macWin->toplevel);
}
}
@@ -1410,7 +1410,7 @@ Tk_GetPixmap(
if (display != NULL) {
display->request++;
}
- macPix = (MacDrawable *) ckalloc(sizeof(MacDrawable));
+ macPix = ckalloc(sizeof(MacDrawable));
macPix->winPtr = NULL;
macPix->xOff = 0;
macPix->yOff = 0;
@@ -1458,7 +1458,7 @@ Tk_FreePixmap(
if (macPix->context) {
TkMacOSXDbgMsg("Cannot free CG backed Pixmap");
}
- ckfree((char *) macPix);
+ ckfree(macPix);
}
/*
diff --git a/carbon/tkMacOSXWm.c b/carbon/tkMacOSXWm.c
index e5707f6..6f66f8f 100644
--- a/carbon/tkMacOSXWm.c
+++ b/carbon/tkMacOSXWm.c
@@ -233,7 +233,7 @@ void
TkWmNewWindow(
TkWindow *winPtr) /* Newly-created top-level window. */
{
- WmInfo *wmPtr = (WmInfo *) ckalloc(sizeof(WmInfo));
+ WmInfo *wmPtr = ckalloc(sizeof(WmInfo));
wmPtr->winPtr = winPtr;
wmPtr->reparent = None;
@@ -491,15 +491,15 @@ TkWmDeadWindow(
Tcl_EventuallyFree(protPtr, TCL_DYNAMIC);
}
if (wmPtr->cmdArgv != NULL) {
- ckfree((char *) wmPtr->cmdArgv);
+ ckfree(wmPtr->cmdArgv);
}
if (wmPtr->clientMachine != NULL) {
- ckfree((char *) wmPtr->clientMachine);
+ ckfree(wmPtr->clientMachine);
}
if (wmPtr->flags & WM_UPDATE_PENDING) {
Tk_CancelIdleCall(UpdateGeometryInfo, winPtr);
}
- ckfree((char *) wmPtr);
+ ckfree(wmPtr);
winPtr->wmInfoPtr = NULL;
}
@@ -1124,15 +1124,15 @@ WmClientCmd(
argv3 = Tcl_GetStringFromObj(objv[3], &length);
if (argv3[0] == 0) {
if (wmPtr->clientMachine != NULL) {
- ckfree((char *) wmPtr->clientMachine);
+ ckfree(wmPtr->clientMachine);
wmPtr->clientMachine = NULL;
}
return TCL_OK;
}
if (wmPtr->clientMachine != NULL) {
- ckfree((char *) wmPtr->clientMachine);
+ ckfree(wmPtr->clientMachine);
}
- wmPtr->clientMachine = ckalloc((unsigned) length + 1);
+ wmPtr->clientMachine = ckalloc(length + 1);
strcpy(wmPtr->clientMachine, argv3);
return TCL_OK;
}
@@ -1187,12 +1187,11 @@ WmColormapwindowsCmd(
!= TCL_OK) {
return TCL_ERROR;
}
- cmapList = (TkWindow **) ckalloc((unsigned)
- ((windowObjc+1) * sizeof(TkWindow*)));
+ cmapList = ckalloc((windowObjc+1) * sizeof(TkWindow*));
for (i = 0; i < windowObjc; i++) {
if (TkGetWindowFromObj(interp, tkwin, windowObjv[i],
(Tk_Window *) &winPtr2) != TCL_OK) {
- ckfree((char *) cmapList);
+ ckfree(cmapList);
return TCL_ERROR;
}
if (winPtr2 == winPtr) {
@@ -1212,7 +1211,7 @@ WmColormapwindowsCmd(
}
wmPtr->flags |= WM_COLORMAPS_EXPLICIT;
if (wmPtr->cmapList != NULL) {
- ckfree((char *) wmPtr->cmapList);
+ ckfree(wmPtr->cmapList);
}
wmPtr->cmapList = cmapList;
wmPtr->cmapCount = windowObjc;
@@ -1270,7 +1269,7 @@ WmCommandCmd(
argv3 = Tcl_GetString(objv[3]);
if (argv3[0] == 0) {
if (wmPtr->cmdArgv != NULL) {
- ckfree((char *) wmPtr->cmdArgv);
+ ckfree(wmPtr->cmdArgv);
wmPtr->cmdArgv = NULL;
}
return TCL_OK;
@@ -1279,7 +1278,7 @@ WmCommandCmd(
return TCL_ERROR;
}
if (wmPtr->cmdArgv != NULL) {
- ckfree((char *) wmPtr->cmdArgv);
+ ckfree(wmPtr->cmdArgv);
}
wmPtr->cmdArgc = cmdArgc;
wmPtr->cmdArgv = cmdArgv;
@@ -1700,7 +1699,7 @@ WmGroupCmd(
}
wmPtr->hints.window_group = Tk_WindowId(tkwin2);
wmPtr->hints.flags |= WindowGroupHint;
- wmPtr->leaderName = ckalloc((unsigned) (length + 1));
+ wmPtr->leaderName = ckalloc(length + 1);
strcpy(wmPtr->leaderName, argv3);
}
return TCL_OK;
@@ -1926,10 +1925,10 @@ WmIconnameCmd(
}
if (wmPtr->iconName != NULL) {
- ckfree((char *) wmPtr->iconName);
+ ckfree(wmPtr->iconName);
}
argv3 = Tcl_GetStringFromObj(objv[3], &length);
- wmPtr->iconName = ckalloc((unsigned) length + 1);
+ wmPtr->iconName = ckalloc(length + 1);
strcpy(wmPtr->iconName, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
XSetIconName(winPtr->display, winPtr->window, wmPtr->iconName);
@@ -2504,7 +2503,7 @@ WmProtocolCmd(
}
cmd = Tcl_GetStringFromObj(objv[4], &cmdLength);
if (cmdLength > 0) {
- protPtr = (ProtocolHandler *) ckalloc(HANDLER_SIZE(cmdLength));
+ protPtr = ckalloc(HANDLER_SIZE(cmdLength));
protPtr->protocol = protocol;
protPtr->nextPtr = wmPtr->protPtr;
wmPtr->protPtr = protPtr;
@@ -2701,7 +2700,7 @@ WmStackorderCmd(
for (window_ptr = windows; *window_ptr ; window_ptr++) {
Tcl_AppendElement(interp, (*window_ptr)->pathName);
}
- ckfree((char *) windows);
+ ckfree(windows);
return TCL_OK;
} else {
TkWindow *winPtr2;
@@ -2756,7 +2755,7 @@ WmStackorderCmd(
Tcl_Panic("winPtr2 window not found");
}
- ckfree((char *) windows);
+ ckfree(windows);
if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
&index) != TCL_OK) {
@@ -3004,7 +3003,7 @@ WmTransientCmd(
if (wmPtr->masterWindowName != NULL) {
ckfree(wmPtr->masterWindowName);
}
- wmPtr->masterWindowName = ckalloc((unsigned) length+1);
+ wmPtr->masterWindowName = ckalloc(length+1);
strcpy(wmPtr->masterWindowName, argv3);
}
ApplyMasterOverrideChanges(winPtr, NULL);
@@ -4369,7 +4368,7 @@ TkWmAddToColormapWindows(
* add the toplevel itself as the last element of the list.
*/
- newPtr = (TkWindow **) ckalloc((unsigned) (count+2)*sizeof(TkWindow *));
+ newPtr = ckalloc((count+2) * sizeof(TkWindow *));
if (count > 0) {
memcpy(newPtr, oldPtr, count * sizeof(TkWindow *));
}
@@ -4379,7 +4378,7 @@ TkWmAddToColormapWindows(
newPtr[count-1] = winPtr;
newPtr[count] = topPtr;
if (oldPtr != NULL) {
- ckfree((char *) oldPtr);
+ ckfree(oldPtr);
}
topPtr->wmInfoPtr->cmapList = newPtr;
@@ -5384,7 +5383,7 @@ TkMacOSXMakeRealWindowExist(
* Add this window to the list of toplevel windows.
*/
- listPtr = (TkMacOSXWindowList *) ckalloc(sizeof(TkMacOSXWindowList));
+ listPtr = ckalloc(sizeof(TkMacOSXWindowList));
listPtr->nextPtr = tkMacOSXWindowListPtr;
listPtr->winPtr = winPtr;
tkMacOSXWindowListPtr = listPtr;
@@ -5903,8 +5902,7 @@ TkWmStackorderToplevel(
Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS);
WmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table);
- windows = (TkWindow **)
- ckalloc((table.numEntries+1) * sizeof(TkWindow *));
+ windows = ckalloc((table.numEntries+1) * sizeof(TkWindow *));
/*
* Special cases: If zero or one toplevels were mapped there is no need to
@@ -5924,7 +5922,7 @@ TkWmStackorderToplevel(
frontWindow = GetFrontWindowOfClass(kAllWindowClasses, false);
if (frontWindow == NULL) {
- ckfree((char *) windows);
+ ckfree(windows);
windows = NULL;
} else {
window_ptr = windows + table.numEntries;
diff --git a/carbon/tkMacOSXXStubs.c b/carbon/tkMacOSXXStubs.c
index 22945aa..4262ba9 100644
--- a/carbon/tkMacOSXXStubs.c
+++ b/carbon/tkMacOSXXStubs.c
@@ -154,8 +154,8 @@ TkpOpenDisplay(
}
}
- display = (Display *) ckalloc(sizeof(Display));
- screen = (Screen *) ckalloc(sizeof(Screen));
+ display = ckalloc(sizeof(Display));
+ screen = ckalloc(sizeof(Screen));
bzero(display, sizeof(Display));
bzero(screen, sizeof(Screen));
@@ -183,7 +183,7 @@ TkpOpenDisplay(
screen->white_pixel = 0x00FFFFFF | PIXEL_MAGIC << 24;
screen->ext_data = (XExtData *) &maxBounds;
- screen->root_visual = (Visual *) ckalloc(sizeof(Visual));
+ screen->root_visual = ckalloc(sizeof(Visual));
screen->root_visual->visualid = 0;
screen->root_visual->class = TrueColor;
screen->root_visual->red_mask = 0x00FF0000;
@@ -198,7 +198,7 @@ TkpOpenDisplay(
TkMacOSXDisplayChanged(display);
- gMacDisplay = (TkDisplay *) ckalloc(sizeof(TkDisplay));
+ gMacDisplay = ckalloc(sizeof(TkDisplay));
/*
* This is the quickest way to make sure that all the *Init flags get
@@ -239,11 +239,11 @@ TkpCloseDisplay(
gMacDisplay = NULL;
if (display->screens != NULL) {
if (display->screens->root_visual != NULL) {
- ckfree((char *) display->screens->root_visual);
+ ckfree(display->screens->root_visual);
}
- ckfree((char *) display->screens);
+ ckfree(display->screens);
}
- ckfree((char *) display);
+ ckfree(display);
}
/*
@@ -772,7 +772,7 @@ XCreateImage(
XImage *ximage;
display->request++;
- ximage = (XImage *) ckalloc(sizeof(XImage));
+ ximage = ckalloc(sizeof(XImage));
ximage->height = height;
ximage->width = width;
@@ -926,7 +926,7 @@ DestroyImage(
} else if (image->data) {
ckfree(image->data);
}
- ckfree((char*) image);
+ ckfree(image);
}
return 0;
}