summaryrefslogtreecommitdiffstats
path: root/generic
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 /generic
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 'generic')
-rw-r--r--generic/tk3d.c4
-rw-r--r--generic/tkBind.c41
-rw-r--r--generic/tkBitmap.c8
-rw-r--r--generic/tkBusy.c2
-rw-r--r--generic/tkCanvArc.c5
-rw-r--r--generic/tkCanvLine.c74
-rw-r--r--generic/tkCanvPoly.c35
-rw-r--r--generic/tkCanvPs.c6
-rw-r--r--generic/tkCanvText.c4
-rw-r--r--generic/tkCanvUtil.c50
-rw-r--r--generic/tkCanvas.c61
-rw-r--r--generic/tkClipboard.c10
-rw-r--r--generic/tkCmds.c14
-rw-r--r--generic/tkColor.c4
-rw-r--r--generic/tkConfig.c22
-rw-r--r--generic/tkConsole.c34
-rw-r--r--generic/tkCursor.c4
-rw-r--r--generic/tkEntry.c32
-rw-r--r--generic/tkError.c4
-rw-r--r--generic/tkEvent.c33
-rw-r--r--generic/tkFileFilter.c21
-rw-r--r--generic/tkFocus.c19
-rw-r--r--generic/tkFont.c22
-rw-r--r--generic/tkFrame.c10
-rw-r--r--generic/tkGC.c6
-rw-r--r--generic/tkGeometry.c8
-rw-r--r--generic/tkGrab.c2
-rw-r--r--generic/tkGrid.c31
-rw-r--r--generic/tkImage.c24
-rw-r--r--generic/tkImgBmap.c17
-rw-r--r--generic/tkImgGIF.c12
-rw-r--r--generic/tkImgPNG.c5
-rw-r--r--generic/tkImgPPM.c16
-rw-r--r--generic/tkImgPhInstance.c35
-rw-r--r--generic/tkImgPhoto.c42
-rw-r--r--generic/tkImgUtil.c2
-rw-r--r--generic/tkListbox.c25
-rw-r--r--generic/tkMenu.c55
-rw-r--r--generic/tkMenubutton.c4
-rw-r--r--generic/tkMessage.c6
-rw-r--r--generic/tkObj.c16
-rw-r--r--generic/tkOldConfig.c12
-rw-r--r--generic/tkOldTest.c12
-rw-r--r--generic/tkOption.c26
-rw-r--r--generic/tkPack.c5
-rw-r--r--generic/tkPanedWindow.c27
-rw-r--r--generic/tkPlace.c6
-rw-r--r--generic/tkSelect.c32
-rw-r--r--generic/tkSquare.c8
-rw-r--r--generic/tkStyle.c32
-rw-r--r--generic/tkTest.c38
-rw-r--r--generic/tkText.c59
-rw-r--r--generic/tkTextBTree.c169
-rw-r--r--generic/tkTextDisp.c43
-rw-r--r--generic/tkTextImage.c6
-rw-r--r--generic/tkTextIndex.c22
-rw-r--r--generic/tkTextMark.c4
-rw-r--r--generic/tkTextTag.c29
-rw-r--r--generic/tkTextWind.c17
-rw-r--r--generic/tkUndo.c28
-rw-r--r--generic/tkVisual.c6
-rw-r--r--generic/tkWindow.c25
-rw-r--r--generic/ttk/ttkBlink.c4
-rw-r--r--generic/ttk/ttkCache.c4
-rw-r--r--generic/ttk/ttkImage.c14
-rw-r--r--generic/ttk/ttkLayout.c12
-rw-r--r--generic/ttk/ttkManager.c13
-rw-r--r--generic/ttk/ttkScroll.c4
-rw-r--r--generic/ttk/ttkTagSet.c20
-rw-r--r--generic/ttk/ttkTheme.c30
-rw-r--r--generic/ttk/ttkTrace.c6
-rw-r--r--generic/ttk/ttkTrack.c2
-rw-r--r--generic/ttk/ttkTreeview.c35
73 files changed, 754 insertions, 821 deletions
diff --git a/generic/tk3d.c b/generic/tk3d.c
index 393345d..47c45c4 100644
--- a/generic/tk3d.c
+++ b/generic/tk3d.c
@@ -463,7 +463,7 @@ Tk_Free3DBorder(
prevPtr->nextPtr = borderPtr->nextPtr;
}
if (borderPtr->objRefCount == 0) {
- ckfree((char *) borderPtr);
+ ckfree(borderPtr);
}
}
@@ -535,7 +535,7 @@ FreeBorderObj(
borderPtr->objRefCount--;
if ((borderPtr->objRefCount == 0)
&& (borderPtr->resourceRefCount == 0)) {
- ckfree((char *) borderPtr);
+ ckfree(borderPtr);
}
objPtr->internalRep.twoPtrValue.ptr1 = NULL;
}
diff --git a/generic/tkBind.c b/generic/tkBind.c
index 8f40900..ec46650 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -715,7 +715,7 @@ TkBindInit(
mainPtr->bindingTable = Tk_CreateBindingTable(mainPtr->interp);
- bindInfoPtr = (BindInfo *) ckalloc(sizeof(BindInfo));
+ bindInfoPtr = ckalloc(sizeof(BindInfo));
InitVirtualEventTable(&bindInfoPtr->virtualEventTable);
bindInfoPtr->screenInfo.curDispPtr = NULL;
bindInfoPtr->screenInfo.curScreenIndex = -1;
@@ -782,14 +782,13 @@ Tk_CreateBindingTable(
* table: commands are executed in this
* interpreter. */
{
- BindingTable *bindPtr;
+ BindingTable *bindPtr = ckalloc(sizeof(BindingTable));
int i;
/*
* Create and initialize a new binding table.
*/
- bindPtr = (BindingTable *) ckalloc(sizeof(BindingTable));
for (i = 0; i < EVENT_BUFFER_SIZE; i++) {
bindPtr->eventRing[i].type = -1;
}
@@ -835,7 +834,7 @@ Tk_DeleteBindingTable(
for (psPtr = Tcl_GetHashValue(hPtr); psPtr != NULL; psPtr = nextPtr) {
nextPtr = psPtr->nextSeqPtr;
ckfree(psPtr->script);
- ckfree((char *) psPtr);
+ ckfree(psPtr);
}
}
@@ -845,7 +844,7 @@ Tk_DeleteBindingTable(
Tcl_DeleteHashTable(&bindPtr->patternTable);
Tcl_DeleteHashTable(&bindPtr->objectTable);
- ckfree((char *) bindPtr);
+ ckfree(bindPtr);
}
/*
@@ -926,14 +925,14 @@ Tk_CreateBinding(
if ((append != 0) && (oldStr != NULL)) {
size_t length1 = strlen(oldStr), length2 = strlen(script);
- newStr = ckalloc((unsigned) length1 + length2 + 2);
+ newStr = ckalloc(length1 + length2 + 2);
memcpy(newStr, oldStr, length1);
newStr[length1] = '\n';
memcpy(newStr+length1+1, script, length2+1);
} else {
size_t length = strlen(script);
- newStr = ckalloc((unsigned) length+1);
+ newStr = ckalloc(length + 1);
memcpy(newStr, script, length+1);
}
if (oldStr != NULL) {
@@ -1024,7 +1023,7 @@ Tk_DeleteBinding(
}
ckfree(psPtr->script);
- ckfree((char *) psPtr);
+ ckfree(psPtr);
return TCL_OK;
}
@@ -1177,7 +1176,7 @@ Tk_DeleteAllBindings(
}
}
ckfree(psPtr->script);
- ckfree((char *) psPtr);
+ ckfree(psPtr);
}
Tcl_DeleteHashEntry(hPtr);
}
@@ -2482,8 +2481,8 @@ DeleteVirtualEventTable(
psPtr = Tcl_GetHashValue(hPtr);
for ( ; psPtr != NULL; psPtr = nextPtr) {
nextPtr = psPtr->nextSeqPtr;
- ckfree((char *) psPtr->voPtr);
- ckfree((char *) psPtr);
+ ckfree(psPtr->voPtr);
+ ckfree(psPtr);
}
}
Tcl_DeleteHashTable(&vetPtr->patternTable);
@@ -2558,7 +2557,7 @@ CreateVirtualEvent(
poPtr = Tcl_GetHashValue(vhPtr);
if (poPtr == NULL) {
- poPtr = (PhysicalsOwned *) ckalloc(sizeof(PhysicalsOwned));
+ poPtr = ckalloc(sizeof(PhysicalsOwned));
poPtr->numOwned = 0;
} else {
/*
@@ -2573,8 +2572,8 @@ CreateVirtualEvent(
return TCL_OK;
}
}
- poPtr = (PhysicalsOwned *) ckrealloc((char *) poPtr,
- sizeof(PhysicalsOwned) + poPtr->numOwned * sizeof(PatSeq *));
+ poPtr = ckrealloc(poPtr, sizeof(PhysicalsOwned)
+ + poPtr->numOwned * sizeof(PatSeq *));
}
Tcl_SetHashValue(vhPtr, poPtr);
poPtr->patSeqs[poPtr->numOwned] = psPtr;
@@ -2586,11 +2585,10 @@ CreateVirtualEvent(
voPtr = psPtr->voPtr;
if (voPtr == NULL) {
- voPtr = (VirtualOwners *) ckalloc(sizeof(VirtualOwners));
+ voPtr = ckalloc(sizeof(VirtualOwners));
voPtr->numOwners = 0;
} else {
- voPtr = (VirtualOwners *) ckrealloc((char *) voPtr,
- sizeof(VirtualOwners)
+ voPtr = ckrealloc(voPtr, sizeof(VirtualOwners)
+ voPtr->numOwners * sizeof(Tcl_HashEntry *));
}
psPtr->voPtr = voPtr;
@@ -2717,8 +2715,8 @@ DeleteVirtualEvent(
}
}
}
- ckfree((char *) psPtr->voPtr);
- ckfree((char *) psPtr);
+ ckfree(psPtr->voPtr);
+ ckfree(psPtr);
} else {
/*
* This physical event still triggers some other virtual
@@ -2755,7 +2753,7 @@ DeleteVirtualEvent(
* itself should be deleted.
*/
- ckfree((char *) poPtr);
+ ckfree(poPtr);
Tcl_DeleteHashEntry(vhPtr);
}
return TCL_OK;
@@ -3739,8 +3737,7 @@ FindSequence(
return NULL;
}
- psPtr = (PatSeq *) ckalloc((unsigned)
- (sizeof(PatSeq) + (numPats-1)*sizeof(Pattern)));
+ psPtr = ckalloc(sizeof(PatSeq) + (numPats-1)*sizeof(Pattern));
psPtr->numPats = numPats;
psPtr->script = NULL;
psPtr->flags = flags;
diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c
index f7f648f..bdf160f 100644
--- a/generic/tkBitmap.c
+++ b/generic/tkBitmap.c
@@ -413,7 +413,7 @@ GetBitmap(
* Add information about this bitmap to our database.
*/
- bitmapPtr = (TkBitmap *) ckalloc(sizeof(TkBitmap));
+ bitmapPtr = ckalloc(sizeof(TkBitmap));
bitmapPtr->bitmap = bitmap;
bitmapPtr->width = width;
bitmapPtr->height = height;
@@ -505,7 +505,7 @@ Tk_DefineBitmap(
NULL);
return TCL_ERROR;
}
- predefPtr = (TkPredefBitmap *) ckalloc(sizeof(TkPredefBitmap));
+ predefPtr = ckalloc(sizeof(TkPredefBitmap));
predefPtr->source = source;
predefPtr->width = width;
predefPtr->height = height;
@@ -641,7 +641,7 @@ FreeBitmap(
prevPtr->nextPtr = bitmapPtr->nextPtr;
}
if (bitmapPtr->objRefCount == 0) {
- ckfree((char *) bitmapPtr);
+ ckfree(bitmapPtr);
}
}
@@ -749,7 +749,7 @@ FreeBitmapObj(
bitmapPtr->objRefCount--;
if ((bitmapPtr->objRefCount == 0)
&& (bitmapPtr->resourceRefCount == 0)) {
- ckfree((char *) bitmapPtr);
+ ckfree(bitmapPtr);
}
objPtr->internalRep.twoPtrValue.ptr1 = NULL;
}
diff --git a/generic/tkBusy.c b/generic/tkBusy.c
index 320f177..3a683e3 100644
--- a/generic/tkBusy.c
+++ b/generic/tkBusy.c
@@ -526,7 +526,7 @@ CreateBusy(
Window parent;
Tk_FakeWin *winPtr;
- busyPtr = (Busy *) ckalloc(sizeof(Busy));
+ busyPtr = ckalloc(sizeof(Busy));
x = y = 0;
length = strlen(Tk_Name(tkRef));
name = ckalloc(length + 6);
diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c
index f0c4de2..58bb4c7 100644
--- a/generic/tkCanvArc.c
+++ b/generic/tkCanvArc.c
@@ -590,7 +590,7 @@ DeleteArc(
Tk_DeleteOutline(display, &(arcPtr->outline));
if (arcPtr->numOutlinePoints != 0) {
- ckfree((char *) arcPtr->outlinePtr);
+ ckfree(arcPtr->outlinePtr);
}
if (arcPtr->fillColor != NULL) {
Tk_FreeColor(arcPtr->fillColor);
@@ -1453,8 +1453,7 @@ ComputeArcOutline(
*/
if (arcPtr->numOutlinePoints == 0) {
- arcPtr->outlinePtr = (double *) ckalloc((unsigned)
- (26 * sizeof(double)));
+ arcPtr->outlinePtr = ckalloc(26 * sizeof(double));
arcPtr->numOutlinePoints = 22;
}
outlinePtr = arcPtr->outlinePtr;
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index 34cdfae..9be9bf6 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.c
@@ -408,10 +408,9 @@ LineCoords(
} else {
numPoints = objc/2;
if (linePtr->numPoints != numPoints) {
- coordPtr = (double *)
- ckalloc(sizeof(double) * (unsigned) objc);
+ coordPtr = ckalloc(sizeof(double) * objc);
if (linePtr->coordPtr != NULL) {
- ckfree((char *) linePtr->coordPtr);
+ ckfree(linePtr->coordPtr);
}
linePtr->coordPtr = coordPtr;
linePtr->numPoints = numPoints;
@@ -430,11 +429,11 @@ LineCoords(
*/
if (linePtr->firstArrowPtr != NULL) {
- ckfree((char *) linePtr->firstArrowPtr);
+ ckfree(linePtr->firstArrowPtr);
linePtr->firstArrowPtr = NULL;
}
if (linePtr->lastArrowPtr != NULL) {
- ckfree((char *) linePtr->lastArrowPtr);
+ ckfree(linePtr->lastArrowPtr);
linePtr->lastArrowPtr = NULL;
}
if (linePtr->arrow != ARROWS_NONE) {
@@ -561,7 +560,7 @@ ConfigureLine(
&& (linePtr->arrow != ARROWS_BOTH)) {
linePtr->coordPtr[0] = linePtr->firstArrowPtr[0];
linePtr->coordPtr[1] = linePtr->firstArrowPtr[1];
- ckfree((char *) linePtr->firstArrowPtr);
+ ckfree(linePtr->firstArrowPtr);
linePtr->firstArrowPtr = NULL;
}
if ((linePtr->lastArrowPtr != NULL) && (linePtr->arrow != ARROWS_LAST)
@@ -571,7 +570,7 @@ ConfigureLine(
i = 2*(linePtr->numPoints-1);
linePtr->coordPtr[i] = linePtr->lastArrowPtr[0];
linePtr->coordPtr[i+1] = linePtr->lastArrowPtr[1];
- ckfree((char *) linePtr->lastArrowPtr);
+ ckfree(linePtr->lastArrowPtr);
linePtr->lastArrowPtr = NULL;
}
if (linePtr->arrow != ARROWS_NONE) {
@@ -614,16 +613,16 @@ DeleteLine(
Tk_DeleteOutline(display, &linePtr->outline);
if (linePtr->coordPtr != NULL) {
- ckfree((char *) linePtr->coordPtr);
+ ckfree(linePtr->coordPtr);
}
if (linePtr->arrowGC != None) {
Tk_FreeGC(display, linePtr->arrowGC);
}
if (linePtr->firstArrowPtr != NULL) {
- ckfree((char *) linePtr->firstArrowPtr);
+ ckfree(linePtr->firstArrowPtr);
}
if (linePtr->lastArrowPtr != NULL) {
- ckfree((char *) linePtr->lastArrowPtr);
+ ckfree(linePtr->lastArrowPtr);
}
}
@@ -879,8 +878,7 @@ DisplayLine(
if (numPoints <= MAX_STATIC_POINTS) {
pointPtr = staticPoints;
} else {
- pointPtr = (XPoint *)
- ckalloc((unsigned) numPoints * 3 * sizeof(XPoint));
+ pointPtr = ckalloc(numPoints * 3 * sizeof(XPoint));
}
if ((linePtr->smooth) && (linePtr->numPoints > 2)) {
@@ -916,7 +914,7 @@ DisplayLine(
(unsigned) intwidth+1, (unsigned) intwidth+1, 0, 64*360);
}
if (pointPtr != staticPoints) {
- ckfree((char *) pointPtr);
+ ckfree(pointPtr);
}
/*
@@ -989,8 +987,7 @@ LineInsert(
linePtr->coordPtr[length-2] = linePtr->lastArrowPtr[0];
linePtr->coordPtr[length-1] = linePtr->lastArrowPtr[1];
}
- newCoordPtr = (double *)
- ckalloc(sizeof(double) * (unsigned)(length + objc));
+ newCoordPtr = ckalloc(sizeof(double) * (length + objc));
for (i=0; i<beforeThis; i++) {
newCoordPtr[i] = linePtr->coordPtr[i];
}
@@ -998,7 +995,7 @@ LineInsert(
if (Tcl_GetDoubleFromObj(NULL, objv[i],
&newCoordPtr[i + beforeThis]) != TCL_OK) {
Tcl_ResetResult(Canvas(canvas)->interp);
- ckfree((char *) newCoordPtr);
+ ckfree(newCoordPtr);
return;
}
}
@@ -1007,7 +1004,7 @@ LineInsert(
newCoordPtr[i+objc] = linePtr->coordPtr[i];
}
if (linePtr->coordPtr) {
- ckfree((char *) linePtr->coordPtr);
+ ckfree(linePtr->coordPtr);
}
linePtr->coordPtr = newCoordPtr;
length += objc ;
@@ -1070,11 +1067,11 @@ LineInsert(
}
}
if (linePtr->firstArrowPtr != NULL) {
- ckfree((char *) linePtr->firstArrowPtr);
+ ckfree(linePtr->firstArrowPtr);
linePtr->firstArrowPtr = NULL;
}
if (linePtr->lastArrowPtr != NULL) {
- ckfree((char *) linePtr->lastArrowPtr);
+ ckfree(linePtr->lastArrowPtr);
linePtr->lastArrowPtr = NULL;
}
if (linePtr->arrow != ARROWS_NONE) {
@@ -1247,11 +1244,11 @@ LineDeleteCoords(
}
linePtr->numPoints -= count/2;
if (linePtr->firstArrowPtr != NULL) {
- ckfree((char *) linePtr->firstArrowPtr);
+ ckfree(linePtr->firstArrowPtr);
linePtr->firstArrowPtr = NULL;
}
if (linePtr->lastArrowPtr != NULL) {
- ckfree((char *) linePtr->lastArrowPtr);
+ ckfree(linePtr->lastArrowPtr);
linePtr->lastArrowPtr = NULL;
}
if (linePtr->arrow != ARROWS_NONE) {
@@ -1371,8 +1368,7 @@ LineToPoint(
if (numPoints <= MAX_STATIC_POINTS) {
linePoints = staticSpace;
} else {
- linePoints = (double *)
- ckalloc((unsigned) (2*numPoints*sizeof(double)));
+ linePoints = ckalloc(2 * numPoints * sizeof(double));
}
numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr,
linePtr->numPoints, linePtr->splineSteps, NULL, linePoints);
@@ -1531,7 +1527,7 @@ LineToPoint(
done:
if ((linePoints != staticSpace) && (linePoints != linePtr->coordPtr)) {
- ckfree((char *) linePoints);
+ ckfree(linePoints);
}
return bestDist;
}
@@ -1607,8 +1603,7 @@ LineToArea(
if (numPoints <= MAX_STATIC_POINTS) {
linePoints = staticSpace;
} else {
- linePoints = (double *)
- ckalloc((unsigned) (2*numPoints*sizeof(double)));
+ linePoints = ckalloc(2 * numPoints * sizeof(double));
}
numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr,
linePtr->numPoints, linePtr->splineSteps, NULL, linePoints);
@@ -1654,7 +1649,7 @@ LineToArea(
done:
if ((linePoints != staticSpace) && (linePoints != linePtr->coordPtr)) {
- ckfree((char *) linePoints);
+ ckfree(linePoints);
}
return result;
}
@@ -1699,7 +1694,7 @@ ScaleLine(
if (linePtr->firstArrowPtr != NULL) {
linePtr->coordPtr[0] = linePtr->firstArrowPtr[0];
linePtr->coordPtr[1] = linePtr->firstArrowPtr[1];
- ckfree((char *) linePtr->firstArrowPtr);
+ ckfree(linePtr->firstArrowPtr);
linePtr->firstArrowPtr = NULL;
}
if (linePtr->lastArrowPtr != NULL) {
@@ -1708,7 +1703,7 @@ ScaleLine(
i = 2*(linePtr->numPoints-1);
linePtr->coordPtr[i] = linePtr->lastArrowPtr[0];
linePtr->coordPtr[i+1] = linePtr->lastArrowPtr[1];
- ckfree((char *) linePtr->lastArrowPtr);
+ ckfree(linePtr->lastArrowPtr);
linePtr->lastArrowPtr = NULL;
}
for (i = 0, coordPtr = linePtr->coordPtr; i < linePtr->numPoints;
@@ -1906,7 +1901,7 @@ ParseArrowShape(
Tcl_AppendResult(interp, "bad arrow shape \"", value,
"\": must be list with three numbers", NULL);
if (argv != NULL) {
- ckfree((char *) argv);
+ ckfree(argv);
}
return TCL_ERROR;
}
@@ -1920,10 +1915,10 @@ ParseArrowShape(
!= TCL_OK)) {
goto syntaxError;
}
- linePtr->arrowShapeA = (float)a;
- linePtr->arrowShapeB = (float)b;
- linePtr->arrowShapeC = (float)c;
- ckfree((char *) argv);
+ linePtr->arrowShapeA = (float) a;
+ linePtr->arrowShapeB = (float) b;
+ linePtr->arrowShapeC = (float) c;
+ ckfree(argv);
return TCL_OK;
}
@@ -2153,8 +2148,7 @@ ConfigureArrows(
if (linePtr->arrow != ARROWS_LAST) {
poly = linePtr->firstArrowPtr;
if (poly == NULL) {
- poly = (double *)
- ckalloc((unsigned) (2*PTS_IN_ARROW*sizeof(double)));
+ poly = ckalloc(2 * PTS_IN_ARROW * sizeof(double));
poly[0] = poly[10] = linePtr->coordPtr[0];
poly[1] = poly[11] = linePtr->coordPtr[1];
linePtr->firstArrowPtr = poly;
@@ -2198,8 +2192,7 @@ ConfigureArrows(
coordPtr = linePtr->coordPtr + 2*(linePtr->numPoints-2);
poly = linePtr->lastArrowPtr;
if (poly == NULL) {
- poly = (double *)
- ckalloc((unsigned) (2*PTS_IN_ARROW*sizeof(double)));
+ poly = ckalloc(2 * PTS_IN_ARROW * sizeof(double));
poly[0] = poly[10] = coordPtr[2];
poly[1] = poly[11] = coordPtr[3];
linePtr->lastArrowPtr = poly;
@@ -2348,14 +2341,13 @@ LineToPostscript(
linePtr->numPoints, linePtr->splineSteps, NULL, NULL);
pointPtr = staticPoints;
if (numPoints > MAX_STATIC_POINTS) {
- pointPtr = (double *)
- ckalloc((unsigned) (numPoints * 2 * sizeof(double)));
+ pointPtr = ckalloc(numPoints * 2 * sizeof(double));
}
numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr,
linePtr->numPoints, linePtr->splineSteps, NULL, pointPtr);
Tk_CanvasPsPath(interp, canvas, pointPtr, numPoints);
if (pointPtr != staticPoints) {
- ckfree((char *) pointPtr);
+ ckfree(pointPtr);
}
}
diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c
index c64dcc1..b043aad 100644
--- a/generic/tkCanvPoly.c
+++ b/generic/tkCanvPoly.c
@@ -367,7 +367,7 @@ PolygonCoords(
numPoints = objc/2;
if (polyPtr->pointsAllocated <= numPoints) {
if (polyPtr->coordPtr != NULL) {
- ckfree((char *) polyPtr->coordPtr);
+ ckfree(polyPtr->coordPtr);
}
/*
@@ -375,8 +375,7 @@ PolygonCoords(
* another point to close the polygon.
*/
- polyPtr->coordPtr = (double *)
- ckalloc(sizeof(double) * (unsigned)(objc+2));
+ polyPtr->coordPtr = ckalloc(sizeof(double) * (objc+2));
polyPtr->pointsAllocated = numPoints+1;
}
for (i = objc-1; i >= 0; i--) {
@@ -572,7 +571,7 @@ DeletePolygon(
Tk_DeleteOutline(display, &polyPtr->outline);
if (polyPtr->coordPtr != NULL) {
- ckfree((char *) polyPtr->coordPtr);
+ ckfree(polyPtr->coordPtr);
}
if (polyPtr->fillColor != NULL) {
Tk_FreeColor(polyPtr->fillColor);
@@ -825,7 +824,7 @@ TkFillPolygon(
if (numPoints <= MAX_STATIC_POINTS) {
pointPtr = staticPoints;
} else {
- pointPtr = (XPoint *) ckalloc((unsigned) numPoints * sizeof(XPoint));
+ pointPtr = ckalloc(numPoints * sizeof(XPoint));
}
for (i=0, pPtr=pointPtr ; i<numPoints; i+=1, coordPtr+=2, pPtr++) {
@@ -847,7 +846,7 @@ TkFillPolygon(
CoordModeOrigin);
}
if (pointPtr != staticPoints) {
- ckfree((char *) pointPtr);
+ ckfree(pointPtr);
}
}
@@ -971,8 +970,7 @@ DisplayPolygon(
if (numPoints <= MAX_STATIC_POINTS) {
pointPtr = staticPoints;
} else {
- pointPtr = (XPoint *)
- ckalloc((unsigned) numPoints * sizeof(XPoint));
+ pointPtr = ckalloc(numPoints * sizeof(XPoint));
}
numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr,
polyPtr->numPoints, polyPtr->splineSteps, pointPtr, NULL);
@@ -985,7 +983,7 @@ DisplayPolygon(
numPoints, CoordModeOrigin);
}
if (pointPtr != staticPoints) {
- ckfree((char *) pointPtr);
+ ckfree(pointPtr);
}
}
Tk_ResetOutlineGC(canvas, itemPtr, &polyPtr->outline);
@@ -1039,15 +1037,14 @@ PolygonInsert(
while (beforeThis < 0) {
beforeThis += length;
}
- newCoordPtr = (double *)
- ckalloc(sizeof(double) * (unsigned)(length + 2 + objc));
+ newCoordPtr = ckalloc(sizeof(double) * (length + 2 + objc));
for (i=0; i<beforeThis; i++) {
newCoordPtr[i] = polyPtr->coordPtr[i];
}
for (i=0; i<objc; i++) {
if (Tcl_GetDoubleFromObj(NULL, objv[i],
&newCoordPtr[i+beforeThis]) != TCL_OK){
- ckfree((char *) newCoordPtr);
+ ckfree(newCoordPtr);
return;
}
}
@@ -1056,7 +1053,7 @@ PolygonInsert(
newCoordPtr[i+objc] = polyPtr->coordPtr[i];
}
if (polyPtr->coordPtr) {
- ckfree((char *) polyPtr->coordPtr);
+ ckfree(polyPtr->coordPtr);
}
length += objc;
polyPtr->coordPtr = newCoordPtr;
@@ -1200,7 +1197,7 @@ PolygonDeleteCoords(
if (count >= length) {
polyPtr->numPoints = 0;
if (polyPtr->coordPtr != NULL) {
- ckfree((char *) polyPtr->coordPtr);
+ ckfree(polyPtr->coordPtr);
}
ComputePolygonBbox(canvas, polyPtr);
return;
@@ -1289,8 +1286,7 @@ PolygonToPoint(
if (numPoints <= MAX_STATIC_POINTS) {
polyPoints = staticSpace;
} else {
- polyPoints = (double *)
- ckalloc((unsigned) 2*numPoints*sizeof(double));
+ polyPoints = ckalloc(2 * numPoints * sizeof(double));
}
numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr,
polyPtr->numPoints, polyPtr->splineSteps, NULL, polyPoints);
@@ -1408,7 +1404,7 @@ PolygonToPoint(
donepoint:
if (polyPoints != staticSpace && polyPoints != polyPtr->coordPtr) {
- ckfree((char *) polyPoints);
+ ckfree(polyPoints);
}
return bestDist;
}
@@ -1499,8 +1495,7 @@ PolygonToArea(
if (numPoints <= MAX_STATIC_POINTS) {
polyPoints = staticSpace;
} else {
- polyPoints = (double *)
- ckalloc((unsigned) 2*numPoints*sizeof(double));
+ polyPoints = ckalloc(2 * numPoints * sizeof(double));
}
numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr,
polyPtr->numPoints, polyPtr->splineSteps, NULL, polyPoints);
@@ -1603,7 +1598,7 @@ PolygonToArea(
donearea:
if ((polyPoints != staticSpace) && (polyPoints != polyPtr->coordPtr)) {
- ckfree((char *) polyPoints);
+ ckfree(polyPoints);
}
return inside;
}
diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c
index 1af0a3a..c5b582d 100644
--- a/generic/tkCanvPs.c
+++ b/generic/tkCanvPs.c
@@ -1220,7 +1220,7 @@ TkPostscriptImage(
*/
ncolors = visual->map_entries;
- cdata.colors = (XColor *) ckalloc(sizeof(XColor) * ncolors);
+ cdata.colors = ckalloc(sizeof(XColor) * ncolors);
cdata.ncolors = ncolors;
if (visual->class == DirectColor || visual->class == TrueColor) {
@@ -1295,7 +1295,7 @@ TkPostscriptImage(
"Can't generate Postscript for images more than %d pixels wide",
maxWidth);
Tcl_AppendResult(interp, buffer, NULL);
- ckfree((char *) cdata.colors);
+ ckfree(cdata.colors);
return TCL_ERROR;
}
@@ -1409,7 +1409,7 @@ TkPostscriptImage(
sprintf(buffer, "0 %d translate\n", rows);
Tcl_AppendResult(interp, buffer, NULL);
}
- ckfree((char *) cdata.colors);
+ ckfree(cdata.colors);
return TCL_OK;
}
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index ce587af..9477c63 100644
--- a/generic/tkCanvText.c
+++ b/generic/tkCanvText.c
@@ -1026,7 +1026,7 @@ TextInsert(
return;
}
- newStr = ckalloc((unsigned) textPtr->numBytes + byteCount + 1);
+ newStr = ckalloc(textPtr->numBytes + byteCount + 1);
memcpy(newStr, text, (size_t) byteIndex);
strcpy(newStr + byteIndex, string);
strcpy(newStr + byteIndex + byteCount, text + byteIndex);
@@ -1107,7 +1107,7 @@ TextDeleteChars(
byteCount = Tcl_UtfAtIndex(text + byteIndex, charsRemoved)
- (text + byteIndex);
- newStr = ckalloc((unsigned) (textPtr->numBytes + 1 - byteCount));
+ newStr = ckalloc(textPtr->numBytes + 1 - byteCount);
memcpy(newStr, text, (size_t) byteIndex);
strcpy(newStr + byteIndex, text + byteIndex + byteCount);
diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c
index 9c8e576..964e2af 100644
--- a/generic/tkCanvUtil.c
+++ b/generic/tkCanvUtil.c
@@ -412,12 +412,12 @@ Tk_CanvasTagsParseProc(
*/
if (itemPtr->tagSpace < argc) {
- newPtr = (Tk_Uid *) ckalloc((unsigned) (argc * sizeof(Tk_Uid)));
+ newPtr = ckalloc(argc * sizeof(Tk_Uid));
for (i = itemPtr->numTags-1; i >= 0; i--) {
newPtr[i] = itemPtr->tagPtr[i];
}
if (itemPtr->tagPtr != itemPtr->staticTagSpace) {
- ckfree((char *) itemPtr->tagPtr);
+ ckfree(itemPtr->tagPtr);
}
itemPtr->tagPtr = newPtr;
itemPtr->tagSpace = argc;
@@ -426,7 +426,7 @@ Tk_CanvasTagsParseProc(
for (i = 0; i < argc; i++) {
itemPtr->tagPtr[i] = Tk_GetUid(argv[i]);
}
- ckfree((char *) argv);
+ ckfree(argv);
return TCL_OK;
}
@@ -545,7 +545,7 @@ TkCanvasDashPrintProc(
if (i < 0) {
i = -i;
*freeProcPtr = TCL_DYNAMIC;
- buffer = (char *) ckalloc((unsigned int) (i+1));
+ buffer = ckalloc(i + 1);
p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array;
memcpy(buffer, p, (unsigned int) i);
buffer[i] = 0;
@@ -554,7 +554,7 @@ TkCanvasDashPrintProc(
*freeProcPtr = NULL;
return "";
}
- buffer = (char *) ckalloc((unsigned int) (4*i));
+ buffer = ckalloc(4 * i);
*freeProcPtr = TCL_DYNAMIC;
p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array;
@@ -590,14 +590,12 @@ InitSmoothMethods(
{
SmoothAssocData *methods, *ptr;
- methods = (SmoothAssocData *) ckalloc(sizeof(SmoothAssocData));
+ methods = ckalloc(sizeof(SmoothAssocData));
methods->smooth.name = tkRawSmoothMethod.name;
methods->smooth.coordProc = tkRawSmoothMethod.coordProc;
methods->smooth.postscriptProc = tkRawSmoothMethod.postscriptProc;
- methods->nextPtr = (SmoothAssocData *) ckalloc(sizeof(SmoothAssocData));
-
- ptr = methods->nextPtr;
+ ptr = methods->nextPtr = ckalloc(sizeof(SmoothAssocData));
ptr->smooth.name = tkBezierSmoothMethod.name;
ptr->smooth.coordProc = tkBezierSmoothMethod.coordProc;
ptr->smooth.postscriptProc = tkBezierSmoothMethod.postscriptProc;
@@ -653,11 +651,11 @@ Tk_CreateSmoothMethod(
} else {
prevPtr->nextPtr = typePtr2->nextPtr;
}
- ckfree((char *) typePtr2);
+ ckfree(typePtr2);
break;
}
}
- ptr = (SmoothAssocData *) ckalloc(sizeof(SmoothAssocData));
+ ptr = ckalloc(sizeof(SmoothAssocData));
ptr->smooth.name = smooth->name;
ptr->smooth.coordProc = smooth->coordProc;
ptr->smooth.postscriptProc = smooth->postscriptProc;
@@ -693,7 +691,7 @@ SmoothMethodCleanupProc(
while (methods != NULL) {
ptr = methods;
methods = methods->nextPtr;
- ckfree((char *) ptr);
+ ckfree(ptr);
}
}
/*
@@ -880,10 +878,10 @@ Tk_GetDash(
}
if ((unsigned) ABS(dash->number) > sizeof(char *)) {
- ckfree((char *) dash->pattern.pt);
+ ckfree(dash->pattern.pt);
}
if (argc > (int)sizeof(char *)) {
- dash->pattern.pt = pt = ckalloc((unsigned) argc);
+ dash->pattern.pt = pt = ckalloc(argc);
} else {
pt = dash->pattern.array;
}
@@ -904,7 +902,7 @@ Tk_GetDash(
}
if (argv != NULL) {
- ckfree((char *) argv);
+ ckfree(argv);
}
return TCL_OK;
@@ -917,10 +915,10 @@ Tk_GetDash(
"\": must be a list of integers or a format like \"-..\"", NULL);
syntaxError:
if (argv != NULL) {
- ckfree((char *) argv);
+ ckfree(argv);
}
if ((unsigned) ABS(dash->number) > sizeof(char *)) {
- ckfree((char *) dash->pattern.pt);
+ ckfree(dash->pattern.pt);
}
dash->number = 0;
return TCL_ERROR;
@@ -992,13 +990,13 @@ Tk_DeleteOutline(
Tk_FreeGC(display, outline->gc);
}
if ((unsigned) ABS(outline->dash.number) > sizeof(char *)) {
- ckfree((char *) outline->dash.pattern.pt);
+ ckfree(outline->dash.pattern.pt);
}
if ((unsigned) ABS(outline->activeDash.number) > sizeof(char *)) {
- ckfree((char *) outline->activeDash.pattern.pt);
+ ckfree(outline->activeDash.pattern.pt);
}
if ((unsigned) ABS(outline->disabledDash.number) > sizeof(char *)) {
- ckfree((char *) outline->disabledDash.pattern.pt);
+ ckfree(outline->disabledDash.pattern.pt);
}
if (outline->color != NULL) {
Tk_FreeColor(outline->color);
@@ -1210,7 +1208,7 @@ Tk_ChangeOutlineGC(
int i = -dash->number;
p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array;
- q = (char *) ckalloc(2 * (unsigned) i);
+ q = ckalloc(2 * i);
i = DashConvert(q, p, i, width);
XSetDashes(Canvas(canvas)->display, outline->gc, outline->offset, q,i);
ckfree(q);
@@ -1410,10 +1408,10 @@ Tk_CanvasPsOutline(
Tcl_AppendResult(interp, string, NULL);
if (dash->number > 10) {
- str = (char *) ckalloc((unsigned) (1 + 4*dash->number));
+ str = ckalloc(1 + 4*dash->number);
} else if (dash->number < -5) {
- str = (char *) ckalloc((unsigned) (1 - 8*dash->number));
- lptr = (char *) ckalloc((unsigned) (1 - 2*dash->number));
+ str = ckalloc(1 - 8*dash->number);
+ lptr = ckalloc(1 - 2*dash->number);
}
ptr = ((unsigned) ABS(dash->number) > sizeof(char *)) ?
dash->pattern.pt : dash->pattern.array;
@@ -1704,7 +1702,7 @@ TkCanvTranslatePath(
if (numVertex*12 <= (int) (sizeof(staticSpace) / sizeof(double))) {
tempArr = staticSpace;
} else {
- tempArr = (double *) ckalloc(numVertex * 12 * sizeof(double));
+ tempArr = ckalloc(numVertex * 12 * sizeof(double));
}
for (i=0; i<numVertex*2; i++){
tempArr[i] = coordArr[i];
@@ -1844,7 +1842,7 @@ TkCanvTranslatePath(
TranslateAndAppendCoords(canvPtr, a[i*2], a[i*2+1], outArr, i);
}
if (tempArr != staticSpace) {
- ckfree((char *) tempArr);
+ ckfree(tempArr);
}
return numOutput;
}
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index 275b97f..1a3ed52 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -398,7 +398,7 @@ ItemConfigure(
result = itemPtr->typePtr->configProc(interp, (Tk_Canvas) canvasPtr,
itemPtr, objc, (Tcl_Obj **) args, TK_CONFIG_ARGV_ONLY);
if (args != NULL) {
- ckfree((char *) args);
+ ckfree(args);
}
}
return result;
@@ -447,7 +447,7 @@ ItemCoords(
result = itemPtr->typePtr->coordProc(interp, (Tk_Canvas) canvasPtr,
itemPtr, objc, (Tcl_Obj **) args);
if (args != NULL) {
- ckfree((char *) args);
+ ckfree(args);
}
}
return result;
@@ -473,7 +473,7 @@ ItemCreate(
result = itemPtr->typePtr->createProc(interp, (Tk_Canvas) canvasPtr,
itemPtr, objc-3, (Tcl_Obj **) args);
if (args != NULL) {
- ckfree((char *) args);
+ ckfree(args);
}
}
return result;
@@ -664,7 +664,7 @@ Tk_CanvasObjCmd(
* pointers).
*/
- canvasPtr = (TkCanvas *) ckalloc(sizeof(TkCanvas));
+ canvasPtr = ckalloc(sizeof(TkCanvas));
canvasPtr->tkwin = newWin;
canvasPtr->display = Tk_Display(newWin);
canvasPtr->interp = interp;
@@ -1292,7 +1292,7 @@ CanvasWidgetCmd(
}
typePtr = matchPtr;
- itemPtr = (Tk_Item *) ckalloc((unsigned) typePtr->itemSize);
+ itemPtr = ckalloc(typePtr->itemSize);
itemPtr->id = canvasPtr->nextId;
canvasPtr->nextId++;
itemPtr->tagPtr = itemPtr->staticTagSpace;
@@ -1303,7 +1303,7 @@ CanvasWidgetCmd(
itemPtr->redraw_flags = 0;
if (ItemCreate(canvasPtr, itemPtr, objc, objv) != TCL_OK) {
- ckfree((char *) itemPtr);
+ ckfree(itemPtr);
result = TCL_ERROR;
goto done;
}
@@ -1386,7 +1386,7 @@ CanvasWidgetCmd(
}
ItemDelete(canvasPtr, itemPtr);
if (itemPtr->tagPtr != itemPtr->staticTagSpace) {
- ckfree((char *) itemPtr->tagPtr);
+ ckfree(itemPtr->tagPtr);
}
entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable,
(char *) INT2PTR(itemPtr->id));
@@ -1406,7 +1406,7 @@ CanvasWidgetCmd(
if (canvasPtr->lastItemPtr == itemPtr) {
canvasPtr->lastItemPtr = itemPtr->prevPtr;
}
- ckfree((char *) itemPtr);
+ ckfree(itemPtr);
if (itemPtr == canvasPtr->currentItemPtr) {
canvasPtr->currentItemPtr = NULL;
canvasPtr->flags |= REPICK_NEEDED;
@@ -1748,7 +1748,7 @@ CanvasWidgetCmd(
result = TkCanvPostscriptCmd(canvasPtr, interp, objc, args);
if (args != NULL) {
- ckfree((char *) args);
+ ckfree(args);
}
break;
}
@@ -2032,7 +2032,7 @@ CanvasWidgetCmd(
type = Tk_GetScrollInfo(interp, objc, args, &fraction, &count);
if (args != NULL) {
- ckfree((char *) args);
+ ckfree(args);
}
switch (type) {
case TK_SCROLL_ERROR:
@@ -2079,7 +2079,7 @@ CanvasWidgetCmd(
type = Tk_GetScrollInfo(interp, objc, args, &fraction, &count);
if (args != NULL) {
- ckfree((char *) args);
+ ckfree(args);
}
switch (type) {
case TK_SCROLL_ERROR:
@@ -2157,9 +2157,9 @@ DestroyCanvas(
canvasPtr->firstItemPtr = itemPtr->nextPtr;
ItemDelete(canvasPtr, itemPtr);
if (itemPtr->tagPtr != itemPtr->staticTagSpace) {
- ckfree((char *) itemPtr->tagPtr);
+ ckfree(itemPtr->tagPtr);
}
- ckfree((char *) itemPtr);
+ ckfree(itemPtr);
}
/*
@@ -2185,7 +2185,7 @@ DestroyCanvas(
}
Tk_FreeOptions(configSpecs, (char *) canvasPtr, canvasPtr->display, 0);
canvasPtr->tkwin = NULL;
- ckfree((char *) canvasPtr);
+ ckfree(canvasPtr);
}
/*
@@ -2307,7 +2307,7 @@ ConfigureCanvas(
canvasPtr->regionString, "\"", NULL);
badRegion:
ckfree(canvasPtr->regionString);
- ckfree((char *) argv2);
+ ckfree(argv2);
canvasPtr->regionString = NULL;
return TCL_ERROR;
}
@@ -2321,7 +2321,7 @@ ConfigureCanvas(
argv2[3], &canvasPtr->scrollY2) != TCL_OK)) {
goto badRegion;
}
- ckfree((char *) argv2);
+ ckfree(argv2);
}
flags = canvasPtr->tsoffset.flags;
@@ -3278,7 +3278,7 @@ TagSearchExprInit(
TagSearchExpr *expr = *exprPtrPtr;
if (expr == NULL) {
- expr = (TagSearchExpr *) ckalloc(sizeof(TagSearchExpr));
+ expr = ckalloc(sizeof(TagSearchExpr));
expr->allocated = 0;
expr->uids = NULL;
expr->next = NULL;
@@ -3309,9 +3309,9 @@ TagSearchExprDestroy(
{
if (expr != NULL) {
if (expr->uids) {
- ckfree((char *) expr->uids);
+ ckfree(expr->uids);
}
- ckfree((char *) expr);
+ ckfree(expr);
}
}
@@ -3359,7 +3359,7 @@ TagSearchScan(
* Allocate primary search struct on first call.
*/
- *searchPtrPtr = searchPtr = (TagSearch *) ckalloc(sizeof(TagSearch));
+ *searchPtrPtr = searchPtr = ckalloc(sizeof(TagSearch));
searchPtr->expr = NULL;
/*
@@ -3513,8 +3513,8 @@ TagSearchDestroy(
{
if (searchPtr) {
TagSearchExprDestroy(searchPtr->expr);
- ckfree((char *) searchPtr->rewritebuffer);
- ckfree((char *) searchPtr);
+ ckfree(searchPtr->rewritebuffer);
+ ckfree(searchPtr);
}
}
@@ -3567,11 +3567,10 @@ TagSearchScanExpr(
if (expr->index >= expr->allocated-1) {
expr->allocated += 15;
if (expr->uids) {
- expr->uids = (Tk_Uid *) ckrealloc((char *) expr->uids,
+ expr->uids = ckrealloc(expr->uids,
expr->allocated * sizeof(Tk_Uid));
} else {
- expr->uids = (Tk_Uid *)
- ckalloc(expr->allocated * sizeof(Tk_Uid));
+ expr->uids = ckalloc(expr->allocated * sizeof(Tk_Uid));
}
}
@@ -4191,12 +4190,11 @@ DoItem(
Tk_Uid *newTagPtr;
itemPtr->tagSpace += 5;
- newTagPtr = (Tk_Uid *)
- ckalloc((unsigned) itemPtr->tagSpace * sizeof(Tk_Uid));
+ newTagPtr = ckalloc(itemPtr->tagSpace * sizeof(Tk_Uid));
memcpy((void *) newTagPtr, itemPtr->tagPtr,
itemPtr->numTags * sizeof(Tk_Uid));
if (itemPtr->tagPtr != itemPtr->staticTagSpace) {
- ckfree((char *) itemPtr->tagPtr);
+ ckfree(itemPtr->tagPtr);
}
itemPtr->tagPtr = newTagPtr;
tagPtr = &itemPtr->tagPtr[itemPtr->numTags];
@@ -5132,8 +5130,7 @@ CanvasDoEvent(
if (numObjects <= NUM_STATIC) {
objectPtr = staticObjects;
} else {
- objectPtr = (ClientData *)
- ckalloc((unsigned) numObjects * sizeof(ClientData));
+ objectPtr = ckalloc(numObjects * sizeof(ClientData));
}
#ifdef USE_OLD_TAG_SEARCH
objectPtr[0] = (ClientData) Tk_GetUid("all");
@@ -5170,7 +5167,7 @@ CanvasDoEvent(
numObjects, objectPtr);
}
if (objectPtr != staticObjects) {
- ckfree((char *) objectPtr);
+ ckfree(objectPtr);
}
}
@@ -5712,7 +5709,7 @@ TkGetStringsFromObjs(
if (objc <= 0) {
return NULL;
}
- argv = (const char **) ckalloc((objc+1) * sizeof(char *));
+ argv = ckalloc((objc+1) * sizeof(char *));
for (i = 0; i < objc; i++) {
argv[i] = Tcl_GetString(objv[i]);
}
diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c
index e2064c1..bf79366 100644
--- a/generic/tkClipboard.c
+++ b/generic/tkClipboard.c
@@ -269,12 +269,12 @@ Tk_ClipboardClear(
cbPtr = nextCbPtr) {
ckfree(cbPtr->buffer);
nextCbPtr = cbPtr->nextPtr;
- ckfree((char *) cbPtr);
+ ckfree(cbPtr);
}
nextTargetPtr = targetPtr->nextPtr;
Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom,
targetPtr->type);
- ckfree((char *) targetPtr);
+ ckfree(targetPtr);
}
dispPtr->clipTargetPtr = NULL;
@@ -360,7 +360,7 @@ Tk_ClipboardAppend(
}
}
if (targetPtr == NULL) {
- targetPtr = (TkClipboardTarget *) ckalloc(sizeof(TkClipboardTarget));
+ targetPtr = ckalloc(sizeof(TkClipboardTarget));
targetPtr->type = type;
targetPtr->format = format;
targetPtr->firstBufferPtr = targetPtr->lastBufferPtr = NULL;
@@ -380,7 +380,7 @@ Tk_ClipboardAppend(
* Append a new buffer to the buffer chain.
*/
- cbPtr = (TkClipboardBuffer *) ckalloc(sizeof(TkClipboardBuffer));
+ cbPtr = ckalloc(sizeof(TkClipboardBuffer));
cbPtr->nextPtr = NULL;
if (targetPtr->lastBufferPtr != NULL) {
targetPtr->lastBufferPtr->nextPtr = cbPtr;
@@ -390,7 +390,7 @@ Tk_ClipboardAppend(
targetPtr->lastBufferPtr = cbPtr;
cbPtr->length = strlen(buffer);
- cbPtr->buffer = (char *) ckalloc((unsigned) (cbPtr->length + 1));
+ cbPtr->buffer = ckalloc(cbPtr->length + 1);
strcpy(cbPtr->buffer, buffer);
TkSelUpdateClipboard((TkWindow *) dispPtr->clipWindow, targetPtr);
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index cf80c02..c00cb71 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -284,8 +284,7 @@ TkBindEventProc(
*/
if (winPtr->numTags > MAX_OBJS) {
- objPtr = (ClientData *)
- ckalloc((unsigned) winPtr->numTags * sizeof(ClientData));
+ objPtr = ckalloc(winPtr->numTags * sizeof(ClientData));
}
for (i = 0; i < winPtr->numTags; i++) {
p = winPtr->tagPtr[i];
@@ -319,7 +318,7 @@ TkBindEventProc(
Tk_BindEvent(winPtr->mainPtr->bindingTable, eventPtr, (Tk_Window) winPtr,
count, objPtr);
if (objPtr != objects) {
- ckfree((char *) objPtr);
+ ckfree(objPtr);
}
}
@@ -401,8 +400,7 @@ Tk_BindtagsObjCmd(
}
winPtr->numTags = length;
- winPtr->tagPtr = (ClientData *)
- ckalloc((unsigned) length * sizeof(ClientData));
+ winPtr->tagPtr = ckalloc(length * sizeof(ClientData));
for (i = 0; i < length; i++) {
p = Tcl_GetString(tags[i]);
if (p[0] == '.') {
@@ -415,7 +413,7 @@ Tk_BindtagsObjCmd(
* is one.
*/
- copy = ckalloc((unsigned) strlen(p) + 1);
+ copy = ckalloc(strlen(p) + 1);
strcpy(copy, p);
winPtr->tagPtr[i] = (ClientData) copy;
} else {
@@ -458,10 +456,10 @@ TkFreeBindingTags(
* have to be freed.
*/
- ckfree((char *) p);
+ ckfree(p);
}
}
- ckfree((char *) winPtr->tagPtr);
+ ckfree(winPtr->tagPtr);
winPtr->numTags = 0;
winPtr->tagPtr = NULL;
}
diff --git a/generic/tkColor.c b/generic/tkColor.c
index 2035ec4..f1a8680 100644
--- a/generic/tkColor.c
+++ b/generic/tkColor.c
@@ -499,7 +499,7 @@ Tk_FreeColor(
*/
if (tkColPtr->objRefCount == 0) {
- ckfree((char *) tkColPtr);
+ ckfree(tkColPtr);
}
}
@@ -571,7 +571,7 @@ FreeColorObj(
tkColPtr->objRefCount--;
if ((tkColPtr->objRefCount == 0)
&& (tkColPtr->resourceRefCount == 0)) {
- ckfree((char *) tkColPtr);
+ ckfree(tkColPtr);
}
objPtr->internalRep.twoPtrValue.ptr1 = NULL;
}
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index 8669b1b..ac5ff5d 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -191,10 +191,9 @@ Tk_CreateOptionTable(
* doesn't already exist.
*/
- hashTablePtr = (Tcl_HashTable *) Tcl_GetAssocData(interp, OPTION_HASH_KEY,
- NULL);
+ hashTablePtr = Tcl_GetAssocData(interp, OPTION_HASH_KEY, NULL);
if (hashTablePtr == NULL) {
- hashTablePtr = (Tcl_HashTable *) ckalloc(sizeof(Tcl_HashTable));
+ hashTablePtr = ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(hashTablePtr, TCL_ONE_WORD_KEYS);
Tcl_SetAssocData(interp, OPTION_HASH_KEY, DestroyOptionHashTable,
hashTablePtr);
@@ -222,8 +221,7 @@ Tk_CreateOptionTable(
for (specPtr = templatePtr; specPtr->type != TK_OPTION_END; specPtr++) {
numOptions++;
}
- tablePtr = (OptionTable *) (ckalloc(sizeof(OptionTable)
- + (numOptions * sizeof(Option))));
+ tablePtr = ckalloc(sizeof(OptionTable) + (numOptions * sizeof(Option)));
tablePtr->refCount = 1;
tablePtr->refCount2 = 1;
tablePtr->hashEntryPtr = hashEntryPtr;
@@ -363,7 +361,7 @@ Tk_DeleteOptionTable(
Tcl_DeleteHashEntry(tablePtr->hashEntryPtr);
tablePtr->refCount2--;
if (tablePtr->refCount2 <= 0) {
- ckfree((char *) tablePtr);
+ ckfree(tablePtr);
}
}
@@ -417,7 +415,7 @@ DestroyOptionHashTable(
Tk_DeleteOptionTable((Tk_OptionTable) tablePtr);
}
Tcl_DeleteHashTable(hashTablePtr);
- ckfree((char *) hashTablePtr);
+ ckfree(hashTablePtr);
}
/*
@@ -729,7 +727,7 @@ DoObjConfig(
if (internalPtr != NULL) {
if (valuePtr != NULL) {
value = Tcl_GetStringFromObj(valuePtr, &length);
- newStr = ckalloc((unsigned) (length + 1));
+ newStr = ckalloc(length + 1);
strcpy(newStr, value);
} else {
newStr = NULL;
@@ -1266,7 +1264,7 @@ FreeOptionInternalRep(
tablePtr->refCount2--;
if (tablePtr->refCount2 <= 0) {
- ckfree((char *)tablePtr);
+ ckfree(tablePtr);
}
objPtr->typePtr = NULL;
objPtr->internalRep.twoPtrValue.ptr1 = NULL;
@@ -1362,7 +1360,7 @@ Tk_SetOptions(
* more space.
*/
- newSavePtr = (Tk_SavedOptions *) ckalloc(sizeof(Tk_SavedOptions));
+ newSavePtr = ckalloc(sizeof(Tk_SavedOptions));
newSavePtr->recordPtr = recordPtr;
newSavePtr->tkwin = tkwin;
newSavePtr->numItems = 0;
@@ -1438,7 +1436,7 @@ Tk_RestoreSavedOptions(
if (savePtr->nextPtr != NULL) {
Tk_RestoreSavedOptions(savePtr->nextPtr);
- ckfree((char *) savePtr->nextPtr);
+ ckfree(savePtr->nextPtr);
savePtr->nextPtr = NULL;
}
for (i = savePtr->numItems - 1; i >= 0; i--) {
@@ -1573,7 +1571,7 @@ Tk_FreeSavedOptions(
if (savePtr->nextPtr != NULL) {
Tk_FreeSavedOptions(savePtr->nextPtr);
- ckfree((char *) savePtr->nextPtr);
+ ckfree(savePtr->nextPtr);
}
for (count = savePtr->numItems,
savedOptionPtr = &savePtr->items[savePtr->numItems-1];
diff --git a/generic/tkConsole.c b/generic/tkConsole.c
index 7f496fb..cb16ca2 100644
--- a/generic/tkConsole.c
+++ b/generic/tkConsole.c
@@ -266,13 +266,13 @@ Tk_InitConsoleChannels(
* interp for it to live in.
*/
- info = (ConsoleInfo *) ckalloc(sizeof(ConsoleInfo));
+ info = ckalloc(sizeof(ConsoleInfo));
info->consoleInterp = NULL;
info->interp = NULL;
info->refCount = 0;
if (doIn) {
- ChannelData *data = (ChannelData *) ckalloc(sizeof(ChannelData));
+ ChannelData *data = ckalloc(sizeof(ChannelData));
data->info = info;
data->info->refCount++;
@@ -289,7 +289,7 @@ Tk_InitConsoleChannels(
}
if (doOut) {
- ChannelData *data = (ChannelData *) ckalloc(sizeof(ChannelData));
+ ChannelData *data = ckalloc(sizeof(ChannelData));
data->info = info;
data->info->refCount++;
@@ -306,7 +306,7 @@ Tk_InitConsoleChannels(
}
if (doErr) {
- ChannelData *data = (ChannelData *) ckalloc(sizeof(ChannelData));
+ ChannelData *data = ckalloc(sizeof(ChannelData));
data->info = info;
data->info->refCount++;
@@ -380,11 +380,17 @@ Tk_CreateConsoleWindow(
ChannelData *data = (ChannelData *) Tcl_GetChannelInstanceData(chan);
info = data->info;
if (info->consoleInterp) {
- /* New ConsoleInfo for a new console window */
- info = (ConsoleInfo *) ckalloc(sizeof(ConsoleInfo));
+ /*
+ * New ConsoleInfo for a new console window.
+ */
+
+ info = ckalloc(sizeof(ConsoleInfo));
info->refCount = 0;
- /* Update any console channels to make use of the new console */
+ /*
+ * Update any console channels to make use of the new console.
+ */
+
if (Tcl_GetChannelType(chan = Tcl_GetStdChannel(TCL_STDIN))
== &consoleChannelType) {
data = (ChannelData *) Tcl_GetChannelInstanceData(chan);
@@ -408,7 +414,7 @@ Tk_CreateConsoleWindow(
}
}
} else {
- info = (ConsoleInfo *) ckalloc(sizeof(ConsoleInfo));
+ info = ckalloc(sizeof(ConsoleInfo));
info->refCount = 0;
}
@@ -457,7 +463,7 @@ Tk_CreateConsoleWindow(
Tk_DeleteEventHandler(mainWindow, StructureNotifyMask,
ConsoleEventProc, info);
if (--info->refCount <= 0) {
- ckfree((char *) info);
+ ckfree(info);
}
}
goto error;
@@ -585,10 +591,10 @@ ConsoleClose(
* Assuming the Tcl_Interp * fields must already be NULL.
*/
- ckfree((char *) info);
+ ckfree(info);
}
}
- ckfree((char *) data);
+ ckfree(data);
return 0;
}
@@ -866,7 +872,7 @@ InterpDeleteProc(
info->consoleInterp = NULL;
}
if (--info->refCount <= 0) {
- ckfree((char *) info);
+ ckfree(info);
}
}
@@ -897,7 +903,7 @@ ConsoleDeleteProc(
Tcl_DeleteInterp(info->consoleInterp);
}
if (--info->refCount <= 0) {
- ckfree((char *) info);
+ ckfree(info);
}
}
@@ -934,7 +940,7 @@ ConsoleEventProc(
}
if (--info->refCount <= 0) {
- ckfree((char *) info);
+ ckfree(info);
}
}
}
diff --git a/generic/tkCursor.c b/generic/tkCursor.c
index 5ca7b07..59e3477 100644
--- a/generic/tkCursor.c
+++ b/generic/tkCursor.c
@@ -482,7 +482,7 @@ FreeCursor(
}
TkpFreeCursor(cursorPtr);
if (cursorPtr->objRefCount == 0) {
- ckfree((char *) cursorPtr);
+ ckfree(cursorPtr);
}
}
@@ -591,7 +591,7 @@ FreeCursorObj(
cursorPtr->objRefCount--;
if ((cursorPtr->objRefCount == 0)
&& (cursorPtr->resourceRefCount == 0)) {
- ckfree((char *) cursorPtr);
+ ckfree(cursorPtr);
}
objPtr->internalRep.twoPtrValue.ptr1 = NULL;
}
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index 93f14a2..1db3888 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -509,7 +509,7 @@ Tk_EntryObjCmd(
* initialized as memset covers the rest.
*/
- entryPtr = (Entry *) ckalloc(sizeof(Entry));
+ entryPtr = ckalloc(sizeof(Entry));
memset(entryPtr, 0, sizeof(Entry));
entryPtr->tkwin = tkwin;
@@ -1016,7 +1016,7 @@ DestroyEntry(
* Tk_FreeOptions handle all the standard option-related stuff.
*/
- ckfree((char *)entryPtr->string);
+ ckfree(entryPtr->string);
if (entryPtr->textVarName != NULL) {
Tcl_UntraceVar(entryPtr->interp, entryPtr->textVarName,
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
@@ -1031,7 +1031,7 @@ DestroyEntry(
}
Tcl_DeleteTimerHandler(entryPtr->insertBlinkHandler);
if (entryPtr->displayString != entryPtr->string) {
- ckfree((char *)entryPtr->displayString);
+ ckfree(entryPtr->displayString);
}
if (entryPtr->type == TK_SPINBOX) {
Spinbox *sbPtr = (Spinbox *) entryPtr;
@@ -1050,7 +1050,7 @@ DestroyEntry(
Tcl_Release(entryPtr->tkwin);
entryPtr->tkwin = NULL;
- ckfree((char *) entryPtr);
+ ckfree(entryPtr);
}
/*
@@ -1874,7 +1874,7 @@ EntryComputeGeometry(
char *p;
if (entryPtr->displayString != entryPtr->string) {
- ckfree((char *)entryPtr->displayString);
+ ckfree(entryPtr->displayString);
entryPtr->displayString = entryPtr->string;
entryPtr->numDisplayBytes = entryPtr->numBytes;
}
@@ -1900,7 +1900,7 @@ EntryComputeGeometry(
size = Tcl_UniCharToUtf(ch, buf);
entryPtr->numDisplayBytes = entryPtr->numChars * size;
- p = (char *) ckalloc((unsigned) (entryPtr->numDisplayBytes + 1));
+ p = ckalloc(entryPtr->numDisplayBytes + 1);
entryPtr->displayString = p;
for (i = entryPtr->numChars; --i >= 0; ) {
@@ -2017,7 +2017,7 @@ InsertChars(
}
newByteCount = entryPtr->numBytes + byteCount + 1;
- newStr = ckalloc((unsigned) newByteCount);
+ newStr = ckalloc(newByteCount);
memcpy(newStr, string, byteIndex);
strcpy(newStr + byteIndex, value);
strcpy(newStr + byteIndex + byteCount, string + byteIndex);
@@ -2030,7 +2030,7 @@ InsertChars(
return;
}
- ckfree((char *)string);
+ ckfree(string);
entryPtr->string = newStr;
/*
@@ -2117,11 +2117,11 @@ DeleteChars(
byteCount = Tcl_UtfAtIndex(string + byteIndex, count) - (string+byteIndex);
newByteCount = entryPtr->numBytes + 1 - byteCount;
- newStr = ckalloc((unsigned) newByteCount);
+ newStr = ckalloc(newByteCount);
memcpy(newStr, string, (size_t) byteIndex);
strcpy(newStr + byteIndex, string + byteIndex + byteCount);
- toDelete = ckalloc((unsigned) (byteCount + 1));
+ toDelete = ckalloc(byteCount + 1);
memcpy(toDelete, string + byteIndex, (size_t) byteCount);
toDelete[byteCount] = '\0';
@@ -2135,7 +2135,7 @@ DeleteChars(
}
ckfree(toDelete);
- ckfree((char *)entryPtr->string);
+ ckfree(entryPtr->string);
entryPtr->string = newStr;
entryPtr->numChars -= count;
entryPtr->numBytes -= byteCount;
@@ -2293,7 +2293,7 @@ EntrySetValue(
* during validation
*/
- char *tmp = (char *) ckalloc((unsigned) (valueLen + 1));
+ char *tmp = ckalloc(valueLen + 1);
strcpy(tmp, value);
value = tmp;
@@ -2311,18 +2311,18 @@ EntrySetValue(
if (entryPtr->flags & VALIDATE_ABORT) {
entryPtr->flags &= ~VALIDATE_ABORT;
- ckfree((char *)value);
+ ckfree(value);
return;
}
}
oldSource = entryPtr->string;
- ckfree((char *)entryPtr->string);
+ ckfree(entryPtr->string);
if (malloced) {
entryPtr->string = value;
} else {
- char *tmp = ckalloc((unsigned) (valueLen + 1));
+ char *tmp = ckalloc(valueLen + 1);
strcpy(tmp, value);
entryPtr->string = tmp;
@@ -3526,7 +3526,7 @@ Tk_SpinboxObjCmd(
* initialized as memset covers the rest.
*/
- sbPtr = (Spinbox *) ckalloc(sizeof(Spinbox));
+ sbPtr = ckalloc(sizeof(Spinbox));
entryPtr = (Entry *) sbPtr;
memset(sbPtr, 0, sizeof(Spinbox));
diff --git a/generic/tkError.c b/generic/tkError.c
index 426c457..6facc53 100644
--- a/generic/tkError.c
+++ b/generic/tkError.c
@@ -109,7 +109,7 @@ Tk_CreateErrorHandler(
* Create the handler record.
*/
- errorPtr = (TkErrorHandler *) ckalloc(sizeof(TkErrorHandler));
+ errorPtr = ckalloc(sizeof(TkErrorHandler));
errorPtr->dispPtr = dispPtr;
errorPtr->firstRequest = NextRequest(display);
errorPtr->lastRequest = (unsigned) -1;
@@ -184,7 +184,7 @@ Tk_DeleteErrorHandler(
} else {
prevPtr->nextPtr = nextPtr;
}
- ckfree((char *) errorPtr);
+ ckfree(errorPtr);
continue;
}
prevPtr = errorPtr;
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index d22116a..24880a3 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.c
@@ -664,7 +664,7 @@ InvokeClientMessageHandlers(
if (tmpPtr == NULL) {
tsdPtr->lastCmPtr = prevPtr;
}
- (void) ckfree((char *) curPtr);
+ ckfree(curPtr);
curPtr = tmpPtr;
continue;
}
@@ -726,7 +726,7 @@ InvokeGenericHandlers(
if (tmpPtr == NULL) {
tsdPtr->lastGenericPtr = prevPtr;
}
- (void) ckfree((char *) curPtr);
+ ckfree(curPtr);
curPtr = tmpPtr;
continue;
}
@@ -790,7 +790,7 @@ Tk_CreateEventHandler(
* No event handlers defined at all, so must create.
*/
- handlerPtr = (TkEventHandler *) ckalloc(sizeof(TkEventHandler));
+ handlerPtr = ckalloc(sizeof(TkEventHandler));
winPtr->handlerList = handlerPtr;
} else {
int found = 0;
@@ -821,8 +821,7 @@ Tk_CreateEventHandler(
* No event handler matched, so create a new one.
*/
- handlerPtr->nextPtr = (TkEventHandler *)
- ckalloc(sizeof(TkEventHandler));
+ handlerPtr->nextPtr = ckalloc(sizeof(TkEventHandler));
handlerPtr = handlerPtr->nextPtr;
}
@@ -908,7 +907,7 @@ Tk_DeleteEventHandler(
} else {
prevPtr->nextPtr = handlerPtr->nextPtr;
}
- ckfree((char *) handlerPtr);
+ ckfree(handlerPtr);
/*
* No need to call XSelectInput: Tk always selects on all events for all
@@ -944,7 +943,7 @@ Tk_CreateGenericHandler(
ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- handlerPtr = (GenericHandler *) ckalloc(sizeof(GenericHandler));
+ handlerPtr = ckalloc(sizeof(GenericHandler));
handlerPtr->proc = proc;
handlerPtr->clientData = clientData;
@@ -1023,7 +1022,7 @@ Tk_CreateClientMessageHandler(
* with an extra clientData field we'll never use.
*/
- handlerPtr = (GenericHandler *) ckalloc(sizeof(GenericHandler));
+ handlerPtr = ckalloc(sizeof(GenericHandler));
handlerPtr->proc = (Tk_GenericProc *) proc;
handlerPtr->clientData = NULL; /* never used */
@@ -1434,7 +1433,7 @@ TkEventDeadWindow(
ipPtr->winPtr = None;
}
}
- ckfree((char *) handlerPtr);
+ ckfree(handlerPtr);
}
}
@@ -1609,7 +1608,7 @@ Tk_QueueWindowEvent(
*/
if (!(dispPtr->flags & TK_DISPLAY_COLLAPSE_MOTION_EVENTS)) {
- wevPtr = (TkWindowEvent *) ckalloc(sizeof(TkWindowEvent));
+ wevPtr = ckalloc(sizeof(TkWindowEvent));
wevPtr->header.proc = WindowEventProc;
wevPtr->event = *eventPtr;
Tcl_QueueEvent(&wevPtr->header, position);
@@ -1641,7 +1640,7 @@ Tk_QueueWindowEvent(
}
}
- wevPtr = (TkWindowEvent *) ckalloc(sizeof(TkWindowEvent));
+ wevPtr = ckalloc(sizeof(TkWindowEvent));
wevPtr->header.proc = WindowEventProc;
wevPtr->event = *eventPtr;
if ((eventPtr->type == MotionNotify) && (position == TCL_QUEUE_TAIL)) {
@@ -1862,7 +1861,7 @@ TkCreateExitHandler(
{
ExitHandler *exitPtr;
- exitPtr = (ExitHandler *) ckalloc(sizeof(ExitHandler));
+ exitPtr = ckalloc(sizeof(ExitHandler));
exitPtr->proc = proc;
exitPtr->clientData = clientData;
Tcl_MutexLock(&exitMutex);
@@ -1927,7 +1926,7 @@ TkDeleteExitHandler(
} else {
prevPtr->nextPtr = exitPtr->nextPtr;
}
- ckfree((char *) exitPtr);
+ ckfree(exitPtr);
break;
}
}
@@ -1961,7 +1960,7 @@ TkCreateThreadExitHandler(
ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- exitPtr = (ExitHandler *) ckalloc(sizeof(ExitHandler));
+ exitPtr = ckalloc(sizeof(ExitHandler));
exitPtr->proc = proc;
exitPtr->clientData = clientData;
@@ -2011,7 +2010,7 @@ TkDeleteThreadExitHandler(
} else {
prevPtr->nextPtr = exitPtr->nextPtr;
}
- ckfree((char *) exitPtr);
+ ckfree(exitPtr);
return;
}
}
@@ -2055,7 +2054,7 @@ TkFinalize(
firstExitPtr = exitPtr->nextPtr;
Tcl_MutexUnlock(&exitMutex);
exitPtr->proc(exitPtr->clientData);
- ckfree((char *) exitPtr);
+ ckfree(exitPtr);
Tcl_MutexLock(&exitMutex);
}
firstExitPtr = NULL;
@@ -2105,7 +2104,7 @@ TkFinalizeThread(
tsdPtr->firstExitPtr = exitPtr->nextPtr;
exitPtr->proc(exitPtr->clientData);
- ckfree((char *) exitPtr);
+ ckfree(exitPtr);
}
}
}
diff --git a/generic/tkFileFilter.c b/generic/tkFileFilter.c
index b8e8101..170b0b7 100644
--- a/generic/tkFileFilter.c
+++ b/generic/tkFileFilter.c
@@ -303,7 +303,7 @@ AddClause(
* Add the clause into the list of clauses
*/
- clausePtr = (FileFilterClause *) ckalloc(sizeof(FileFilterClause));
+ clausePtr = ckalloc(sizeof(FileFilterClause));
clausePtr->patterns = NULL;
clausePtr->patternsTail = NULL;
clausePtr->macTypes = NULL;
@@ -319,8 +319,7 @@ AddClause(
if (globCount > 0 && globList != NULL) {
for (i=0; i<globCount; i++) {
- GlobPattern *globPtr = (GlobPattern *)
- ckalloc(sizeof(GlobPattern));
+ GlobPattern *globPtr = ckalloc(sizeof(GlobPattern));
int len;
const char *str = Tcl_GetStringFromObj(globList[i], &len);
@@ -330,12 +329,12 @@ AddClause(
* Prepend a "*" to patterns that do not have a leading "*"
*/
- globPtr->pattern = ckalloc((unsigned) len+1);
+ globPtr->pattern = ckalloc(len + 1);
globPtr->pattern[0] = '*';
strcpy(globPtr->pattern+1, str);
} else if (isWindows) {
if (strcmp(str, "*") == 0) {
- globPtr->pattern = ckalloc(4 * sizeof(char));
+ globPtr->pattern = ckalloc(4);
strcpy(globPtr->pattern, "*.*");
} else if (strcmp(str, "") == 0) {
/*
@@ -344,14 +343,14 @@ AddClause(
* TODO: "*." actually matches with all files on Win95
*/
- globPtr->pattern = ckalloc(3 * sizeof(char));
+ globPtr->pattern = ckalloc(3);
strcpy(globPtr->pattern, "*.");
} else {
- globPtr->pattern = ckalloc((unsigned) len);
+ globPtr->pattern = ckalloc(len);
strcpy(globPtr->pattern, str);
}
} else {
- globPtr->pattern = ckalloc((unsigned) len);
+ globPtr->pattern = ckalloc(len);
strcpy(globPtr->pattern, str);
}
@@ -375,7 +374,7 @@ AddClause(
for (i=0; i<ostypeCount; i++) {
Tcl_DString osTypeDS;
int len;
- MacFileType *mfPtr = (MacFileType *) ckalloc(sizeof(MacFileType));
+ MacFileType *mfPtr = ckalloc(sizeof(MacFileType));
const char *strType = Tcl_GetStringFromObj(ostypeList[i], &len);
char *string;
@@ -444,11 +443,11 @@ GetFilter(
}
}
- filterPtr = (FileFilter *) ckalloc(sizeof(FileFilter));
+ filterPtr = ckalloc(sizeof(FileFilter));
filterPtr->clauses = NULL;
filterPtr->clausesTail = NULL;
len = strlen(name) + 1;
- filterPtr->name = ckalloc((unsigned) len);
+ filterPtr->name = ckalloc(len);
memcpy(filterPtr->name, name, len);
if (flistPtr->filters == NULL) {
diff --git a/generic/tkFocus.c b/generic/tkFocus.c
index 622867c..17482aa 100644
--- a/generic/tkFocus.c
+++ b/generic/tkFocus.c
@@ -418,7 +418,7 @@ TkFocusFilterEvent(
}
}
if (tlFocusPtr == NULL) {
- tlFocusPtr = (ToplevelFocusInfo *) ckalloc(sizeof(ToplevelFocusInfo));
+ tlFocusPtr = ckalloc(sizeof(ToplevelFocusInfo));
tlFocusPtr->topLevelPtr = tlFocusPtr->focusWinPtr = winPtr;
tlFocusPtr->nextPtr = winPtr->mainPtr->tlFocusPtr;
winPtr->mainPtr->tlFocusPtr = tlFocusPtr;
@@ -611,7 +611,7 @@ TkSetFocusWin(
}
}
if (tlFocusPtr == NULL) {
- tlFocusPtr = (ToplevelFocusInfo *) ckalloc(sizeof(ToplevelFocusInfo));
+ tlFocusPtr = ckalloc(sizeof(ToplevelFocusInfo));
tlFocusPtr->topLevelPtr = topLevelPtr;
tlFocusPtr->nextPtr = winPtr->mainPtr->tlFocusPtr;
winPtr->mainPtr->tlFocusPtr = tlFocusPtr;
@@ -837,7 +837,7 @@ TkFocusDeadWindow(
} else {
prevPtr->nextPtr = tlFocusPtr->nextPtr;
}
- ckfree((char *) tlFocusPtr);
+ ckfree(tlFocusPtr);
break;
} else if (winPtr == tlFocusPtr->focusWinPtr) {
/*
@@ -997,7 +997,7 @@ FindDisplayFocusInfo(
* The record doesn't exist yet. Make a new one.
*/
- displayFocusPtr = (DisplayFocusInfo *) ckalloc(sizeof(DisplayFocusInfo));
+ displayFocusPtr = ckalloc(sizeof(DisplayFocusInfo));
displayFocusPtr->dispPtr = dispPtr;
displayFocusPtr->focusWinPtr = NULL;
displayFocusPtr->focusOnMapPtr = NULL;
@@ -1033,13 +1033,13 @@ TkFocusFree(
DisplayFocusInfo *displayFocusPtr = mainPtr->displayFocusPtr;
mainPtr->displayFocusPtr = mainPtr->displayFocusPtr->nextPtr;
- ckfree((char *) displayFocusPtr);
+ ckfree(displayFocusPtr);
}
while (mainPtr->tlFocusPtr != NULL) {
ToplevelFocusInfo *tlFocusPtr = mainPtr->tlFocusPtr;
mainPtr->tlFocusPtr = mainPtr->tlFocusPtr->nextPtr;
- ckfree((char *) tlFocusPtr);
+ ckfree(tlFocusPtr);
}
}
@@ -1126,8 +1126,7 @@ TkFocusSplit(
* Move focus to new toplevel.
*/
- ToplevelFocusInfo *newTlFocusPtr = (ToplevelFocusInfo *)
- ckalloc(sizeof(ToplevelFocusInfo));
+ ToplevelFocusInfo *newTlFocusPtr = ckalloc(sizeof(ToplevelFocusInfo));
newTlFocusPtr->topLevelPtr = winPtr;
newTlFocusPtr->focusWinPtr = tlFocusPtr->focusWinPtr;
@@ -1176,7 +1175,7 @@ TkFocusJoin(
&& winPtr->mainPtr->tlFocusPtr->topLevelPtr == winPtr) {
tmpPtr = winPtr->mainPtr->tlFocusPtr;
winPtr->mainPtr->tlFocusPtr = tmpPtr->nextPtr;
- ckfree((char *)tmpPtr);
+ ckfree(tmpPtr);
} else if (winPtr && winPtr->mainPtr) {
for (tlFocusPtr = winPtr->mainPtr->tlFocusPtr; tlFocusPtr != NULL;
tlFocusPtr = tlFocusPtr->nextPtr) {
@@ -1184,7 +1183,7 @@ TkFocusJoin(
tlFocusPtr->nextPtr->topLevelPtr == winPtr) {
tmpPtr = tlFocusPtr->nextPtr;
tlFocusPtr->nextPtr = tmpPtr->nextPtr;
- ckfree((char *)tmpPtr);
+ ckfree(tmpPtr);
break;
}
}
diff --git a/generic/tkFont.c b/generic/tkFont.c
index b768bbd..06bc0f1 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -379,7 +379,7 @@ void
TkFontPkgInit(
TkMainInfo *mainPtr) /* The application being created. */
{
- TkFontInfo *fiPtr = (TkFontInfo *) ckalloc(sizeof(TkFontInfo));
+ TkFontInfo *fiPtr = ckalloc(sizeof(TkFontInfo));
Tcl_InitHashTable(&fiPtr->fontCache, TCL_STRING_KEYS);
Tcl_InitHashTable(&fiPtr->namedTable, TCL_STRING_KEYS);
@@ -444,7 +444,7 @@ TkFontPkgFree(
if (fiPtr->updatePending != 0) {
Tcl_CancelIdleCall(TheWorldHasChanged, fiPtr);
}
- ckfree((char *) fiPtr);
+ ckfree(fiPtr);
}
/*
@@ -969,7 +969,7 @@ TkCreateNamedFont(
return TCL_OK;
}
- nfPtr = (NamedFont *) ckalloc(sizeof(NamedFont));
+ nfPtr = ckalloc(sizeof(NamedFont));
nfPtr->deletePending = 0;
Tcl_SetHashValue(namedHashPtr, nfPtr);
nfPtr->fa = *faPtr;
@@ -1012,7 +1012,7 @@ TkDeleteNamedFont(
nfPtr->deletePending = 1;
} else {
Tcl_DeleteHashEntry(namedHashPtr);
- ckfree((char *) nfPtr);
+ ckfree(nfPtr);
}
return TCL_OK;
}
@@ -1425,7 +1425,7 @@ Tk_FreeFont(
nfPtr->refCount--;
if ((nfPtr->refCount == 0) && (nfPtr->deletePending != 0)) {
Tcl_DeleteHashEntry(fontPtr->namedHashPtr);
- ckfree((char *) nfPtr);
+ ckfree(nfPtr);
}
}
@@ -1445,7 +1445,7 @@ Tk_FreeFont(
TkpDeleteFont(fontPtr);
if (fontPtr->objRefCount == 0) {
- ckfree((char *) fontPtr);
+ ckfree(fontPtr);
}
}
@@ -1512,7 +1512,7 @@ FreeFontObj(
if (fontPtr != NULL) {
fontPtr->objRefCount--;
if ((fontPtr->resourceRefCount == 0) && (fontPtr->objRefCount == 0)) {
- ckfree((char *) fontPtr);
+ ckfree(fontPtr);
objPtr->internalRep.twoPtrValue.ptr1 = NULL;
}
}
@@ -1974,8 +1974,8 @@ Tk_ComputeTextLayout(
maxChunks = 1;
- layoutPtr = (TextLayout *)
- ckalloc(sizeof(TextLayout) + (maxChunks-1) * sizeof(LayoutChunk));
+ layoutPtr = ckalloc(sizeof(TextLayout)
+ + (maxChunks-1) * sizeof(LayoutChunk));
layoutPtr->tkfont = tkfont;
layoutPtr->string = string;
layoutPtr->numChunks = 0;
@@ -2231,7 +2231,7 @@ Tk_FreeTextLayout(
TextLayout *layoutPtr = (TextLayout *) textLayout;
if (layoutPtr != NULL) {
- ckfree((char *) layoutPtr);
+ ckfree(layoutPtr);
}
}
@@ -3745,7 +3745,7 @@ NewChunk(
if (layoutPtr->numChunks == maxChunks) {
maxChunks *= 2;
s = sizeof(TextLayout) + ((maxChunks - 1) * sizeof(LayoutChunk));
- layoutPtr = (TextLayout *) ckrealloc((char *) layoutPtr, s);
+ layoutPtr = ckrealloc(layoutPtr, s);
*layoutPtrPtr = layoutPtr;
*maxPtr = maxChunks;
diff --git a/generic/tkFrame.c b/generic/tkFrame.c
index eaccd58..e64ee29 100644
--- a/generic/tkFrame.c
+++ b/generic/tkFrame.c
@@ -429,7 +429,7 @@ TkCreateFrame(
* application. */
{
int result, i;
- Tcl_Obj **objv = (Tcl_Obj **) ckalloc((argc+1) * sizeof(Tcl_Obj **));
+ Tcl_Obj **objv = ckalloc((argc+1) * sizeof(Tcl_Obj **));
for (i=0; i<argc; i++) {
objv[i] = Tcl_NewStringObj(argv[i], -1);
@@ -441,7 +441,7 @@ TkCreateFrame(
for (i=0; i<argc; i++) {
Tcl_DecrRefCount(objv[i]);
}
- ckfree((char *) objv);
+ ckfree(objv);
return result;
}
@@ -622,10 +622,10 @@ CreateFrame(
*/
if (type == TYPE_LABELFRAME) {
- framePtr = (Frame *) ckalloc(sizeof(Labelframe));
+ framePtr = ckalloc(sizeof(Labelframe));
memset(framePtr, 0, sizeof(Labelframe));
} else {
- framePtr = (Frame *) ckalloc(sizeof(Frame));
+ framePtr = ckalloc(sizeof(Frame));
memset(framePtr, 0, sizeof(Frame));
}
framePtr->tkwin = newWin;
@@ -846,7 +846,7 @@ DestroyFrame(
if (framePtr->colormap != None) {
Tk_FreeColormap(framePtr->display, framePtr->colormap);
}
- ckfree((char *) framePtr);
+ ckfree(framePtr);
}
/*
diff --git a/generic/tkGC.c b/generic/tkGC.c
index 07f6014..0fa55a3 100644
--- a/generic/tkGC.c
+++ b/generic/tkGC.c
@@ -230,7 +230,7 @@ Tk_GetGC(
* and add a new structure to the database.
*/
- gcPtr = (TkGC *) ckalloc(sizeof(TkGC));
+ gcPtr = ckalloc(sizeof(TkGC));
/*
* Find or make a drawable to use to specify the screen and depth of the
@@ -320,7 +320,7 @@ Tk_FreeGC(
XFreeGC(gcPtr->display, gcPtr->gc);
Tcl_DeleteHashEntry(gcPtr->valueHashPtr);
Tcl_DeleteHashEntry(idHashPtr);
- ckfree((char *) gcPtr);
+ ckfree(gcPtr);
}
}
@@ -362,7 +362,7 @@ TkGCCleanup(
XFreeGC(gcPtr->display, gcPtr->gc);
Tcl_DeleteHashEntry(gcPtr->valueHashPtr);
Tcl_DeleteHashEntry(entryPtr);
- ckfree((char *) gcPtr);
+ ckfree(gcPtr);
}
Tcl_DeleteHashTable(&dispPtr->gcValueTable);
Tcl_DeleteHashTable(&dispPtr->gcIdTable);
diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c
index 2a9e2f4..bcfdcf5 100644
--- a/generic/tkGeometry.c
+++ b/generic/tkGeometry.c
@@ -462,7 +462,7 @@ Tk_MaintainGeometry(
if (!isNew) {
masterPtr = Tcl_GetHashValue(hPtr);
} else {
- masterPtr = (MaintainMaster *) ckalloc(sizeof(MaintainMaster));
+ masterPtr = ckalloc(sizeof(MaintainMaster));
masterPtr->ancestor = master;
masterPtr->checkScheduled = 0;
masterPtr->slavePtr = NULL;
@@ -480,7 +480,7 @@ Tk_MaintainGeometry(
goto gotSlave;
}
}
- slavePtr = (MaintainSlave *) ckalloc(sizeof(MaintainSlave));
+ slavePtr = ckalloc(sizeof(MaintainSlave));
slavePtr->slave = slave;
slavePtr->master = master;
slavePtr->nextPtr = masterPtr->slavePtr;
@@ -608,7 +608,7 @@ Tk_UnmaintainGeometry(
}
Tk_DeleteEventHandler(slavePtr->slave, StructureNotifyMask,
MaintainSlaveProc, slavePtr);
- ckfree((char *) slavePtr);
+ ckfree(slavePtr);
if (masterPtr->slavePtr == NULL) {
if (masterPtr->ancestor != NULL) {
for (ancestor = master; ; ancestor = Tk_Parent(ancestor)) {
@@ -623,7 +623,7 @@ Tk_UnmaintainGeometry(
Tcl_CancelIdleCall(MaintainCheckProc, masterPtr);
}
Tcl_DeleteHashEntry(hPtr);
- ckfree((char *) masterPtr);
+ ckfree(masterPtr);
}
}
diff --git a/generic/tkGrab.c b/generic/tkGrab.c
index 8056b2c..a72fb0c 100644
--- a/generic/tkGrab.c
+++ b/generic/tkGrab.c
@@ -1338,7 +1338,7 @@ QueueGrabWindowChange(
{
NewGrabWinEvent *grabEvPtr;
- grabEvPtr = (NewGrabWinEvent *) ckalloc(sizeof(NewGrabWinEvent));
+ grabEvPtr = ckalloc(sizeof(NewGrabWinEvent));
grabEvPtr->header.proc = GrabWinEventProc;
grabEvPtr->dispPtr = dispPtr;
if (grabWinPtr == NULL) {
diff --git a/generic/tkGrid.c b/generic/tkGrid.c
index b5a439a..5014dad 100644
--- a/generic/tkGrid.c
+++ b/generic/tkGrid.c
@@ -1926,8 +1926,7 @@ ResolveConstraints(
gridCount = MAX(constraintCount, slotCount);
if (gridCount >= TYPICAL_SIZE) {
- layoutPtr = (GridLayout *)
- ckalloc(sizeof(GridLayout) * (1+gridCount));
+ layoutPtr = ckalloc(sizeof(GridLayout) * (1+gridCount));
} else {
layoutPtr = layoutData;
}
@@ -2049,12 +2048,12 @@ ResolveConstraints(
* sizeof(UniformGroup);
size_t newSize = (uniformGroupsAlloced + UNIFORM_PREALLOC)
* sizeof(UniformGroup);
- UniformGroup *newUG = (UniformGroup *) ckalloc(newSize);
+ UniformGroup *newUG = ckalloc(newSize);
UniformGroup *oldUG = uniformGroupPtr;
memcpy(newUG, oldUG, oldSize);
if (oldUG != uniformPre) {
- ckfree((char *) oldUG);
+ ckfree(oldUG);
}
uniformGroupPtr = newUG;
uniformGroupsAlloced += UNIFORM_PREALLOC;
@@ -2094,7 +2093,7 @@ ResolveConstraints(
}
if (uniformGroupPtr != uniformPre) {
- ckfree((char *) uniformGroupPtr);
+ ckfree(uniformGroupPtr);
}
/*
@@ -2364,7 +2363,7 @@ ResolveConstraints(
--layoutPtr;
if (layoutPtr != layoutData) {
- ckfree((char *) layoutPtr);
+ ckfree(layoutPtr);
}
return requiredSize;
}
@@ -2412,7 +2411,7 @@ GetGrid(
if (!isNew) {
return Tcl_GetHashValue(hPtr);
}
- gridPtr = (Gridder *) ckalloc(sizeof(Gridder));
+ gridPtr = ckalloc(sizeof(Gridder));
gridPtr->tkwin = tkwin;
gridPtr->masterPtr = NULL;
gridPtr->masterDataPtr = NULL;
@@ -2619,14 +2618,14 @@ CheckSlotData(
int newNumSlot = slot + PREALLOC;
size_t oldSize = numSlot * sizeof(SlotInfo);
size_t newSize = newNumSlot * sizeof(SlotInfo);
- SlotInfo *newSI = (SlotInfo *) ckalloc(newSize);
+ SlotInfo *newSI = ckalloc(newSize);
SlotInfo *oldSI = (slotType == ROW)
? masterPtr->masterDataPtr->rowPtr
: masterPtr->masterDataPtr->columnPtr;
memcpy(newSI, oldSI, oldSize);
memset(newSI+numSlot, 0, newSize - oldSize);
- ckfree((char *) oldSI);
+ ckfree(oldSI);
if (slotType == ROW) {
masterPtr->masterDataPtr->rowPtr = newSI;
masterPtr->masterDataPtr->rowSpace = newNumSlot;
@@ -2669,17 +2668,17 @@ InitMasterData(
Gridder *masterPtr)
{
if (masterPtr->masterDataPtr == NULL) {
- GridMaster *gridPtr = masterPtr->masterDataPtr = (GridMaster *)
+ GridMaster *gridPtr = masterPtr->masterDataPtr =
ckalloc(sizeof(GridMaster));
size_t size = sizeof(SlotInfo) * TYPICAL_SIZE;
gridPtr->columnEnd = 0;
gridPtr->columnMax = 0;
- gridPtr->columnPtr = (SlotInfo *) ckalloc(size);
+ gridPtr->columnPtr = ckalloc(size);
gridPtr->columnSpace = TYPICAL_SIZE;
gridPtr->rowEnd = 0;
gridPtr->rowMax = 0;
- gridPtr->rowPtr = (SlotInfo *) ckalloc(size);
+ gridPtr->rowPtr = ckalloc(size);
gridPtr->rowSpace = TYPICAL_SIZE;
gridPtr->startX = 0;
gridPtr->startY = 0;
@@ -2781,14 +2780,14 @@ DestroyGrid(
if (gridPtr->masterDataPtr != NULL) {
if (gridPtr->masterDataPtr->rowPtr != NULL) {
- ckfree((char *) gridPtr->masterDataPtr -> rowPtr);
+ ckfree(gridPtr->masterDataPtr -> rowPtr);
}
if (gridPtr->masterDataPtr->columnPtr != NULL) {
- ckfree((char *) gridPtr->masterDataPtr -> columnPtr);
+ ckfree(gridPtr->masterDataPtr -> columnPtr);
}
- ckfree((char *) gridPtr->masterDataPtr);
+ ckfree(gridPtr->masterDataPtr);
}
- ckfree((char *) gridPtr);
+ ckfree(gridPtr);
}
/*
diff --git a/generic/tkImage.c b/generic/tkImage.c
index ca818a3..31a2fa3 100644
--- a/generic/tkImage.c
+++ b/generic/tkImage.c
@@ -115,12 +115,12 @@ ImageTypeThreadExitProc(
while (tsdPtr->oldImageTypeList != NULL) {
freePtr = tsdPtr->oldImageTypeList;
tsdPtr->oldImageTypeList = tsdPtr->oldImageTypeList->nextPtr;
- ckfree((char *) freePtr);
+ ckfree(freePtr);
}
while (tsdPtr->imageTypeList != NULL) {
freePtr = tsdPtr->imageTypeList;
tsdPtr->imageTypeList = tsdPtr->imageTypeList->nextPtr;
- ckfree((char *) freePtr);
+ ckfree(freePtr);
}
}
@@ -158,7 +158,7 @@ Tk_CreateOldImageType(
tsdPtr->initialized = 1;
Tcl_CreateThreadExitHandler(ImageTypeThreadExitProc, NULL);
}
- copyPtr = (Tk_ImageType *) ckalloc(sizeof(Tk_ImageType));
+ copyPtr = ckalloc(sizeof(Tk_ImageType));
*copyPtr = *typePtr;
copyPtr->nextPtr = tsdPtr->oldImageTypeList;
tsdPtr->oldImageTypeList = copyPtr;
@@ -179,7 +179,7 @@ Tk_CreateImageType(
tsdPtr->initialized = 1;
Tcl_CreateThreadExitHandler(ImageTypeThreadExitProc, NULL);
}
- copyPtr = (Tk_ImageType *) ckalloc(sizeof(Tk_ImageType));
+ copyPtr = ckalloc(sizeof(Tk_ImageType));
*copyPtr = *typePtr;
copyPtr->nextPtr = tsdPtr->imageTypeList;
tsdPtr->imageTypeList = copyPtr;
@@ -318,7 +318,7 @@ Tk_ImageObjCmd(
hPtr = Tcl_CreateHashEntry(&winPtr->mainPtr->imageTable, name, &isNew);
if (isNew) {
- masterPtr = (ImageMaster *) ckalloc(sizeof(ImageMaster));
+ masterPtr = ckalloc(sizeof(ImageMaster));
masterPtr->typePtr = NULL;
masterPtr->masterData = NULL;
masterPtr->width = masterPtr->height = 1;
@@ -363,7 +363,7 @@ Tk_ImageObjCmd(
if (oldimage) {
int i;
- args = (Tcl_Obj **) ckalloc((objc+1) * sizeof(char *));
+ args = ckalloc((objc+1) * sizeof(char *));
for (i = 0; i < objc; i++) {
args[i] = (Tcl_Obj *) Tcl_GetString(objv[i]);
}
@@ -375,13 +375,13 @@ Tk_ImageObjCmd(
EventuallyDeleteImage(masterPtr, 0);
Tcl_Release(masterPtr);
if (oldimage) {
- ckfree((char *) args);
+ ckfree(args);
}
return TCL_ERROR;
}
Tcl_Release(masterPtr);
if (oldimage) {
- ckfree((char *) args);
+ ckfree(args);
}
masterPtr->typePtr = typePtr;
for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
@@ -618,7 +618,7 @@ Tk_GetImage(
if (masterPtr->deleted) {
goto noSuchImage;
}
- imagePtr = (Image *) ckalloc(sizeof(Image));
+ imagePtr = ckalloc(sizeof(Image));
imagePtr->tkwin = tkwin;
imagePtr->display = Tk_Display(tkwin);
imagePtr->masterPtr = masterPtr;
@@ -681,7 +681,7 @@ Tk_FreeImage(
}
prevPtr->nextPtr = imagePtr->nextPtr;
}
- ckfree((char *) imagePtr);
+ ckfree(imagePtr);
/*
* If there are no more instances left for the master, and if the master
@@ -693,7 +693,7 @@ Tk_FreeImage(
Tcl_DeleteHashEntry(masterPtr->hPtr);
}
Tcl_Release(masterPtr->winPtr);
- ckfree((char *) masterPtr);
+ ckfree(masterPtr);
}
}
@@ -970,7 +970,7 @@ DeleteImage(
Tcl_DeleteHashEntry(masterPtr->hPtr);
}
Tcl_Release(masterPtr->winPtr);
- ckfree((char *) masterPtr);
+ ckfree(masterPtr);
} else {
masterPtr->deleted = 1;
}
diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c
index 32eb536..1f06b7d 100644
--- a/generic/tkImgBmap.c
+++ b/generic/tkImgBmap.c
@@ -186,9 +186,8 @@ ImgBmapCreate(
ClientData *clientDataPtr) /* Store manager's token for image here; it
* will be returned in later callbacks. */
{
- BitmapMaster *masterPtr;
+ BitmapMaster *masterPtr = ckalloc(sizeof(BitmapMaster));
- masterPtr = (BitmapMaster *) ckalloc(sizeof(BitmapMaster));
masterPtr->tkMaster = master;
masterPtr->interp = interp;
masterPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgBmapCmd,
@@ -242,8 +241,8 @@ ImgBmapConfigureMaster(
{
BitmapInstance *instancePtr;
int maskWidth, maskHeight, dummy1, dummy2;
+ const char **argv = ckalloc((objc+1) * sizeof(char *));
- const char **argv = (const char **) ckalloc((objc+1) * sizeof(char *));
for (dummy1 = 0; dummy1 < objc; dummy1++) {
argv[dummy1]=Tcl_GetString(objv[dummy1]);
}
@@ -251,10 +250,10 @@ ImgBmapConfigureMaster(
if (Tk_ConfigureWidget(masterPtr->interp, Tk_MainWindow(masterPtr->interp),
configSpecs, objc, argv, (char *) masterPtr, flags) != TCL_OK) {
- ckfree((char *) argv);
+ ckfree(argv);
return TCL_ERROR;
}
- ckfree((char *) argv);
+ ckfree(argv);
/*
* Parse the bitmap and/or mask to create binary data. Make sure that the
@@ -613,7 +612,7 @@ TkGetBitmapData(
goto error;
}
numBytes = ((width+7)/8) * height;
- data = ckalloc((unsigned) numBytes);
+ data = ckalloc(numBytes);
for (p = data; numBytes > 0; p++, numBytes--) {
if (NextBitmapWord(&pi) != TCL_OK) {
goto error;
@@ -831,7 +830,7 @@ ImgBmapGet(
* the image.
*/
- instancePtr = (BitmapInstance *) ckalloc(sizeof(BitmapInstance));
+ instancePtr = ckalloc(sizeof(BitmapInstance));
instancePtr->refCount = 1;
instancePtr->masterPtr = masterPtr;
instancePtr->tkwin = tkwin;
@@ -976,7 +975,7 @@ ImgBmapFree(
}
prevPtr->nextPtr = instancePtr->nextPtr;
}
- ckfree((char *) instancePtr);
+ ckfree(instancePtr);
}
/*
@@ -1017,7 +1016,7 @@ ImgBmapDelete(
ckfree(masterPtr->maskData);
}
Tk_FreeOptions(configSpecs, (char *) masterPtr, NULL, 0);
- ckfree((char *) masterPtr);
+ ckfree(masterPtr);
}
/*
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c
index 0ece066..05dc109 100644
--- a/generic/tkImgGIF.c
+++ b/generic/tkImgGIF.c
@@ -574,7 +574,7 @@ FileReadGIF(
if (trashBuffer == NULL) {
nBytes = fileWidth * fileHeight * 3;
- trashBuffer = (unsigned char *) ckalloc((unsigned) nBytes);
+ trashBuffer = ckalloc(nBytes);
}
/*
@@ -658,20 +658,20 @@ FileReadGIF(
block.offset[3] = (transparent>=0) ? 3 : 0;
block.pitch = block.pixelSize * imageWidth;
nBytes = block.pitch * imageHeight;
- block.pixelPtr = (unsigned char *) ckalloc((unsigned) nBytes);
+ block.pixelPtr = ckalloc(nBytes);
if (ReadImage(gifConfPtr, interp, block.pixelPtr, chan, imageWidth,
imageHeight, colorMap, srcX, srcY, BitSet(buf[8],INTERLACE),
transparent) != TCL_OK) {
- ckfree((char *) block.pixelPtr);
+ ckfree(block.pixelPtr);
goto error;
}
if (Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY,
width, height, TK_PHOTO_COMPOSITE_SET) != TCL_OK) {
- ckfree((char *) block.pixelPtr);
+ ckfree(block.pixelPtr);
goto error;
}
- ckfree((char *) block.pixelPtr);
+ ckfree(block.pixelPtr);
}
/*
@@ -688,7 +688,7 @@ FileReadGIF(
*/
if (trashBuffer != NULL) {
- ckfree((char *) trashBuffer);
+ ckfree(trashBuffer);
}
return result;
}
diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c
index ec84a1c..b71faed 100644
--- a/generic/tkImgPNG.c
+++ b/generic/tkImgPNG.c
@@ -388,7 +388,7 @@ CleanupPNGImage(
}
if (pngPtr->block.pixelPtr) {
- ckfree((char *) pngPtr->block.pixelPtr);
+ ckfree(pngPtr->block.pixelPtr);
}
if (pngPtr->thisLineObj) {
Tcl_DecrRefCount(pngPtr->thisLineObj);
@@ -2449,8 +2449,7 @@ DecodePNG(
pngPtr->thisLineObj = Tcl_NewObj();
Tcl_IncrRefCount(pngPtr->thisLineObj);
- pngPtr->block.pixelPtr = (unsigned char *)
- attemptckalloc(pngPtr->blockLen);
+ pngPtr->block.pixelPtr = attemptckalloc(pngPtr->blockLen);
if (!pngPtr->block.pixelPtr) {
Tcl_SetResult(interp, "Memory allocation failed", TCL_STATIC);
return TCL_ERROR;
diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c
index 88f0858..71f4481 100644
--- a/generic/tkImgPPM.c
+++ b/generic/tkImgPPM.c
@@ -210,7 +210,7 @@ FileReadPPM(
nLines = 1;
}
nBytes = nLines * block.pitch;
- pixelPtr = (unsigned char *) ckalloc((unsigned) nBytes);
+ pixelPtr = ckalloc(nBytes);
block.pixelPtr = pixelPtr + srcX * block.pixelSize;
for (h = height; h > 0; h -= nLines) {
@@ -224,7 +224,7 @@ FileReadPPM(
fileName, "\": ",
Tcl_Eof(chan) ? "not enough data" : Tcl_PosixError(interp),
NULL);
- ckfree((char *) pixelPtr);
+ ckfree(pixelPtr);
return TCL_ERROR;
}
if (maxIntensity != 255) {
@@ -237,13 +237,13 @@ FileReadPPM(
block.height = nLines;
if (Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY,
width, nLines, TK_PHOTO_COMPOSITE_SET) != TCL_OK) {
- ckfree((char *) pixelPtr);
+ ckfree(pixelPtr);
return TCL_ERROR;
}
destY += nLines;
}
- ckfree((char *) pixelPtr);
+ ckfree(pixelPtr);
return TCL_OK;
}
@@ -562,7 +562,7 @@ StringReadPPM(
nLines = 1;
}
nBytes = nLines * block.pitch;
- pixelPtr = (unsigned char *) ckalloc((unsigned) nBytes);
+ pixelPtr = ckalloc(nBytes);
block.pixelPtr = pixelPtr + srcX * block.pixelSize;
for (h = height; h > 0; h -= nLines) {
@@ -573,7 +573,7 @@ StringReadPPM(
nBytes = nLines * block.pitch;
}
if (dataSize < nBytes) {
- ckfree((char *) pixelPtr);
+ ckfree(pixelPtr);
Tcl_AppendResult(interp, "truncated PPM data", NULL);
return TCL_ERROR;
}
@@ -584,13 +584,13 @@ StringReadPPM(
block.height = nLines;
if (Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY,
width, nLines, TK_PHOTO_COMPOSITE_SET) != TCL_OK) {
- ckfree((char *) pixelPtr);
+ ckfree(pixelPtr);
return TCL_ERROR;
}
destY += nLines;
}
- ckfree((char *) pixelPtr);
+ ckfree(pixelPtr);
return TCL_OK;
}
diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c
index df33769..5084e55 100644
--- a/generic/tkImgPhInstance.c
+++ b/generic/tkImgPhInstance.c
@@ -275,7 +275,7 @@ TkImgPhotoGet(
* a new instance of the image.
*/
- instancePtr = (PhotoInstance *) ckalloc(sizeof(PhotoInstance));
+ instancePtr = ckalloc(sizeof(PhotoInstance));
instancePtr->masterPtr = masterPtr;
instancePtr->display = Tk_Display(tkwin);
instancePtr->colormap = Tk_Colormap(tkwin);
@@ -798,8 +798,8 @@ TkImgPhotoInstanceSetSize(
* such possibility.
*/
- newError = (schar *) ckalloc((unsigned)
- masterPtr->height * masterPtr->width * 3 * sizeof(schar));
+ newError = ckalloc(masterPtr->height * masterPtr->width
+ * 3 * sizeof(schar));
/*
* Zero the new array so that we don't get bogus error values
@@ -852,7 +852,7 @@ TkImgPhotoInstanceSetSize(
errSrcPtr += instancePtr->width * 3;
}
}
- ckfree((char *) instancePtr->error);
+ ckfree(instancePtr->error);
}
instancePtr->error = newError;
@@ -1033,7 +1033,7 @@ GetColorTable(
* No color table currently available; need to make one.
*/
- colorPtr = (ColorTable *) ckalloc(sizeof(ColorTable));
+ colorPtr = ckalloc(sizeof(ColorTable));
/*
* The following line of code should not normally be needed due to the
@@ -1196,7 +1196,7 @@ AllocateColors(
} else {
numColors = MAX(MAX(nRed, nGreen), nBlue);
}
- colors = (XColor *) ckalloc(numColors * sizeof(XColor));
+ colors = ckalloc(numColors * sizeof(XColor));
for (i = 0; i < numColors; ++i) {
if (igam == 1.0) {
@@ -1216,7 +1216,7 @@ AllocateColors(
*/
numColors = (mono) ? nRed: (nRed * nGreen * nBlue);
- colors = (XColor *) ckalloc(numColors * sizeof(XColor));
+ colors = ckalloc(numColors * sizeof(XColor));
if (!mono) {
/*
@@ -1260,7 +1260,7 @@ AllocateColors(
* Now try to allocate the colors we've calculated.
*/
- pixels = (unsigned long *) ckalloc(numColors * sizeof(unsigned long));
+ pixels = ckalloc(numColors * sizeof(unsigned long));
for (i = 0; i < numColors; ++i) {
if (!XAllocColor(colorPtr->id.display, colorPtr->id.colormap,
&colors[i])) {
@@ -1291,8 +1291,8 @@ AllocateColors(
break;
}
XFreeColors(colorPtr->id.display, colorPtr->id.colormap, pixels, i, 0);
- ckfree((char *) colors);
- ckfree((char *) pixels);
+ ckfree(colors);
+ ckfree(pixels);
if (!mono) {
if ((nRed == 2) && (nGreen == 2) && (nBlue == 2)) {
@@ -1394,7 +1394,7 @@ AllocateColors(
}
}
- ckfree((char *) colors);
+ ckfree(colors);
}
/*
@@ -1429,7 +1429,7 @@ DisposeColorTable(
colorPtr->pixelMap, colorPtr->numColors, 0);
Tk_FreeColormap(colorPtr->id.display, colorPtr->id.colormap);
}
- ckfree((char *) colorPtr->pixelMap);
+ ckfree(colorPtr->pixelMap);
}
entry = Tcl_FindHashEntry(&imgPhotoColorHash, (char *) &colorPtr->id);
@@ -1438,7 +1438,7 @@ DisposeColorTable(
}
Tcl_DeleteHashEntry(entry);
- ckfree((char *) colorPtr);
+ ckfree(colorPtr);
}
/*
@@ -1523,7 +1523,7 @@ ReclaimColors(
colorPtr->pixelMap, colorPtr->numColors, 0);
numColors -= colorPtr->numColors;
colorPtr->numColors = 0;
- ckfree((char *) colorPtr->pixelMap);
+ ckfree(colorPtr->pixelMap);
colorPtr->pixelMap = NULL;
}
@@ -1567,7 +1567,7 @@ TkImgDisposeInstance(
XDestroyImage(instancePtr->imagePtr);
}
if (instancePtr->error != NULL) {
- ckfree((char *) instancePtr->error);
+ ckfree(instancePtr->error);
}
if (instancePtr->colorTablePtr != NULL) {
FreeColorTable(instancePtr->colorTablePtr, 1);
@@ -1583,7 +1583,7 @@ TkImgDisposeInstance(
prevPtr->nextPtr = instancePtr->nextPtr;
}
Tk_FreeColormap(instancePtr->display, instancePtr->colormap);
- ckfree((char *) instancePtr);
+ ckfree(instancePtr);
}
/*
@@ -1664,8 +1664,7 @@ TkImgDitherInstance(
* recovering from the failure.
*/
- imagePtr->data =
- ckalloc((unsigned) (imagePtr->bytes_per_line * nLines));
+ imagePtr->data = ckalloc(imagePtr->bytes_per_line * nLines);
bigEndian = imagePtr->bitmap_bit_order == MSBFirst;
firstBit = bigEndian? (1 << (imagePtr->bitmap_unit - 1)): 1;
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 589b9b8..0ad0738 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -227,13 +227,13 @@ PhotoFormatThreadExitProc(
while (tsdPtr->oldFormatList != NULL) {
freePtr = tsdPtr->oldFormatList;
tsdPtr->oldFormatList = tsdPtr->oldFormatList->nextPtr;
- ckfree((char *) freePtr);
+ ckfree(freePtr);
}
while (tsdPtr->formatList != NULL) {
freePtr = tsdPtr->formatList;
tsdPtr->formatList = tsdPtr->formatList->nextPtr;
- ckfree((char *) freePtr->name);
- ckfree((char *) freePtr);
+ ckfree(freePtr->name);
+ ckfree(freePtr);
}
}
@@ -271,7 +271,7 @@ Tk_CreateOldPhotoImageFormat(
tsdPtr->initialized = 1;
Tcl_CreateThreadExitHandler(PhotoFormatThreadExitProc, NULL);
}
- copyPtr = (Tk_PhotoImageFormat *) ckalloc(sizeof(Tk_PhotoImageFormat));
+ copyPtr = ckalloc(sizeof(Tk_PhotoImageFormat));
*copyPtr = *formatPtr;
copyPtr->nextPtr = tsdPtr->oldFormatList;
tsdPtr->oldFormatList = copyPtr;
@@ -292,7 +292,7 @@ Tk_CreatePhotoImageFormat(
tsdPtr->initialized = 1;
Tcl_CreateThreadExitHandler(PhotoFormatThreadExitProc, NULL);
}
- copyPtr = (Tk_PhotoImageFormat *) ckalloc(sizeof(Tk_PhotoImageFormat));
+ copyPtr = ckalloc(sizeof(Tk_PhotoImageFormat));
*copyPtr = *formatPtr;
if (isupper((unsigned char) *formatPtr->name)) {
copyPtr->nextPtr = tsdPtr->oldFormatList;
@@ -344,7 +344,7 @@ ImgPhotoCreate(
* Allocate and initialize the photo image master record.
*/
- masterPtr = (PhotoMaster *) ckalloc(sizeof(PhotoMaster));
+ masterPtr = ckalloc(sizeof(PhotoMaster));
memset(masterPtr, 0, sizeof(PhotoMaster));
masterPtr->tkMaster = master;
masterPtr->interp = interp;
@@ -875,8 +875,7 @@ ImgPhotoCmd(
break;
}
dataWidth = listObjc;
- pixelPtr = (unsigned char *)
- ckalloc((unsigned) dataWidth * dataHeight * 3);
+ pixelPtr = ckalloc(dataWidth * dataHeight * 3);
block.pixelPtr = pixelPtr;
} else if (listObjc != dataWidth) {
Tcl_AppendResult(interp, "all elements of color list must",
@@ -937,7 +936,7 @@ ImgPhotoCmd(
}
if (y < dataHeight || dataHeight == 0 || dataWidth == 0) {
if (block.pixelPtr != NULL) {
- ckfree((char *) block.pixelPtr);
+ ckfree(block.pixelPtr);
}
if (y < dataHeight) {
return TCL_ERROR;
@@ -966,7 +965,7 @@ ImgPhotoCmd(
options.toX, options.toY, options.toX2 - options.toX,
options.toY2 - options.toY,
TK_PHOTO_COMPOSITE_SET);
- ckfree((char *) block.pixelPtr);
+ ckfree(block.pixelPtr);
return result;
case PHOTO_READ: {
@@ -1722,7 +1721,7 @@ ImgPhotoConfigureMaster(
Tk_PhotoImageFormat *imageFormat;
const char **args;
- args = (const char **) ckalloc((objc + 1) * sizeof(char *));
+ args = ckalloc((objc + 1) * sizeof(char *));
for (i = 0, j = 0; i < objc; i++,j++) {
args[j] = Tcl_GetStringFromObj(objv[i], &length);
if ((length > 1) && (args[j][0] == '-')) {
@@ -1732,7 +1731,7 @@ ImgPhotoConfigureMaster(
data = objv[i];
j--;
} else {
- ckfree((char *) args);
+ ckfree(args);
Tcl_AppendResult(interp,
"value for \"-data\" missing", NULL);
return TCL_ERROR;
@@ -1743,7 +1742,7 @@ ImgPhotoConfigureMaster(
format = objv[i];
j--;
} else {
- ckfree((char *) args);
+ ckfree(args);
Tcl_AppendResult(interp,
"value for \"-format\" missing", NULL);
return TCL_ERROR;
@@ -1781,10 +1780,10 @@ ImgPhotoConfigureMaster(
if (Tk_ConfigureWidget(interp, Tk_MainWindow(interp), configSpecs,
j, args, (char *) masterPtr, flags) != TCL_OK) {
- ckfree((char *) args);
+ ckfree(args);
goto errorExit;
}
- ckfree((char *) args);
+ ckfree(args);
/*
* Regard the empty string for -file, -data or -format as the null value.
@@ -2064,7 +2063,7 @@ ImgPhotoDelete(
Tcl_DeleteCommandFromToken(masterPtr->interp, masterPtr->imageCmd);
}
if (masterPtr->pix32 != NULL) {
- ckfree((char *) masterPtr->pix32);
+ ckfree(masterPtr->pix32);
}
if (masterPtr->validRegion != NULL) {
TkDestroyRegion(masterPtr->validRegion);
@@ -2076,7 +2075,7 @@ ImgPhotoDelete(
Tcl_DecrRefCount(masterPtr->format);
}
Tk_FreeOptions(configSpecs, (char *) masterPtr, NULL, 0);
- ckfree((char *) masterPtr);
+ ckfree(masterPtr);
}
/*
@@ -2169,7 +2168,7 @@ ImgPhotoSetSize(
if (newPixSize == 0) {
newPix32 = NULL;
} else {
- newPix32 = (unsigned char *) attemptckalloc(newPixSize);
+ newPix32 = attemptckalloc(newPixSize);
if (newPix32 == NULL) {
return TCL_ERROR;
}
@@ -2253,7 +2252,7 @@ ImgPhotoSetSize(
}
}
- ckfree((char *) masterPtr->pix32);
+ ckfree(masterPtr->pix32);
}
masterPtr->pix32 = newPix32;
@@ -3631,8 +3630,7 @@ ImgGetPhoto(
if ((greenOffset||blueOffset) && !(optPtr->options & OPT_GRAYSCALE)) {
newPixelSize += 2;
}
- data = attemptckalloc((unsigned int) (newPixelSize *
- blockPtr->width * blockPtr->height));
+ data = attemptckalloc(newPixelSize*blockPtr->width*blockPtr->height);
if (data == NULL) {
return NULL;
}
@@ -3773,7 +3771,7 @@ ImgStringWrite(
Tcl_DStringInit(&data);
if ((blockPtr->width > 0) && (blockPtr->height > 0)) {
- char *line = ckalloc((unsigned) ((8 * blockPtr->width) + 2));
+ char *line = ckalloc((8 * blockPtr->width) + 2);
int row, col;
for (row=0; row<blockPtr->height; row++) {
diff --git a/generic/tkImgUtil.c b/generic/tkImgUtil.c
index 577efbc..8752b2e 100644
--- a/generic/tkImgUtil.c
+++ b/generic/tkImgUtil.c
@@ -57,7 +57,7 @@ TkAlignImageData(
dataWidth += (alignment - (dataWidth % alignment));
}
- data = ckalloc((unsigned) dataWidth * image->height);
+ data = ckalloc(dataWidth * image->height);
destPtr = data;
for (i = 0; i < image->height; i++) {
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index 57f4c74..b035878 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -491,8 +491,7 @@ Tk_ListboxObjCmd(
* command, so future invocations will have access to it.
*/
- optionTables = (ListboxOptionTables *)
- ckalloc(sizeof(ListboxOptionTables));
+ optionTables = ckalloc(sizeof(ListboxOptionTables));
/*
* Set up an exit handler to free the optionTables struct.
@@ -517,7 +516,7 @@ Tk_ListboxObjCmd(
* already (e.g. resource pointers).
*/
- listPtr = (Listbox *) ckalloc(sizeof(Listbox));
+ listPtr = ckalloc(sizeof(Listbox));
memset(listPtr, 0, (sizeof(Listbox)));
listPtr->tkwin = tkwin;
@@ -528,11 +527,9 @@ Tk_ListboxObjCmd(
ListboxCmdDeletedProc);
listPtr->optionTable = optionTables->listboxOptionTable;
listPtr->itemAttrOptionTable = optionTables->itemAttrOptionTable;
- listPtr->selection = (Tcl_HashTable *)
- ckalloc(sizeof(Tcl_HashTable));
+ listPtr->selection = ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(listPtr->selection, TCL_ONE_WORD_KEYS);
- listPtr->itemAttrTable = (Tcl_HashTable *)
- ckalloc(sizeof(Tcl_HashTable));
+ listPtr->itemAttrTable = ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(listPtr->itemAttrTable, TCL_ONE_WORD_KEYS);
listPtr->relief = TK_RELIEF_RAISED;
listPtr->textGC = None;
@@ -1391,7 +1388,7 @@ ListboxGetItemAttributes(
entry = Tcl_CreateHashEntry(listPtr->itemAttrTable,
(char *) INT2PTR(index), &isNew);
if (isNew) {
- attrs = (ItemAttr *) ckalloc(sizeof(ItemAttr));
+ attrs = ckalloc(sizeof(ItemAttr));
attrs->border = NULL;
attrs->selBorder = NULL;
attrs->fgColor = NULL;
@@ -1451,7 +1448,7 @@ DestroyListbox(
*/
Tcl_DeleteHashTable(listPtr->selection);
- ckfree((char *) listPtr->selection);
+ ckfree(listPtr->selection);
/*
* Free the item attribute hash table.
@@ -1462,7 +1459,7 @@ DestroyListbox(
ckfree(Tcl_GetHashValue(entry));
}
Tcl_DeleteHashTable(listPtr->itemAttrTable);
- ckfree((char *) listPtr->itemAttrTable);
+ ckfree(listPtr->itemAttrTable);
/*
* Free up all the stuff that requires special handling, then let
@@ -1483,7 +1480,7 @@ DestroyListbox(
listPtr->tkwin);
Tcl_Release(listPtr->tkwin);
listPtr->tkwin = NULL;
- ckfree((char *) listPtr);
+ ckfree(listPtr);
}
/*
@@ -1509,7 +1506,7 @@ DestroyListboxOptionTables(
ClientData clientData, /* Pointer to the OptionTables struct */
Tcl_Interp *interp) /* Pointer to the calling interp */
{
- ckfree((char *) clientData);
+ ckfree(clientData);
return;
}
@@ -2452,7 +2449,7 @@ ListboxDeleteSubCmd(
entry = Tcl_FindHashEntry(listPtr->itemAttrTable, (char *) INT2PTR(i));
if (entry != NULL) {
- ckfree((char *)Tcl_GetHashValue(entry));
+ ckfree(Tcl_GetHashValue(entry));
Tcl_DeleteHashEntry(entry);
}
@@ -3447,7 +3444,7 @@ ListboxListVarProc(
entry = Tcl_FindHashEntry(listPtr->itemAttrTable,
(char *) INT2PTR(i));
if (entry != NULL) {
- ckfree((char *) Tcl_GetHashValue(entry));
+ ckfree(Tcl_GetHashValue(entry));
Tcl_DeleteHashEntry(entry);
}
}
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index f9ea395..3bd3a4e 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -409,8 +409,7 @@ TkCreateMenuCmd(
Tcl_Interp *interp) /* Interpreter we are creating the command
* in. */
{
- TkMenuOptionTables *optionTablesPtr = (TkMenuOptionTables *)
- ckalloc(sizeof(TkMenuOptionTables));
+ TkMenuOptionTables *optionTablesPtr = ckalloc(sizeof(TkMenuOptionTables));
optionTablesPtr->menuOptionTable =
Tk_CreateOptionTable(interp, tkMenuConfigSpecs);
@@ -502,7 +501,7 @@ MenuCmd(
* Tcl_EventuallyFree is called.
*/
- menuPtr = (TkMenu *) ckalloc(sizeof(TkMenu));
+ menuPtr = ckalloc(sizeof(TkMenu));
memset(menuPtr, 0, sizeof(TkMenu));
menuPtr->tkwin = newWin;
menuPtr->display = Tk_Display(newWin);
@@ -1231,7 +1230,7 @@ DestroyMenuInstance(
menuPtr->numEntries = i;
}
if (menuPtr->entries != NULL) {
- ckfree((char *) menuPtr->entries);
+ ckfree(menuPtr->entries);
}
TkMenuFreeDrawOptions(menuPtr);
Tk_FreeConfigOptions((char *) menuPtr,
@@ -1501,7 +1500,7 @@ DestroyMenuEntry(
TkpDestroyMenuEntry(mePtr);
TkMenuEntryFreeDrawOptions(mePtr);
Tk_FreeConfigOptions((char *) mePtr, mePtr->optionTable, menuPtr->tkwin);
- ckfree((char *) mePtr);
+ ckfree(mePtr);
}
/*
@@ -1571,8 +1570,7 @@ ConfigureMenu(
for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
- menuListPtr->errorStructPtr = (Tk_SavedOptions *)
- ckalloc(sizeof(Tk_SavedOptions));
+ menuListPtr->errorStructPtr = ckalloc(sizeof(Tk_SavedOptions));
result = Tk_SetOptions(interp, (char *) menuListPtr,
menuListPtr->optionTablesPtr->menuOptionTable, objc, objv,
menuListPtr->tkwin, menuListPtr->errorStructPtr, NULL);
@@ -1581,12 +1579,12 @@ ConfigureMenu(
cleanupPtr != menuListPtr;
cleanupPtr = cleanupPtr->nextInstancePtr) {
Tk_RestoreSavedOptions(cleanupPtr->errorStructPtr);
- ckfree((char *) cleanupPtr->errorStructPtr);
+ ckfree(cleanupPtr->errorStructPtr);
cleanupPtr->errorStructPtr = NULL;
}
if (menuListPtr->errorStructPtr != NULL) {
Tk_RestoreSavedOptions(menuListPtr->errorStructPtr);
- ckfree((char *) menuListPtr->errorStructPtr);
+ ckfree(menuListPtr->errorStructPtr);
menuListPtr->errorStructPtr = NULL;
}
return TCL_ERROR;
@@ -1650,12 +1648,12 @@ ConfigureMenu(
cleanupPtr != menuListPtr;
cleanupPtr = cleanupPtr->nextInstancePtr) {
Tk_RestoreSavedOptions(cleanupPtr->errorStructPtr);
- ckfree((char *) cleanupPtr->errorStructPtr);
+ ckfree(cleanupPtr->errorStructPtr);
cleanupPtr->errorStructPtr = NULL;
}
if (menuListPtr->errorStructPtr != NULL) {
Tk_RestoreSavedOptions(menuListPtr->errorStructPtr);
- ckfree((char *) menuListPtr->errorStructPtr);
+ ckfree(menuListPtr->errorStructPtr);
menuListPtr->errorStructPtr = NULL;
}
return TCL_ERROR;
@@ -1673,7 +1671,7 @@ ConfigureMenu(
}
menuListPtr->numEntries--;
if (menuListPtr->numEntries == 0) {
- ckfree((char *) menuListPtr->entries);
+ ckfree(menuListPtr->entries);
menuListPtr->entries = NULL;
}
}
@@ -1700,7 +1698,7 @@ ConfigureMenu(
for (cleanupPtr = menuPtr->masterMenuPtr; cleanupPtr != NULL;
cleanupPtr = cleanupPtr->nextInstancePtr) {
Tk_FreeSavedOptions(cleanupPtr->errorStructPtr);
- ckfree((char *) cleanupPtr->errorStructPtr);
+ ckfree(cleanupPtr->errorStructPtr);
cleanupPtr->errorStructPtr = NULL;
}
@@ -2293,8 +2291,7 @@ MenuNewEntry(
* Create a new array of entries with an empty slot for the new entry.
*/
- newEntries = (TkMenuEntry **)
- ckalloc((unsigned) (menuPtr->numEntries+1)*sizeof(TkMenuEntry *));
+ newEntries = ckalloc((menuPtr->numEntries+1) * sizeof(TkMenuEntry *));
for (i = 0; i < index; i++) {
newEntries[i] = menuPtr->entries[i];
}
@@ -2303,11 +2300,11 @@ MenuNewEntry(
newEntries[i+1]->index = i + 1;
}
if (menuPtr->numEntries != 0) {
- ckfree((char *) menuPtr->entries);
+ ckfree(menuPtr->entries);
}
menuPtr->entries = newEntries;
menuPtr->numEntries++;
- mePtr = (TkMenuEntry *) ckalloc(sizeof(TkMenuEntry));
+ mePtr = ckalloc(sizeof(TkMenuEntry));
menuPtr->entries[index] = mePtr;
mePtr->type = type;
mePtr->optionTable = menuPtr->optionTablesPtr->entryOptionTables[type];
@@ -2342,14 +2339,14 @@ MenuNewEntry(
mePtr->nextCascadePtr = NULL;
if (Tk_InitOptions(menuPtr->interp, (char *) mePtr,
mePtr->optionTable, menuPtr->tkwin) != TCL_OK) {
- ckfree((char *) mePtr);
+ ckfree(mePtr);
return NULL;
}
TkMenuInitializeEntryDrawingFields(mePtr);
if (TkpMenuNewEntry(mePtr) != TCL_OK) {
Tk_FreeConfigOptions((char *) mePtr, mePtr->optionTable,
menuPtr->tkwin);
- ckfree((char *) mePtr);
+ ckfree(mePtr);
return NULL;
}
@@ -2439,7 +2436,7 @@ MenuAddOrInsert(
}
errorMenuPtr->numEntries--;
if (errorMenuPtr->numEntries == 0) {
- ckfree((char *) errorMenuPtr->entries);
+ ckfree(errorMenuPtr->entries);
errorMenuPtr->entries = NULL;
}
if (errorMenuPtr == menuListPtr) {
@@ -3230,7 +3227,7 @@ TkSetWindowMenuBar(
} else {
prevTopLevelPtr->nextPtr = topLevelListPtr->nextPtr;
}
- ckfree((char *) topLevelListPtr);
+ ckfree(topLevelListPtr);
TkFreeMenuReferences(menuRefPtr);
}
}
@@ -3295,8 +3292,7 @@ TkSetWindowMenuBar(
* menu.
*/
- topLevelListPtr = (TkMenuTopLevelList *)
- ckalloc(sizeof(TkMenuTopLevelList));
+ topLevelListPtr = ckalloc(sizeof(TkMenuTopLevelList));
topLevelListPtr->tkwin = tkwin;
topLevelListPtr->nextPtr = menuRefPtr->topLevelListPtr;
menuRefPtr->topLevelListPtr = topLevelListPtr;
@@ -3354,12 +3350,11 @@ Tcl_HashTable *
TkGetMenuHashTable(
Tcl_Interp *interp) /* The interp we need the hash table in.*/
{
- Tcl_HashTable *menuTablePtr;
-
- menuTablePtr = (Tcl_HashTable *)
+ Tcl_HashTable *menuTablePtr =
Tcl_GetAssocData(interp, MENU_HASH_KEY, NULL);
+
if (menuTablePtr == NULL) {
- menuTablePtr = (Tcl_HashTable *) ckalloc(sizeof(Tcl_HashTable));
+ menuTablePtr = ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(menuTablePtr, TCL_STRING_KEYS);
Tcl_SetAssocData(interp, MENU_HASH_KEY, DestroyMenuHashTable,
menuTablePtr);
@@ -3400,7 +3395,7 @@ TkCreateMenuReferences(
hashEntryPtr = Tcl_CreateHashEntry(menuTablePtr, pathName, &newEntry);
if (newEntry) {
- menuRefPtr = (TkMenuReferences *) ckalloc(sizeof(TkMenuReferences));
+ menuRefPtr = ckalloc(sizeof(TkMenuReferences));
menuRefPtr->menuPtr = NULL;
menuRefPtr->topLevelListPtr = NULL;
menuRefPtr->parentEntryPtr = NULL;
@@ -3505,7 +3500,7 @@ TkFreeMenuReferences(
&& (menuRefPtr->parentEntryPtr == NULL)
&& (menuRefPtr->topLevelListPtr == NULL)) {
Tcl_DeleteHashEntry(menuRefPtr->hashEntryPtr);
- ckfree((char *) menuRefPtr);
+ ckfree(menuRefPtr);
return 1;
}
return 0;
@@ -3551,7 +3546,7 @@ DeleteMenuCloneEntries(
}
menuListPtr->numEntries -= numDeleted;
if (menuListPtr->numEntries == 0) {
- ckfree((char *) menuListPtr->entries);
+ ckfree(menuListPtr->entries);
menuListPtr->entries = NULL;
}
if ((menuListPtr->active >= first)
diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c
index 17fc6c6..d8af461 100644
--- a/generic/tkMenubutton.c
+++ b/generic/tkMenubutton.c
@@ -635,7 +635,7 @@ ConfigureMenuButton(
if (mbPtr->text != NULL) {
ckfree(mbPtr->text);
}
- mbPtr->text = (char *) ckalloc((unsigned) (strlen(value) + 1));
+ mbPtr->text = ckalloc(strlen(value) + 1);
strcpy(mbPtr->text, value);
}
Tcl_TraceVar(interp, mbPtr->textVarName,
@@ -907,7 +907,7 @@ MenuButtonTextVarProc(
ckfree(mbPtr->text);
}
len = 1 + (unsigned) strlen(value);
- mbPtr->text = (char *) ckalloc(len);
+ mbPtr->text = ckalloc(len);
memcpy(mbPtr->text, value, len);
TkpComputeMenuButtonGeometry(mbPtr);
diff --git a/generic/tkMessage.c b/generic/tkMessage.c
index ce1bbb3..19df9f3 100644
--- a/generic/tkMessage.c
+++ b/generic/tkMessage.c
@@ -243,7 +243,7 @@ Tk_MessageObjCmd(
optionTable = Tk_CreateOptionTable(interp, optionSpecs);
- msgPtr = (Message *) ckalloc(sizeof(Message));
+ msgPtr = ckalloc(sizeof(Message));
memset(msgPtr, 0, (size_t) sizeof(Message));
/*
@@ -413,7 +413,7 @@ DestroyMessage(
}
Tk_FreeConfigOptions((char *) msgPtr, msgPtr->optionTable, msgPtr->tkwin);
msgPtr->tkwin = NULL;
- ckfree((char *) msgPtr);
+ ckfree(msgPtr);
}
/*
@@ -864,7 +864,7 @@ MessageTextVarProc(
ckfree(msgPtr->string);
}
msgPtr->numChars = Tcl_NumUtfChars(value, -1);
- msgPtr->string = (char *) ckalloc((unsigned) (strlen(value) + 1));
+ msgPtr->string = ckalloc(strlen(value) + 1);
strcpy(msgPtr->string, value);
ComputeMessageGeometry(msgPtr);
diff --git a/generic/tkObj.c b/generic/tkObj.c
index d51b28f..dad50e2 100644
--- a/generic/tkObj.c
+++ b/generic/tkObj.c
@@ -312,7 +312,7 @@ FreePixelInternalRep(
if (!SIMPLE_PIXELREP(objPtr)) {
pixelPtr = GET_COMPLEXPIXEL(objPtr);
- ckfree((char *) pixelPtr);
+ ckfree(pixelPtr);
}
SET_SIMPLEPIXEL(objPtr, 0);
objPtr->typePtr = NULL;
@@ -349,7 +349,7 @@ DupPixelInternalRep(
SET_SIMPLEPIXEL(copyPtr, GET_SIMPLEPIXEL(srcPtr));
} else {
oldPtr = GET_COMPLEXPIXEL(srcPtr);
- newPtr = (PixelRep *) ckalloc(sizeof(PixelRep));
+ newPtr = ckalloc(sizeof(PixelRep));
newPtr->value = oldPtr->value;
newPtr->units = oldPtr->units;
newPtr->tkwin = oldPtr->tkwin;
@@ -433,7 +433,7 @@ SetPixelFromAny(
if ((units < 0) && (i == d)) {
SET_SIMPLEPIXEL(objPtr, i);
} else {
- PixelRep *pixelPtr = (PixelRep *) ckalloc(sizeof(PixelRep));
+ PixelRep *pixelPtr = ckalloc(sizeof(PixelRep));
pixelPtr->value = d;
pixelPtr->units = units;
@@ -564,7 +564,7 @@ DupMMInternalRep(
copyPtr->typePtr = srcPtr->typePtr;
oldPtr = srcPtr->internalRep.otherValuePtr;
- newPtr = (MMRep *) ckalloc(sizeof(MMRep));
+ newPtr = ckalloc(sizeof(MMRep));
newPtr->value = oldPtr->value;
newPtr->units = oldPtr->units;
newPtr->tkwin = oldPtr->tkwin;
@@ -608,7 +608,7 @@ UpdateStringOfMM(
Tcl_PrintDouble(NULL, mmPtr->value, buffer);
len = (int)strlen(buffer);
- objPtr->bytes = (char *) ckalloc((unsigned) len + 1);
+ objPtr->bytes = ckalloc(len + 1);
strcpy(objPtr->bytes, buffer);
objPtr->length = len;
}
@@ -727,7 +727,7 @@ SetMMFromAny(
objPtr->typePtr = &mmObjType;
- mmPtr = (MMRep *) ckalloc(sizeof(MMRep));
+ mmPtr = ckalloc(sizeof(MMRep));
mmPtr->value = d;
mmPtr->units = units;
mmPtr->tkwin = NULL;
@@ -837,7 +837,7 @@ SetWindowFromAny(
typePtr->freeIntRepProc(objPtr);
}
- winPtr = (WindowRep *) ckalloc(sizeof(WindowRep));
+ winPtr = ckalloc(sizeof(WindowRep));
winPtr->tkwin = NULL;
winPtr->mainPtr = NULL;
winPtr->epoch = 0;
@@ -874,7 +874,7 @@ DupWindowInternalRep(
register WindowRep *oldPtr, *newPtr;
oldPtr = srcPtr->internalRep.otherValuePtr;
- newPtr = (WindowRep *) ckalloc(sizeof(WindowRep));
+ newPtr = ckalloc(sizeof(WindowRep));
newPtr->tkwin = oldPtr->tkwin;
newPtr->mainPtr = oldPtr->mainPtr;
newPtr->epoch = oldPtr->epoch;
diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c
index 9f0655e..e054040 100644
--- a/generic/tkOldConfig.c
+++ b/generic/tkOldConfig.c
@@ -374,7 +374,7 @@ DoConfig(
if (nullValue) {
newStr = NULL;
} else {
- newStr = (char *) ckalloc((unsigned) (strlen(value) + 1));
+ newStr = ckalloc(strlen(value) + 1);
strcpy(newStr, value);
}
oldStr = *((char **) ptr);
@@ -720,7 +720,7 @@ FormatConfigInfo(
result = Tcl_Merge(5, argv);
if (freeProc != NULL) {
if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) {
- ckfree((char *) argv[4]);
+ ckfree(argv[4]);
} else {
freeProc((char *) argv[4]);
}
@@ -941,7 +941,7 @@ Tk_ConfigureValue(
Tcl_SetResult(interp, (char *) result, TCL_VOLATILE);
if (freeProc != NULL) {
if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) {
- ckfree((char *) result);
+ ckfree(result);
} else {
freeProc((char *) result);
}
@@ -1073,7 +1073,7 @@ GetCachedSpecs(
specCacheTablePtr =
Tcl_GetAssocData(interp, "tkConfigSpec.threadTable", NULL);
if (specCacheTablePtr == NULL) {
- specCacheTablePtr = (Tcl_HashTable *) ckalloc(sizeof(Tcl_HashTable));
+ specCacheTablePtr = ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(specCacheTablePtr, TCL_ONE_WORD_KEYS);
Tcl_SetAssocData(interp, "tkConfigSpec.threadTable",
DeleteSpecCacheTable, specCacheTablePtr);
@@ -1106,7 +1106,7 @@ GetCachedSpecs(
* from the master copy.
*/
- cachedSpecs = (Tk_ConfigSpec *) ckalloc(entrySpace);
+ cachedSpecs = ckalloc(entrySpace);
memcpy(cachedSpecs, staticSpecs, entrySpace);
Tcl_SetHashValue(entryPtr, cachedSpecs);
@@ -1172,7 +1172,7 @@ DeleteSpecCacheTable(
ckfree(Tcl_GetHashValue(entryPtr));
}
Tcl_DeleteHashTable(tablePtr);
- ckfree((char *) tablePtr);
+ ckfree(tablePtr);
}
/*
diff --git a/generic/tkOldTest.c b/generic/tkOldTest.c
index 05041b7..d87c68e 100644
--- a/generic/tkOldTest.c
+++ b/generic/tkOldTest.c
@@ -168,14 +168,14 @@ ImageCreate(
varName = argv[i+1];
}
- timPtr = (TImageMaster *) ckalloc(sizeof(TImageMaster));
+ timPtr = ckalloc(sizeof(TImageMaster));
timPtr->master = master;
timPtr->interp = interp;
timPtr->width = 30;
timPtr->height = 15;
- timPtr->imageName = (char *) ckalloc((unsigned) (strlen(name) + 1));
+ timPtr->imageName = ckalloc((unsigned) (strlen(name) + 1));
strcpy(timPtr->imageName, name);
- timPtr->varName = (char *) ckalloc((unsigned) (strlen(varName) + 1));
+ timPtr->varName = ckalloc((unsigned) (strlen(varName) + 1));
strcpy(timPtr->varName, varName);
Tcl_CreateCommand(interp, name, ImageCmd, timPtr, NULL);
*clientDataPtr = timPtr;
@@ -273,7 +273,7 @@ ImageGet(
Tcl_SetVar(timPtr->interp, timPtr->varName, buffer,
TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
- instPtr = (TImageInstance *) ckalloc(sizeof(TImageInstance));
+ instPtr = ckalloc(sizeof(TImageInstance));
instPtr->masterPtr = timPtr;
instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000");
gcValues.foreground = instPtr->fg->pixel;
@@ -364,7 +364,7 @@ ImageFree(
TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
Tk_FreeColor(instPtr->fg);
Tk_FreeGC(display, instPtr->gc);
- ckfree((char *) instPtr);
+ ckfree(instPtr);
}
/*
@@ -400,7 +400,7 @@ ImageDelete(
Tcl_DeleteCommand(timPtr->interp, timPtr->imageName);
ckfree(timPtr->imageName);
ckfree(timPtr->varName);
- ckfree((char *) timPtr);
+ ckfree(timPtr);
}
/*
diff --git a/generic/tkOption.c b/generic/tkOption.c
index d3242fd..0463fd5 100644
--- a/generic/tkOption.c
+++ b/generic/tkOption.c
@@ -537,7 +537,7 @@ Tk_GetOption(
*/
classNameLength = (unsigned) (masqName - name);
- masqClass = (char *) ckalloc(classNameLength + 1);
+ masqClass = ckalloc(classNameLength + 1);
strncpy(masqClass, name, classNameLength);
masqClass[classNameLength] = '\0';
@@ -1116,9 +1116,9 @@ ReadOptionFile(
fileName, "\":", Tcl_PosixError(interp), NULL);
Tcl_Close(NULL, chan);
return TCL_ERROR;
-
}
- buffer = ckalloc((unsigned) bufferSize+1);
+
+ buffer = ckalloc(bufferSize + 1);
bufferSize = Tcl_Read(chan, buffer, bufferSize);
if (bufferSize < 0) {
Tcl_AppendResult(interp, "error reading file \"", fileName, "\":",
@@ -1154,7 +1154,7 @@ static ElArray *
NewArray(
int numEls) /* How many elements of space to allocate. */
{
- register ElArray *arrayPtr = (ElArray *) ckalloc(EL_ARRAY_SIZE(numEls));
+ register ElArray *arrayPtr = ckalloc(EL_ARRAY_SIZE(numEls));
arrayPtr->arraySize = numEls;
arrayPtr->numUsed = 0;
@@ -1191,8 +1191,7 @@ ExtendArray(
if (arrayPtr->numUsed >= arrayPtr->arraySize) {
register int newSize = 2*arrayPtr->arraySize;
- arrayPtr = (ElArray *)
- ckrealloc((char *) arrayPtr, EL_ARRAY_SIZE(newSize));
+ arrayPtr = ckrealloc(arrayPtr, EL_ARRAY_SIZE(newSize));
arrayPtr->arraySize = newSize;
arrayPtr->nextToUse = &arrayPtr->els[arrayPtr->numUsed];
}
@@ -1310,11 +1309,11 @@ SetupStacks(
*/
if (tsdPtr->curLevel >= tsdPtr->numLevels) {
- StackLevel *newLevels = (StackLevel *)
- ckalloc((unsigned) (tsdPtr->numLevels*2*sizeof(StackLevel)));
+ StackLevel *newLevels =
+ ckalloc(tsdPtr->numLevels * 2 * sizeof(StackLevel));
memcpy(newLevels, tsdPtr->levels,
tsdPtr->numLevels * sizeof(StackLevel));
- ckfree((char *) tsdPtr->levels);
+ ckfree(tsdPtr->levels);
tsdPtr->numLevels *= 2;
tsdPtr->levels = newLevels;
}
@@ -1433,9 +1432,9 @@ OptionThreadExitProc(
int i;
for (i = 0; i < NUM_STACKS; i++) {
- ckfree((char *) tsdPtr->stacks[i]);
+ ckfree(tsdPtr->stacks[i]);
}
- ckfree((char *) tsdPtr->levels);
+ ckfree(tsdPtr->levels);
tsdPtr->initialized = 0;
}
}
@@ -1479,8 +1478,7 @@ OptionInit(
tsdPtr->curLevel = -1;
tsdPtr->serial = 0;
- tsdPtr->levels = (StackLevel *)
- ckalloc((unsigned) (5*sizeof(StackLevel)));
+ tsdPtr->levels = ckalloc(5 * sizeof(StackLevel));
for (i = 0; i < NUM_STACKS; i++) {
tsdPtr->stacks[i] = NewArray(10);
tsdPtr->levels[0].bases[i] = 0;
@@ -1536,7 +1534,7 @@ ClearOptionTree(
ClearOptionTree(elPtr->child.arrayPtr);
}
}
- ckfree((char *) arrayPtr);
+ ckfree(arrayPtr);
}
/*
diff --git a/generic/tkPack.c b/generic/tkPack.c
index d57d2bf..07047a9 100644
--- a/generic/tkPack.c
+++ b/generic/tkPack.c
@@ -1035,7 +1035,7 @@ GetPacker(
if (!isNew) {
return Tcl_GetHashValue(hPtr);
}
- packPtr = (Packer *) ckalloc(sizeof(Packer));
+ packPtr = ckalloc(sizeof(Packer));
packPtr->tkwin = tkwin;
packPtr->masterPtr = NULL;
packPtr->nextPtr = NULL;
@@ -1368,7 +1368,8 @@ DestroyPacker(
* dead. */
{
register Packer *packPtr = (Packer *) memPtr;
- ckfree((char *) packPtr);
+
+ ckfree(packPtr);
}
/*
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index 3df5024..7b05815 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.c
@@ -401,7 +401,7 @@ Tk_PanedWindowObjCmd(
* easy access to it in the future.
*/
- pwOpts = (OptionTables *) ckalloc(sizeof(OptionTables));
+ pwOpts = ckalloc(sizeof(OptionTables));
/*
* Set up an exit handler to free the optionTables struct.
@@ -424,7 +424,7 @@ Tk_PanedWindowObjCmd(
* Allocate and initialize the widget record.
*/
- pwPtr = (PanedWindow *) ckalloc(sizeof(PanedWindow));
+ pwPtr = ckalloc(sizeof(PanedWindow));
memset((void *)pwPtr, 0, (sizeof(PanedWindow)));
pwPtr->tkwin = tkwin;
pwPtr->display = Tk_Display(tkwin);
@@ -878,7 +878,7 @@ ConfigureSlaves(
* structures may already have existed, some may be new.
*/
- inserts = (Slave **)ckalloc(sizeof(Slave *) * (firstOptionArg - 2));
+ inserts = ckalloc(sizeof(Slave *) * (firstOptionArg - 2));
insertIndex = 0;
/*
@@ -945,7 +945,7 @@ ConfigureSlaves(
* out with their "natural" dimensions.
*/
- slavePtr = (Slave *) ckalloc(sizeof(Slave));
+ slavePtr = ckalloc(sizeof(Slave));
memset(slavePtr, 0, sizeof(Slave));
Tk_InitOptions(interp, (char *)slavePtr, pwPtr->slaveOpts,
pwPtr->tkwin);
@@ -984,8 +984,8 @@ ConfigureSlaves(
* Allocate the new slaves array, then copy the slaves into it, in order.
*/
- i = sizeof(Slave *) * (pwPtr->numSlaves+numNewSlaves);
- newSlaves = (Slave **)ckalloc((unsigned) i);
+ i = sizeof(Slave *) * (pwPtr->numSlaves + numNewSlaves);
+ newSlaves = ckalloc(i);
memset(newSlaves, 0, (size_t) i);
if (index == -1) {
/*
@@ -1028,8 +1028,8 @@ ConfigureSlaves(
* Make the new slaves array the paned window's slave array, and clean up.
*/
- ckfree((void *)pwPtr->slaves);
- ckfree((void *)inserts);
+ ckfree(pwPtr->slaves);
+ ckfree(inserts);
pwPtr->slaves = newSlaves;
/*
@@ -1539,11 +1539,11 @@ DestroyPanedWindow(
Tk_ManageGeometry(pwPtr->slaves[i]->tkwin, NULL, NULL);
Tk_FreeConfigOptions((char *) pwPtr->slaves[i], pwPtr->slaveOpts,
pwPtr->tkwin);
- ckfree((char *) pwPtr->slaves[i]);
+ ckfree(pwPtr->slaves[i]);
pwPtr->slaves[i] = NULL;
}
if (pwPtr->slaves) {
- ckfree((char *) pwPtr->slaves);
+ ckfree(pwPtr->slaves);
}
/*
@@ -1644,7 +1644,7 @@ PanedWindowLostSlaveProc(
SlaveStructureProc, slavePtr);
Tk_UnmapWindow(slavePtr->tkwin);
slavePtr->tkwin = NULL;
- ckfree((char *) slavePtr);
+ ckfree(slavePtr);
ComputeGeometry(pwPtr);
}
@@ -2080,7 +2080,7 @@ SlaveStructureProc(
if (eventPtr->type == DestroyNotify) {
Unlink(slavePtr);
slavePtr->tkwin = NULL;
- ckfree((char *) slavePtr);
+ ckfree(slavePtr);
ComputeGeometry(pwPtr);
}
}
@@ -2286,8 +2286,7 @@ DestroyOptionTables(
ClientData clientData, /* Pointer to the OptionTables struct */
Tcl_Interp *interp) /* Pointer to the calling interp */
{
- ckfree((char *) clientData);
- return;
+ ckfree(clientData);
}
/*
diff --git a/generic/tkPlace.c b/generic/tkPlace.c
index 62ea86d..bce5083 100644
--- a/generic/tkPlace.c
+++ b/generic/tkPlace.c
@@ -394,7 +394,7 @@ CreateSlave(
* populate it with some default values.
*/
- slavePtr = (Slave *) ckalloc(sizeof(Slave));
+ slavePtr = ckalloc(sizeof(Slave));
memset(slavePtr, 0, sizeof(Slave));
slavePtr->tkwin = tkwin;
slavePtr->inTkwin = None;
@@ -429,7 +429,7 @@ FreeSlave(
{
Tk_FreeConfigOptions((char *) slavePtr, slavePtr->optionTable,
slavePtr->tkwin);
- ckfree((char *) slavePtr);
+ ckfree(slavePtr);
}
/*
@@ -540,7 +540,7 @@ CreateMaster(
hPtr = Tcl_CreateHashEntry(&dispPtr->masterTable, (char *) tkwin, &isNew);
if (isNew) {
- masterPtr = (Master *) ckalloc(sizeof(Master));
+ masterPtr = ckalloc(sizeof(Master));
masterPtr->tkwin = tkwin;
masterPtr->slavePtr = NULL;
masterPtr->abortPtr = NULL;
diff --git a/generic/tkSelect.c b/generic/tkSelect.c
index 34fd29b..0834f99 100644
--- a/generic/tkSelect.c
+++ b/generic/tkSelect.c
@@ -141,7 +141,7 @@ Tk_CreateSelHandler(
for (selPtr = winPtr->selHandlerList; ; selPtr = selPtr->nextPtr) {
if (selPtr == NULL) {
- selPtr = (TkSelHandler *) ckalloc(sizeof(TkSelHandler));
+ selPtr = ckalloc(sizeof(TkSelHandler));
selPtr->nextPtr = winPtr->selHandlerList;
winPtr->selHandlerList = selPtr;
break;
@@ -154,7 +154,7 @@ Tk_CreateSelHandler(
*/
if (selPtr->proc == HandleTclCommand) {
- ckfree((char *) selPtr->clientData);
+ ckfree(selPtr->clientData);
}
break;
}
@@ -179,7 +179,7 @@ Tk_CreateSelHandler(
target = winPtr->dispPtr->utf8Atom;
for (selPtr = winPtr->selHandlerList; ; selPtr = selPtr->nextPtr) {
if (selPtr == NULL) {
- selPtr = (TkSelHandler *) ckalloc(sizeof(TkSelHandler));
+ selPtr = ckalloc(sizeof(TkSelHandler));
selPtr->nextPtr = winPtr->selHandlerList;
winPtr->selHandlerList = selPtr;
selPtr->selection = selection;
@@ -322,7 +322,7 @@ Tk_DeleteSelHandler(
((CommandInfo *) selPtr->clientData)->interp = NULL;
Tcl_EventuallyFree(selPtr->clientData, TCL_DYNAMIC);
}
- ckfree((char *) selPtr);
+ ckfree(selPtr);
}
/*
@@ -384,7 +384,7 @@ Tk_OwnSelection(
}
}
if (infoPtr == NULL) {
- infoPtr = (TkSelectionInfo *) ckalloc(sizeof(TkSelectionInfo));
+ infoPtr = ckalloc(sizeof(TkSelectionInfo));
infoPtr->selection = selection;
infoPtr->nextPtr = dispPtr->selectionInfoPtr;
dispPtr->selectionInfoPtr = infoPtr;
@@ -399,7 +399,7 @@ Tk_OwnSelection(
* memory leak.
*/
- ckfree((char *) infoPtr->clearData);
+ ckfree(infoPtr->clearData);
}
}
@@ -492,7 +492,7 @@ Tk_ClearSelection(
if (infoPtr != NULL) {
clearProc = infoPtr->clearProc;
clearData = infoPtr->clearData;
- ckfree((char *) infoPtr);
+ ckfree(infoPtr);
}
XSetSelectionOwner(winPtr->display, selection, None, CurrentTime);
@@ -901,8 +901,8 @@ Tk_SelectionObjCmd(
if (cmdLength == 0) {
Tk_DeleteSelHandler(tkwin, selection, target);
} else {
- cmdInfoPtr = (CommandInfo *) ckalloc((unsigned) (
- (Tk_Offset(CommandInfo, command) + 1) + cmdLength));
+ cmdInfoPtr = ckalloc(Tk_Offset(CommandInfo, command)
+ + 1 + cmdLength);
cmdInfoPtr->interp = interp;
cmdInfoPtr->charOffset = 0;
cmdInfoPtr->byteOffset = 0;
@@ -1004,7 +1004,7 @@ Tk_SelectionObjCmd(
Tk_OwnSelection(tkwin, selection, NULL, NULL);
return TCL_OK;
}
- lostPtr = (LostCommand *) ckalloc(sizeof(LostCommand));
+ lostPtr = ckalloc(sizeof(LostCommand));
lostPtr->interp = interp;
lostPtr->cmdObj = commandObj;
Tcl_IncrRefCount(commandObj);
@@ -1119,7 +1119,7 @@ TkSelDeadWindow(
((CommandInfo *) selPtr->clientData)->interp = NULL;
Tcl_EventuallyFree(selPtr->clientData, TCL_DYNAMIC);
}
- ckfree((char *) selPtr);
+ ckfree(selPtr);
}
/*
@@ -1131,9 +1131,9 @@ TkSelDeadWindow(
nextPtr = infoPtr->nextPtr;
if (infoPtr->owner == (Tk_Window) winPtr) {
if (infoPtr->clearProc == LostSelection) {
- ckfree((char *) infoPtr->clearData);
+ ckfree(infoPtr->clearData);
}
- ckfree((char *) infoPtr);
+ ckfree(infoPtr);
infoPtr = prevPtr;
if (prevPtr == NULL) {
winPtr->dispPtr->selectionInfoPtr = nextPtr;
@@ -1258,7 +1258,7 @@ TkSelClearSelection(
if (infoPtr->clearProc != NULL) {
infoPtr->clearProc(infoPtr->clearData);
}
- ckfree((char *) infoPtr);
+ ckfree(infoPtr);
}
}
@@ -1369,7 +1369,7 @@ HandleTclCommand(
if (spaceNeeded < MAX_STATIC_SIZE) {
command = staticSpace;
} else {
- command = (char *) ckalloc((unsigned) spaceNeeded);
+ command = ckalloc(spaceNeeded);
}
sprintf(command, "%s %d %d", cmdInfoPtr->command, charOffset, maxBytes);
@@ -1597,7 +1597,7 @@ LostSelection(
*/
Tcl_DecrRefCount(lostPtr->cmdObj);
- ckfree((char *) lostPtr);
+ ckfree(lostPtr);
}
/*
diff --git a/generic/tkSquare.c b/generic/tkSquare.c
index 5954474..9bf7ff6 100644
--- a/generic/tkSquare.c
+++ b/generic/tkSquare.c
@@ -162,8 +162,8 @@ SquareObjCmd(
* just the non-NULL/0 items.
*/
- squarePtr = (Square *) ckalloc(sizeof(Square));
- memset((void *) squarePtr, 0, (sizeof(Square)));
+ squarePtr = ckalloc(sizeof(Square));
+ memset(squarePtr, 0, sizeof(Square));
squarePtr->tkwin = tkwin;
squarePtr->display = Tk_Display(tkwin);
@@ -177,7 +177,7 @@ SquareObjCmd(
if (Tk_InitOptions(interp, (char *) squarePtr, optionTable, tkwin)
!= TCL_OK) {
Tk_DestroyWindow(squarePtr->tkwin);
- ckfree((char *) squarePtr);
+ ckfree(squarePtr);
return TCL_ERROR;
}
@@ -560,7 +560,7 @@ SquareDestroy(
{
Square *squarePtr = (Square *) memPtr;
- ckfree((char *) squarePtr);
+ ckfree(squarePtr);
}
/*
diff --git a/generic/tkStyle.c b/generic/tkStyle.c
index fda6f7b..bf683bc 100644
--- a/generic/tkStyle.c
+++ b/generic/tkStyle.c
@@ -255,7 +255,7 @@ TkStylePkgFree(
entryPtr = Tcl_FirstHashEntry(&tsdPtr->styleTable, &search);
while (entryPtr != NULL) {
- ckfree((char *) Tcl_GetHashValue(entryPtr));
+ ckfree(Tcl_GetHashValue(entryPtr));
entryPtr = Tcl_NextHashEntry(&search);
}
Tcl_DeleteHashTable(&tsdPtr->styleTable);
@@ -268,7 +268,7 @@ TkStylePkgFree(
while (entryPtr != NULL) {
enginePtr = Tcl_GetHashValue(entryPtr);
FreeStyleEngine(enginePtr);
- ckfree((char *) enginePtr);
+ ckfree(enginePtr);
entryPtr = Tcl_NextHashEntry(&search);
}
Tcl_DeleteHashTable(&tsdPtr->engineTable);
@@ -281,7 +281,7 @@ TkStylePkgFree(
FreeElement(tsdPtr->elements+i);
}
Tcl_DeleteHashTable(&tsdPtr->elementTable);
- ckfree((char *) tsdPtr->elements);
+ ckfree(tsdPtr->elements);
}
/*
@@ -333,7 +333,7 @@ Tk_RegisterStyleEngine(
* Allocate and intitialize a new engine.
*/
- enginePtr = (StyleEngine *) ckalloc(sizeof(StyleEngine));
+ enginePtr = ckalloc(sizeof(StyleEngine));
InitStyleEngine(enginePtr, Tcl_GetHashKey(&tsdPtr->engineTable, entryPtr),
(StyleEngine *) parent);
Tcl_SetHashValue(entryPtr, enginePtr);
@@ -391,7 +391,7 @@ InitStyleEngine(
*/
if (tsdPtr->nbElements > 0) {
- enginePtr->elements = (StyledElement *) ckalloc(
+ enginePtr->elements = ckalloc(
sizeof(StyledElement) * tsdPtr->nbElements);
for (elementId = 0; elementId < tsdPtr->nbElements; elementId++) {
InitStyledElement(enginePtr->elements+elementId);
@@ -432,7 +432,7 @@ FreeStyleEngine(
for (elementId = 0; elementId < tsdPtr->nbElements; elementId++) {
FreeStyledElement(enginePtr->elements+elementId);
}
- ckfree((char *) enginePtr->elements);
+ ckfree(enginePtr->elements);
}
/*
@@ -580,7 +580,7 @@ FreeStyledElement(
for (i = 0; i < elementPtr->nbWidgetSpecs; i++) {
FreeWidgetSpec(elementPtr->widgetSpecs+i);
}
- ckfree((char *) elementPtr->widgetSpecs);
+ ckfree(elementPtr->widgetSpecs);
}
/*
@@ -644,7 +644,7 @@ CreateElement(
* Reallocate element table.
*/
- tsdPtr->elements = (Element *) ckrealloc((char *) tsdPtr->elements,
+ tsdPtr->elements = ckrealloc(tsdPtr->elements,
sizeof(Element) * tsdPtr->nbElements);
InitElement(tsdPtr->elements+elementId,
Tcl_GetHashKey(&tsdPtr->elementTable, entryPtr), elementId,
@@ -658,8 +658,7 @@ CreateElement(
while (engineEntryPtr != NULL) {
enginePtr = Tcl_GetHashValue(engineEntryPtr);
- enginePtr->elements = (StyledElement *) ckrealloc(
- (char *) enginePtr->elements,
+ enginePtr->elements = ckrealloc(enginePtr->elements,
sizeof(StyledElement) * tsdPtr->nbElements);
InitStyledElement(enginePtr->elements+elementId);
@@ -789,7 +788,7 @@ Tk_RegisterStyledElement(
elementPtr = ((StyleEngine *) engine)->elements+elementId;
- specPtr = (Tk_ElementSpec *) ckalloc(sizeof(Tk_ElementSpec));
+ specPtr = ckalloc(sizeof(Tk_ElementSpec));
specPtr->version = templatePtr->version;
specPtr->name = ckalloc(strlen(templatePtr->name)+1);
strcpy(specPtr->name, templatePtr->name);
@@ -798,7 +797,7 @@ Tk_RegisterStyledElement(
srcOptions->name != NULL; nbOptions++, srcOptions++) {
/* empty body */
}
- specPtr->options = (Tk_ElementOptionSpec *)
+ specPtr->options =
ckalloc(sizeof(Tk_ElementOptionSpec) * (nbOptions+1));
for (srcOptions = templatePtr->options, dstOptions = specPtr->options;
/* End condition within loop */; srcOptions++, dstOptions++) {
@@ -926,7 +925,7 @@ InitWidgetSpec(
* Build the widget option list.
*/
- widgetSpecPtr->optionsPtr = (const Tk_OptionSpec **)
+ widgetSpecPtr->optionsPtr =
ckalloc(sizeof(Tk_OptionSpec *) * nbOptions);
for (i = 0, elementOptionPtr = elementPtr->specPtr->options;
i < nbOptions; i++, elementOptionPtr++) {
@@ -967,7 +966,7 @@ FreeWidgetSpec(
StyledWidgetSpec *widgetSpecPtr)
/* The widget spec to free. */
{
- ckfree((char *) widgetSpecPtr->optionsPtr);
+ ckfree(widgetSpecPtr->optionsPtr);
}
/*
@@ -1011,8 +1010,7 @@ GetWidgetSpec(
*/
i = elementPtr->nbWidgetSpecs++;
- elementPtr->widgetSpecs = (StyledWidgetSpec *) ckrealloc(
- (char *) elementPtr->widgetSpecs,
+ elementPtr->widgetSpecs = ckrealloc(elementPtr->widgetSpecs,
sizeof(StyledWidgetSpec) * elementPtr->nbWidgetSpecs);
widgetSpecPtr = elementPtr->widgetSpecs+i;
InitWidgetSpec(widgetSpecPtr, elementPtr, optionTable);
@@ -1257,7 +1255,7 @@ Tk_CreateStyle(
* Allocate and intitialize a new style.
*/
- stylePtr = (Style *) ckalloc(sizeof(Style));
+ stylePtr = ckalloc(sizeof(Style));
InitStyle(stylePtr, Tcl_GetHashKey(&tsdPtr->styleTable, entryPtr),
(engine!=NULL ? (StyleEngine*) engine : tsdPtr->defaultEnginePtr),
clientData);
diff --git a/generic/tkTest.c b/generic/tkTest.c
index 58093c2..6eee7e0 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -466,7 +466,7 @@ TestdeleteappsCmd(
while (newAppPtr != NULL) {
nextPtr = newAppPtr->nextPtr;
Tcl_DeleteInterp(newAppPtr->interp);
- ckfree((char *) newAppPtr);
+ ckfree(newAppPtr);
newAppPtr = nextPtr;
}
@@ -640,7 +640,7 @@ TestobjconfigObjCmd(
}
Tk_SetClass(tkwin, "Test");
- recordPtr = (TypesRecord *) ckalloc(sizeof(TypesRecord));
+ recordPtr = ckalloc(sizeof(TypesRecord));
recordPtr->header.interp = interp;
recordPtr->header.optionTable = optionTable;
recordPtr->header.tkwin = tkwin;
@@ -675,7 +675,7 @@ TestobjconfigObjCmd(
}
} else {
Tk_DestroyWindow(tkwin);
- ckfree((char *) recordPtr);
+ ckfree(recordPtr);
}
if (result == TCL_OK) {
Tcl_SetObjResult(interp, objv[2]);
@@ -697,8 +697,7 @@ TestobjconfigObjCmd(
optionTable = Tk_CreateOptionTable(interp, baseSpecs);
tables[index] = optionTable;
- recordPtr = (ExtensionWidgetRecord *)
- ckalloc(sizeof(ExtensionWidgetRecord));
+ recordPtr = ckalloc(sizeof(ExtensionWidgetRecord));
recordPtr->header.interp = interp;
recordPtr->header.optionTable = optionTable;
recordPtr->header.tkwin = tkwin;
@@ -750,8 +749,7 @@ TestobjconfigObjCmd(
optionTable = Tk_CreateOptionTable(interp, extensionSpecs);
tables[index] = optionTable;
- recordPtr = (ExtensionWidgetRecord *) ckalloc(
- sizeof(ExtensionWidgetRecord));
+ recordPtr = ckalloc(sizeof(ExtensionWidgetRecord));
recordPtr->header.interp = interp;
recordPtr->header.optionTable = optionTable;
recordPtr->header.tkwin = tkwin;
@@ -916,7 +914,7 @@ TestobjconfigObjCmd(
}
Tk_SetClass(tkwin, "Test");
- recordPtr = (InternalRecord *) ckalloc(sizeof(InternalRecord));
+ recordPtr = ckalloc(sizeof(InternalRecord));
recordPtr->header.interp = interp;
recordPtr->header.optionTable = optionTable;
recordPtr->header.tkwin = tkwin;
@@ -952,7 +950,7 @@ TestobjconfigObjCmd(
}
} else {
Tk_DestroyWindow(tkwin);
- ckfree((char *) recordPtr);
+ ckfree(recordPtr);
}
if (result == TCL_OK) {
Tcl_SetObjResult(interp, objv[2]);
@@ -989,7 +987,7 @@ TestobjconfigObjCmd(
return TCL_ERROR;
}
- recordPtr = (FiveRecord *) ckalloc(sizeof(FiveRecord));
+ recordPtr = ckalloc(sizeof(FiveRecord));
recordPtr->header.interp = interp;
recordPtr->header.optionTable = Tk_CreateOptionTable(interp,
smallSpecs);
@@ -1014,7 +1012,7 @@ TestobjconfigObjCmd(
}
}
if (result != TCL_OK) {
- ckfree((char *) recordPtr);
+ ckfree(recordPtr);
}
break;
@@ -1068,7 +1066,7 @@ TestobjconfigObjCmd(
}
Tk_SetClass(tkwin, "Test");
- recordPtr = (SlaveRecord *) ckalloc(sizeof(SlaveRecord));
+ recordPtr = ckalloc(sizeof(SlaveRecord));
recordPtr->header.interp = interp;
recordPtr->header.optionTable = Tk_CreateOptionTable(interp,
slaveSpecs);
@@ -1096,7 +1094,7 @@ TestobjconfigObjCmd(
}
if (result != TCL_OK) {
Tk_DestroyWindow(tkwin);
- ckfree((char *) recordPtr);
+ ckfree(recordPtr);
}
}
}
@@ -1398,14 +1396,14 @@ ImageCreate(
varName = Tcl_GetString(objv[i+1]);
}
- timPtr = (TImageMaster *) ckalloc(sizeof(TImageMaster));
+ timPtr = ckalloc(sizeof(TImageMaster));
timPtr->master = master;
timPtr->interp = interp;
timPtr->width = 30;
timPtr->height = 15;
- timPtr->imageName = (char *) ckalloc((unsigned) (strlen(name) + 1));
+ timPtr->imageName = ckalloc(strlen(name) + 1);
strcpy(timPtr->imageName, name);
- timPtr->varName = (char *) ckalloc((unsigned) (strlen(varName) + 1));
+ timPtr->varName = ckalloc(strlen(varName) + 1);
strcpy(timPtr->varName, varName);
Tcl_CreateCommand(interp, name, ImageCmd, timPtr, NULL);
*clientDataPtr = timPtr;
@@ -1503,7 +1501,7 @@ ImageGet(
Tcl_SetVar(timPtr->interp, timPtr->varName, buffer,
TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
- instPtr = (TImageInstance *) ckalloc(sizeof(TImageInstance));
+ instPtr = ckalloc(sizeof(TImageInstance));
instPtr->masterPtr = timPtr;
instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000");
gcValues.foreground = instPtr->fg->pixel;
@@ -1594,7 +1592,7 @@ ImageFree(
TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
Tk_FreeColor(instPtr->fg);
Tk_FreeGC(display, instPtr->gc);
- ckfree((char *) instPtr);
+ ckfree(instPtr);
}
/*
@@ -1630,7 +1628,7 @@ ImageDelete(
Tcl_DeleteCommand(timPtr->interp, timPtr->imageName);
ckfree(timPtr->imageName);
ckfree(timPtr->varName);
- ckfree((char *) timPtr);
+ ckfree(timPtr);
}
/*
@@ -2025,7 +2023,7 @@ CustomOptionSet(
if (internalPtr != NULL) {
if ((*value) != NULL) {
string = Tcl_GetStringFromObj((*value), &length);
- newStr = ckalloc((size_t) (length + 1));
+ newStr = ckalloc(length + 1);
strcpy(newStr, string);
} else {
newStr = NULL;
diff --git a/generic/tkText.c b/generic/tkText.c
index 4c4ca20..da41628 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -521,7 +521,7 @@ CreateWidget(
* and 'insert', 'current' mark pointers are all NULL to start.
*/
- textPtr = (TkText *) ckalloc(sizeof(TkText));
+ textPtr = ckalloc(sizeof(TkText));
memset(textPtr, 0, sizeof(TkText));
textPtr->tkwin = newWin;
@@ -532,7 +532,7 @@ CreateWidget(
textPtr, TextCmdDeletedProc);
if (sharedPtr == NULL) {
- sharedPtr = (TkSharedText *) ckalloc(sizeof(TkSharedText));
+ sharedPtr = ckalloc(sizeof(TkSharedText));
memset(sharedPtr, 0, sizeof(TkSharedText));
sharedPtr->refCount = 0;
@@ -630,7 +630,7 @@ CreateWidget(
*/
textPtr->selTagPtr = TkTextCreateTag(textPtr, "sel", NULL);
- textPtr->selTagPtr->reliefString = (char *)
+ textPtr->selTagPtr->reliefString =
ckalloc(sizeof(DEF_TEXT_SELECT_RELIEF));
strcpy(textPtr->selTagPtr->reliefString, DEF_TEXT_SELECT_RELIEF);
Tk_GetRelief(interp, DEF_TEXT_SELECT_RELIEF, &textPtr->selTagPtr->relief);
@@ -1115,8 +1115,7 @@ TextWidgetObjCmd(
objc -= 2;
objv += 2;
- indices = (TkTextIndex *)
- ckalloc((objc + 1) * sizeof(TkTextIndex));
+ indices = ckalloc((objc + 1) * sizeof(TkTextIndex));
/*
* First pass verifies that all indices are valid.
@@ -1128,7 +1127,7 @@ TextWidgetObjCmd(
if (indexPtr == NULL) {
result = TCL_ERROR;
- ckfree((char *) indices);
+ ckfree(indices);
goto done;
}
indices[i] = *indexPtr;
@@ -1144,7 +1143,7 @@ TextWidgetObjCmd(
COUNT_INDICES);
objc++;
}
- useIdx = (char *) ckalloc((unsigned) objc);
+ useIdx = ckalloc(objc);
memset(useIdx, 0, (unsigned) objc);
/*
@@ -1208,7 +1207,7 @@ TextWidgetObjCmd(
&indices[i+1], 1);
}
}
- ckfree((char *) indices);
+ ckfree(indices);
}
}
break;
@@ -1516,7 +1515,7 @@ TextWidgetObjCmd(
done:
textPtr->refCount--;
if (textPtr->refCount == 0) {
- ckfree((char *) textPtr);
+ ckfree(textPtr);
}
return result;
}
@@ -1891,10 +1890,10 @@ DestroyText(
TkTextDeleteTag(textPtr, textPtr->selTagPtr);
TkBTreeUnlinkSegment(textPtr->insertMarkPtr,
textPtr->insertMarkPtr->body.mark.linePtr);
- ckfree((char *) textPtr->insertMarkPtr);
+ ckfree(textPtr->insertMarkPtr);
TkBTreeUnlinkSegment(textPtr->currentMarkPtr,
textPtr->currentMarkPtr->body.mark.linePtr);
- ckfree((char *) textPtr->currentMarkPtr);
+ ckfree(textPtr->currentMarkPtr);
/*
* Now we've cleaned up everything of relevance to us in the B-tree, so we
@@ -1960,7 +1959,7 @@ DestroyText(
Tcl_DeleteHashTable(&sharedTextPtr->tagTable);
for (hPtr = Tcl_FirstHashEntry(&sharedTextPtr->markTable, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- ckfree((char *) Tcl_GetHashValue(hPtr));
+ ckfree(Tcl_GetHashValue(hPtr));
}
Tcl_DeleteHashTable(&sharedTextPtr->markTable);
TkUndoFreeStack(sharedTextPtr->undoStack);
@@ -1971,11 +1970,11 @@ DestroyText(
if (sharedTextPtr->bindingTable != NULL) {
Tk_DeleteBindingTable(sharedTextPtr->bindingTable);
}
- ckfree((char *) sharedTextPtr);
+ ckfree(sharedTextPtr);
}
if (textPtr->tabArrayPtr != NULL) {
- ckfree((char *) textPtr->tabArrayPtr);
+ ckfree(textPtr->tabArrayPtr);
}
if (textPtr->insertBlinkHandler != NULL) {
Tcl_DeleteTimerHandler(textPtr->insertBlinkHandler);
@@ -1985,7 +1984,7 @@ DestroyText(
textPtr->refCount--;
Tcl_DeleteCommandFromToken(textPtr->interp, textPtr->widgetCmd);
if (textPtr->refCount == 0) {
- ckfree((char *) textPtr);
+ ckfree(textPtr);
}
}
@@ -2142,7 +2141,7 @@ ConfigureText(
*/
if (textPtr->tabArrayPtr != NULL) {
- ckfree((char *) textPtr->tabArrayPtr);
+ ckfree(textPtr->tabArrayPtr);
textPtr->tabArrayPtr = NULL;
}
if (textPtr->tabOptionPtr != NULL) {
@@ -2550,8 +2549,7 @@ InsertChars(
resetViewCount = 0;
if (sharedTextPtr->refCount > PIXEL_CLIENTS) {
- lineAndByteIndex = (int *)
- ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount);
+ lineAndByteIndex = ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount);
} else {
lineAndByteIndex = pixels;
}
@@ -2613,7 +2611,7 @@ InsertChars(
resetViewCount += 2;
}
if (sharedTextPtr->refCount > PIXEL_CLIENTS) {
- ckfree((char *) lineAndByteIndex);
+ ckfree(lineAndByteIndex);
}
/*
@@ -3009,7 +3007,7 @@ DeleteIndexRange(
for (i = 0; i < arraySize; i++) {
TkBTreeTag(&index2, &oldIndex2, arrayPtr[i], 0);
}
- ckfree((char *) arrayPtr);
+ ckfree(arrayPtr);
}
}
@@ -3063,8 +3061,7 @@ DeleteIndexRange(
resetViewCount = 0;
if (sharedTextPtr->refCount > PIXEL_CLIENTS) {
- lineAndByteIndex = (int *)
- ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount);
+ lineAndByteIndex = ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount);
} else {
lineAndByteIndex = pixels;
}
@@ -3166,7 +3163,7 @@ DeleteIndexRange(
resetViewCount += 2;
}
if (sharedTextPtr->refCount > PIXEL_CLIENTS) {
- ckfree((char *) lineAndByteIndex);
+ ckfree(lineAndByteIndex);
}
if (line1 >= line2) {
@@ -3552,7 +3549,7 @@ TextInsertCmd(
for (i = 0; i < numTags; i++) {
TkBTreeTag(&index1, &index2, oldTagArrayPtr[i], 0);
}
- ckfree((char *) oldTagArrayPtr);
+ ckfree(oldTagArrayPtr);
}
if (Tcl_ListObjGetElements(interp, objv[j+1], &numTags,
&tagNamePtrs) != TCL_OK) {
@@ -4327,8 +4324,8 @@ TkTextGetTabs(
* Parse the elements of the list one at a time to fill in the array.
*/
- tabArrayPtr = (TkTextTabArray *) ckalloc((unsigned)
- (sizeof(TkTextTabArray) + (count-1)*sizeof(TkTextTab)));
+ tabArrayPtr = ckalloc(sizeof(TkTextTabArray)
+ + (count - 1) * sizeof(TkTextTab));
tabArrayPtr->numTabs = 0;
prevStop = 0.0;
lastStop = 0.0;
@@ -4427,7 +4424,7 @@ TkTextGetTabs(
return tabArrayPtr;
error:
- ckfree((char *) tabArrayPtr);
+ ckfree(tabArrayPtr);
return NULL;
}
@@ -4690,7 +4687,7 @@ DumpLine(
*/
int length = last - first;
- char *range = ckalloc((length + 1) * sizeof(char));
+ char *range = ckalloc(length + 1);
memcpy(range, segPtr->body.chars + first,
length * sizeof(char));
@@ -6170,13 +6167,13 @@ SearchCore(
* matches on the heap.
*/
- int *newArray = (int *)
+ int *newArray =
ckalloc(4 * matchNum * sizeof(int));
memcpy(newArray, storeMatch, matchNum*sizeof(int));
memcpy(newArray + 2*matchNum, storeLength,
matchNum * sizeof(int));
if (storeMatch != smArray) {
- ckfree((char *) storeMatch);
+ ckfree(storeMatch);
}
matchNum *= 2;
storeMatch = newArray;
@@ -6406,7 +6403,7 @@ SearchCore(
*/
if (storeMatch != smArray) {
- ckfree((char *) storeMatch);
+ ckfree(storeMatch);
}
return code;
diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c
index cd1da60..ab529a7 100644
--- a/generic/tkTextBTree.c
+++ b/generic/tkTextBTree.c
@@ -275,9 +275,9 @@ TkBTreeCreate(
* of the tree.
*/
- rootPtr = (Node *) ckalloc(sizeof(Node));
- linePtr = (TkTextLine *) ckalloc(sizeof(TkTextLine));
- linePtr2 = (TkTextLine *) ckalloc(sizeof(TkTextLine));
+ rootPtr = ckalloc(sizeof(Node));
+ linePtr = ckalloc(sizeof(TkTextLine));
+ linePtr2 = ckalloc(sizeof(TkTextLine));
rootPtr->parentPtr = NULL;
rootPtr->nextPtr = NULL;
@@ -298,7 +298,7 @@ TkBTreeCreate(
linePtr->parentPtr = rootPtr;
linePtr->nextPtr = linePtr2;
- segPtr = (TkTextSegment *) ckalloc(CSEG_SIZE(1));
+ segPtr = ckalloc(CSEG_SIZE(1));
linePtr->segPtr = segPtr;
segPtr->typePtr = &tkTextCharType;
segPtr->nextPtr = NULL;
@@ -308,7 +308,7 @@ TkBTreeCreate(
linePtr2->parentPtr = rootPtr;
linePtr2->nextPtr = NULL;
- segPtr = (TkTextSegment *) ckalloc(CSEG_SIZE(1));
+ segPtr = ckalloc(CSEG_SIZE(1));
linePtr2->segPtr = segPtr;
segPtr->typePtr = &tkTextCharType;
segPtr->nextPtr = NULL;
@@ -316,7 +316,7 @@ TkBTreeCreate(
segPtr->body.chars[0] = '\n';
segPtr->body.chars[1] = 0;
- treePtr = (BTree *) ckalloc(sizeof(BTree));
+ treePtr = ckalloc(sizeof(BTree));
treePtr->sharedTextPtr = sharedTextPtr;
treePtr->rootPtr = rootPtr;
treePtr->clients = 0;
@@ -480,10 +480,10 @@ TkBTreeDestroy(
DestroyNode(treePtr->rootPtr);
if (treePtr->startEnd != NULL) {
- ckfree((char *) treePtr->startEnd);
- ckfree((char *) treePtr->startEndRef);
+ ckfree(treePtr->startEnd);
+ ckfree(treePtr->startEndRef);
}
- ckfree((char *) treePtr);
+ ckfree(treePtr);
}
/*
@@ -545,7 +545,7 @@ TkBTreeRemoveClient(
*/
DestroyNode(treePtr->rootPtr);
- ckfree((char *) treePtr);
+ ckfree(treePtr);
return;
} else if (pixelReference == -1) {
/*
@@ -634,11 +634,9 @@ AdjustStartEndRefs(
i++;
}
treePtr->startEndCount = count;
- treePtr->startEnd = (TkTextLine **)
- ckrealloc((char *) treePtr->startEnd,
+ treePtr->startEnd = ckrealloc(treePtr->startEnd,
sizeof(TkTextLine *) * count);
- treePtr->startEndRef = (TkText **)
- ckrealloc((char *) treePtr->startEndRef,
+ treePtr->startEndRef = ckrealloc(treePtr->startEndRef,
sizeof(TkText *) * count);
}
if ((action & TEXT_ADD_REFS)
@@ -654,11 +652,9 @@ AdjustStartEndRefs(
count = treePtr->startEndCount;
- treePtr->startEnd = (TkTextLine **)
- ckrealloc((char *) treePtr->startEnd,
+ treePtr->startEnd = ckrealloc(treePtr->startEnd,
sizeof(TkTextLine *) * count);
- treePtr->startEndRef = (TkText **)
- ckrealloc((char *) treePtr->startEndRef,
+ treePtr->startEndRef = ckrealloc(treePtr->startEndRef,
sizeof(TkText *) * count);
if (textPtr->start != NULL) {
@@ -741,7 +737,7 @@ AdjustPixelClient(
*counting = 0;
}
if (newPixelReferences != treePtr->pixelReferences) {
- linePtr->pixels = (int *) ckrealloc((char *) linePtr->pixels,
+ linePtr->pixels = ckrealloc(linePtr->pixels,
sizeof(int) * 2 * newPixelReferences);
}
@@ -758,7 +754,7 @@ AdjustPixelClient(
}
}
if (newPixelReferences != treePtr->pixelReferences) {
- nodePtr->numPixels = (int *) ckrealloc((char *) nodePtr->numPixels,
+ nodePtr->numPixels = ckrealloc(nodePtr->numPixels,
sizeof(int) * newPixelReferences);
}
nodePtr->numPixels[useReference] = pixelCount;
@@ -807,7 +803,7 @@ RemovePixelClient(
if (treePtr->pixelReferences == 1) {
nodePtr->numPixels = NULL;
} else {
- nodePtr->numPixels = (int *) ckrealloc((char *) nodePtr->numPixels,
+ nodePtr->numPixels = ckrealloc(nodePtr->numPixels,
sizeof(int) * (treePtr->pixelReferences - 1));
}
if (nodePtr->level != 0) {
@@ -828,7 +824,7 @@ RemovePixelClient(
if (treePtr->pixelReferences == 1) {
linePtr->pixels = NULL;
} else {
- linePtr->pixels = (int *) ckrealloc((char *) linePtr->pixels,
+ linePtr->pixels = ckrealloc(linePtr->pixels,
sizeof(int) * 2 * (treePtr->pixelReferences-1));
}
linePtr = linePtr->nextPtr;
@@ -869,8 +865,8 @@ DestroyNode(
linePtr->segPtr = segPtr->nextPtr;
segPtr->typePtr->deleteProc(segPtr, linePtr, 1);
}
- ckfree((char *) linePtr->pixels);
- ckfree((char *) linePtr);
+ ckfree(linePtr->pixels);
+ ckfree(linePtr);
}
} else {
register Node *childPtr;
@@ -882,8 +878,8 @@ DestroyNode(
}
}
DeleteSummaries(nodePtr->summaryPtr);
- ckfree((char *) nodePtr->numPixels);
- ckfree((char *) nodePtr);
+ ckfree(nodePtr->numPixels);
+ ckfree(nodePtr);
}
/*
@@ -912,7 +908,7 @@ DeleteSummaries(
while (summaryPtr != NULL) {
nextPtr = summaryPtr->nextPtr;
- ckfree((char *) summaryPtr);
+ ckfree(summaryPtr);
summaryPtr = nextPtr;
}
}
@@ -1049,8 +1045,7 @@ TkBTreeInsertChars(
changeToLineCount = 0;
if (treePtr->pixelReferences > PIXEL_CLIENTS) {
- changeToPixelCount = (int *)
- ckalloc(sizeof(int) * treePtr->pixelReferences);
+ changeToPixelCount = ckalloc(sizeof(int) * treePtr->pixelReferences);
} else {
changeToPixelCount = pixels;
}
@@ -1066,7 +1061,7 @@ TkBTreeInsertChars(
}
}
chunkSize = eol-string;
- segPtr = (TkTextSegment *) ckalloc(CSEG_SIZE(chunkSize));
+ segPtr = ckalloc(CSEG_SIZE(chunkSize));
segPtr->typePtr = &tkTextCharType;
if (curPtr == NULL) {
segPtr->nextPtr = linePtr->segPtr;
@@ -1088,8 +1083,8 @@ TkBTreeInsertChars(
* the remainder of the old line to it.
*/
- newLinePtr = (TkTextLine *) ckalloc(sizeof(TkTextLine));
- newLinePtr->pixels = (int *)
+ newLinePtr = ckalloc(sizeof(TkTextLine));
+ newLinePtr->pixels =
ckalloc(sizeof(int) * 2 * treePtr->pixelReferences);
newLinePtr->parentPtr = linePtr->parentPtr;
@@ -1149,7 +1144,7 @@ TkBTreeInsertChars(
}
}
if (treePtr->pixelReferences > PIXEL_CLIENTS) {
- ckfree((char *) changeToPixelCount);
+ ckfree(changeToPixelCount);
}
nodePtr = linePtr->parentPtr;
@@ -1421,8 +1416,8 @@ TkBTreeDeleteIndexRange(
checkCount++;
}
}
- ckfree((char *) curLinePtr->pixels);
- ckfree((char *) curLinePtr);
+ ckfree(curLinePtr->pixels);
+ ckfree(curLinePtr);
}
curLinePtr = nextLinePtr;
segPtr = curLinePtr->segPtr;
@@ -1446,7 +1441,7 @@ TkBTreeDeleteIndexRange(
prevNodePtr->nextPtr = curNodePtr->nextPtr;
}
parentPtr->numChildren--;
- ckfree((char *) curNodePtr);
+ ckfree(curNodePtr);
curNodePtr = parentPtr;
}
curNodePtr = curLinePtr->parentPtr;
@@ -1541,8 +1536,8 @@ TkBTreeDeleteIndexRange(
checkCount++;
}
}
- ckfree((char *) index2Ptr->linePtr->pixels);
- ckfree((char *) index2Ptr->linePtr);
+ ckfree(index2Ptr->linePtr->pixels);
+ ckfree(index2Ptr->linePtr);
Rebalance((BTree *) index2Ptr->tree, curNodePtr);
}
@@ -2137,7 +2132,7 @@ TkBTreeTag(
oldState = TkBTreeCharTagged(index1Ptr, tagPtr);
if ((add != 0) ^ oldState) {
- segPtr = (TkTextSegment *) ckalloc(TSEG_SIZE);
+ segPtr = ckalloc(TSEG_SIZE);
segPtr->typePtr = (add) ? &tkTextToggleOnType : &tkTextToggleOffType;
prevPtr = SplitSeg(index1Ptr);
if (prevPtr == NULL) {
@@ -2182,7 +2177,7 @@ TkBTreeTag(
} else {
changed = 0;
}
- ckfree((char *) segPtr);
+ ckfree(segPtr);
/*
* The code below is a bit tricky. After deleting a toggle we
@@ -2208,7 +2203,7 @@ TkBTreeTag(
}
}
if ((add != 0) ^ oldState) {
- segPtr = (TkTextSegment *) ckalloc(TSEG_SIZE);
+ segPtr = ckalloc(TSEG_SIZE);
segPtr->typePtr = (add) ? &tkTextToggleOffType : &tkTextToggleOnType;
prevPtr = SplitSeg(index2Ptr);
if (prevPtr == NULL) {
@@ -2333,7 +2328,7 @@ ChangeNodeToggleCount(
} else {
prevPtr->nextPtr = summaryPtr->nextPtr;
}
- ckfree((char *) summaryPtr);
+ ckfree(summaryPtr);
} else {
/*
* This tag isn't currently in the summary information list.
@@ -2352,7 +2347,7 @@ ChangeNodeToggleCount(
Node *rootNodePtr = tagPtr->tagRootPtr;
- summaryPtr = (Summary *) ckalloc(sizeof(Summary));
+ summaryPtr = ckalloc(sizeof(Summary));
summaryPtr->tagPtr = tagPtr;
summaryPtr->toggleCount = tagPtr->toggleCount - delta;
summaryPtr->nextPtr = rootNodePtr->summaryPtr;
@@ -2361,7 +2356,7 @@ ChangeNodeToggleCount(
rootLevel = rootNodePtr->level;
tagPtr->tagRootPtr = rootNodePtr;
}
- summaryPtr = (Summary *) ckalloc(sizeof(Summary));
+ summaryPtr = ckalloc(sizeof(Summary));
summaryPtr->tagPtr = tagPtr;
summaryPtr->toggleCount = delta;
summaryPtr->nextPtr = nodePtr->summaryPtr;
@@ -2418,7 +2413,7 @@ ChangeNodeToggleCount(
} else {
prevPtr->nextPtr = summaryPtr->nextPtr;
}
- ckfree((char *) summaryPtr);
+ ckfree(summaryPtr);
tagPtr->tagRootPtr = node2Ptr;
break;
}
@@ -3337,10 +3332,8 @@ TkBTreeGetTags(
tagInfo.numTags = 0;
tagInfo.arraySize = NUM_TAG_INFOS;
- tagInfo.tagPtrs = (TkTextTag **)
- ckalloc((unsigned) NUM_TAG_INFOS * sizeof(TkTextTag *));
- tagInfo.counts = (int *)
- ckalloc((unsigned) NUM_TAG_INFOS * sizeof(int));
+ tagInfo.tagPtrs = ckalloc(NUM_TAG_INFOS * sizeof(TkTextTag *));
+ tagInfo.counts = ckalloc(NUM_TAG_INFOS * sizeof(int));
/*
* Record tag toggles within the line of indexPtr but preceding indexPtr.
@@ -3425,9 +3418,9 @@ TkBTreeGetTags(
}
}
*numTagsPtr = dst;
- ckfree((char *) tagInfo.counts);
+ ckfree(tagInfo.counts);
if (dst == 0) {
- ckfree((char *) tagInfo.tagPtrs);
+ ckfree(tagInfo.tagPtrs);
return NULL;
}
return tagInfo.tagPtrs;
@@ -3484,8 +3477,7 @@ TkTextIsElided(
int elide;
if (elideInfo == NULL) {
- infoPtr = (TkTextElideInfo *)
- ckalloc((unsigned) sizeof(TkTextElideInfo));
+ infoPtr = ckalloc(sizeof(TkTextElideInfo));
} else {
infoPtr = elideInfo;
}
@@ -3500,10 +3492,8 @@ TkTextIsElided(
*/
if (LOTSA_TAGS < infoPtr->numTags) {
- infoPtr->tagCnts = (int *)
- ckalloc((unsigned) sizeof(int) * infoPtr->numTags);
- infoPtr->tagPtrs = (TkTextTag **)
- ckalloc((unsigned) sizeof(TkTextTag *) * infoPtr->numTags);
+ infoPtr->tagCnts = ckalloc(sizeof(int) * infoPtr->numTags);
+ infoPtr->tagPtrs = ckalloc(sizeof(TkTextTag *) * infoPtr->numTags);
}
for (i=0; i<infoPtr->numTags; i++) {
@@ -3632,11 +3622,11 @@ TkTextIsElided(
if (elideInfo == NULL) {
if (LOTSA_TAGS < infoPtr->numTags) {
- ckfree((char *) infoPtr->tagCnts);
- ckfree((char *) infoPtr->tagPtrs);
+ ckfree(infoPtr->tagCnts);
+ ckfree(infoPtr->tagPtrs);
}
- ckfree((char *) infoPtr);
+ ckfree(infoPtr);
}
return elide;
@@ -3665,8 +3655,8 @@ TkTextFreeElideInfo(
* structure. */
{
if (LOTSA_TAGS < elideInfo->numTags) {
- ckfree((char *) elideInfo->tagCnts);
- ckfree((char *) elideInfo->tagPtrs);
+ ckfree(elideInfo->tagCnts);
+ ckfree(elideInfo->tagPtrs);
}
}
@@ -3717,16 +3707,15 @@ IncCount(
int *newCounts, newSize;
newSize = 2 * tagInfoPtr->arraySize;
- newTags = (TkTextTag **)
- ckalloc((unsigned) newSize * sizeof(TkTextTag *));
+ newTags = ckalloc(newSize * sizeof(TkTextTag *));
memcpy(newTags, tagInfoPtr->tagPtrs,
tagInfoPtr->arraySize * sizeof(TkTextTag *));
- ckfree((char *) tagInfoPtr->tagPtrs);
+ ckfree(tagInfoPtr->tagPtrs);
tagInfoPtr->tagPtrs = newTags;
- newCounts = (int *) ckalloc((unsigned) newSize * sizeof(int));
+ newCounts = ckalloc(newSize * sizeof(int));
memcpy(newCounts, tagInfoPtr->counts,
tagInfoPtr->arraySize * sizeof(int));
- ckfree((char *) tagInfoPtr->counts);
+ ckfree(tagInfoPtr->counts);
tagInfoPtr->counts = newCounts;
tagInfoPtr->arraySize = newSize;
}
@@ -3926,7 +3915,7 @@ CheckNodeConsistency(
numChildren = 0;
numLines = 0;
if (references > PIXEL_CLIENTS) {
- numPixels = (int *) ckalloc(sizeof(int) * references);
+ numPixels = ckalloc(sizeof(int) * references);
} else {
numPixels = pixels;
}
@@ -4015,7 +4004,7 @@ CheckNodeConsistency(
}
}
if (references > PIXEL_CLIENTS) {
- ckfree((char *) numPixels);
+ ckfree(numPixels);
}
for (summaryPtr = nodePtr->summaryPtr; summaryPtr != NULL;
@@ -4114,7 +4103,7 @@ Rebalance(
*/
if (nodePtr->parentPtr == NULL) {
- newPtr = (Node *) ckalloc(sizeof(Node));
+ newPtr = ckalloc(sizeof(Node));
newPtr->parentPtr = NULL;
newPtr->nextPtr = NULL;
newPtr->summaryPtr = NULL;
@@ -4122,7 +4111,7 @@ Rebalance(
newPtr->children.nodePtr = nodePtr;
newPtr->numChildren = 1;
newPtr->numLines = nodePtr->numLines;
- newPtr->numPixels = (int *)
+ newPtr->numPixels =
ckalloc(sizeof(int) * treePtr->pixelReferences);
for (i=0; i<treePtr->pixelReferences; i++) {
newPtr->numPixels[i] = nodePtr->numPixels[i];
@@ -4130,8 +4119,8 @@ Rebalance(
RecomputeNodeCounts(treePtr, newPtr);
treePtr->rootPtr = newPtr;
}
- newPtr = (Node *) ckalloc(sizeof(Node));
- newPtr->numPixels = (int *)
+ newPtr = ckalloc(sizeof(Node));
+ newPtr->numPixels =
ckalloc(sizeof(int) * treePtr->pixelReferences);
for (i=0; i<treePtr->pixelReferences; i++) {
newPtr->numPixels[i] = 0;
@@ -4188,7 +4177,7 @@ Rebalance(
treePtr->rootPtr = nodePtr->children.nodePtr;
treePtr->rootPtr->parentPtr = NULL;
DeleteSummaries(nodePtr->summaryPtr);
- ckfree((char *) nodePtr);
+ ckfree(nodePtr);
}
return;
}
@@ -4277,7 +4266,7 @@ Rebalance(
nodePtr->nextPtr = otherPtr->nextPtr;
nodePtr->parentPtr->numChildren--;
DeleteSummaries(otherPtr->summaryPtr);
- ckfree((char *) otherPtr);
+ ckfree(otherPtr);
continue;
}
@@ -4375,7 +4364,7 @@ RecomputeNodeCounts(
for (summaryPtr = nodePtr->summaryPtr; ;
summaryPtr = summaryPtr->nextPtr) {
if (summaryPtr == NULL) {
- summaryPtr = (Summary *) ckalloc(sizeof(Summary));
+ summaryPtr = ckalloc(sizeof(Summary));
summaryPtr->tagPtr = tagPtr;
summaryPtr->toggleCount = 1;
summaryPtr->nextPtr = nodePtr->summaryPtr;
@@ -4403,7 +4392,7 @@ RecomputeNodeCounts(
for (summaryPtr = nodePtr->summaryPtr; ;
summaryPtr = summaryPtr->nextPtr) {
if (summaryPtr == NULL) {
- summaryPtr = (Summary *) ckalloc(sizeof(Summary));
+ summaryPtr = ckalloc(sizeof(Summary));
summaryPtr->tagPtr = summaryPtr2->tagPtr;
summaryPtr->toggleCount = summaryPtr2->toggleCount;
summaryPtr->nextPtr = nodePtr->summaryPtr;
@@ -4452,11 +4441,11 @@ RecomputeNodeCounts(
}
if (summaryPtr2 != NULL) {
summaryPtr2->nextPtr = summaryPtr->nextPtr;
- ckfree((char *) summaryPtr);
+ ckfree(summaryPtr);
summaryPtr = summaryPtr2->nextPtr;
} else {
nodePtr->summaryPtr = summaryPtr->nextPtr;
- ckfree((char *) summaryPtr);
+ ckfree(summaryPtr);
summaryPtr = nodePtr->summaryPtr;
}
}
@@ -4556,9 +4545,8 @@ CharSplitProc(
{
TkTextSegment *newPtr1, *newPtr2;
- newPtr1 = (TkTextSegment *) ckalloc(CSEG_SIZE(index));
- newPtr2 = (TkTextSegment *) ckalloc(
- CSEG_SIZE(segPtr->size - index));
+ newPtr1 = ckalloc(CSEG_SIZE(index));
+ newPtr2 = ckalloc(CSEG_SIZE(segPtr->size - index));
newPtr1->typePtr = &tkTextCharType;
newPtr1->nextPtr = newPtr2;
newPtr1->size = index;
@@ -4568,7 +4556,7 @@ CharSplitProc(
newPtr2->nextPtr = segPtr->nextPtr;
newPtr2->size = segPtr->size - index;
strcpy(newPtr2->body.chars, segPtr->body.chars + index);
- ckfree((char *) segPtr);
+ ckfree(segPtr);
return newPtr1;
}
@@ -4603,15 +4591,14 @@ CharCleanupProc(
if ((segPtr2 == NULL) || (segPtr2->typePtr != &tkTextCharType)) {
return segPtr;
}
- newPtr = (TkTextSegment *) ckalloc(CSEG_SIZE(
- segPtr->size + segPtr2->size));
+ newPtr = ckalloc(CSEG_SIZE(segPtr->size + segPtr2->size));
newPtr->typePtr = &tkTextCharType;
newPtr->nextPtr = segPtr2->nextPtr;
newPtr->size = segPtr->size + segPtr2->size;
strcpy(newPtr->body.chars, segPtr->body.chars);
strcpy(newPtr->body.chars + segPtr->size, segPtr2->body.chars);
- ckfree((char *) segPtr);
- ckfree((char *) segPtr2);
+ ckfree(segPtr);
+ ckfree(segPtr2);
return newPtr;
}
@@ -4640,7 +4627,7 @@ CharDeleteProc(
* deleted, so everything must get cleaned
* up. */
{
- ckfree((char *) segPtr);
+ ckfree(segPtr);
return 0;
}
@@ -4716,7 +4703,7 @@ ToggleDeleteProc(
* up. */
{
if (treeGone) {
- ckfree((char *) segPtr);
+ ckfree(segPtr);
return 0;
}
@@ -4790,9 +4777,9 @@ ToggleCleanupProc(
segPtr->body.toggle.tagPtr, -counts);
}
prevPtr->nextPtr = segPtr2->nextPtr;
- ckfree((char *) segPtr2);
+ ckfree(segPtr2);
segPtr2 = segPtr->nextPtr;
- ckfree((char *) segPtr);
+ ckfree(segPtr);
return segPtr2;
}
}
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 849123f..b287a94 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -626,7 +626,7 @@ TkTextCreateDInfo(
register TextDInfo *dInfoPtr;
XGCValues gcValues;
- dInfoPtr = (TextDInfo *) ckalloc(sizeof(TextDInfo));
+ dInfoPtr = ckalloc(sizeof(TextDInfo));
Tcl_InitHashTable(&dInfoPtr->styleTable, sizeof(StyleValues)/sizeof(int));
dInfoPtr->dLinePtr = NULL;
dInfoPtr->copyGC = None;
@@ -719,7 +719,7 @@ TkTextFreeDInfo(
textPtr->refCount--;
dInfoPtr->scrollbarTimer = NULL;
}
- ckfree((char *) dInfoPtr);
+ ckfree(dInfoPtr);
}
/*
@@ -923,7 +923,7 @@ GetStyle(
}
}
if (tagPtrs != NULL) {
- ckfree((char *) tagPtrs);
+ ckfree(tagPtrs);
}
/*
@@ -942,7 +942,7 @@ GetStyle(
* No existing style matched. Make a new one.
*/
- stylePtr = (TextStyle *) ckalloc(sizeof(TextStyle));
+ stylePtr = ckalloc(sizeof(TextStyle));
stylePtr->refCount = 1;
if (styleValues.border != NULL) {
gcValues.foreground = Tk_3DBorderColor(styleValues.border)->pixel;
@@ -1007,7 +1007,7 @@ FreeStyle(
Tk_FreeGC(textPtr->display, stylePtr->fgGC);
}
Tcl_DeleteHashEntry(stylePtr->hPtr);
- ckfree((char *) stylePtr);
+ ckfree(stylePtr);
}
}
@@ -1106,7 +1106,7 @@ LayoutDLine(
* Create and initialize a new DLine structure.
*/
- dlPtr = (DLine *) ckalloc(sizeof(DLine));
+ dlPtr = ckalloc(sizeof(DLine));
dlPtr->index = *indexPtr;
dlPtr->byteCount = 0;
dlPtr->y = 0;
@@ -1337,7 +1337,7 @@ LayoutDLine(
* into a single display line.
*
if (segPtr == NULL && chunkPtr != NULL) {
- ckfree((char *) chunkPtr);
+ ckfree(chunkPtr);
chunkPtr = NULL;
}
*/
@@ -1351,7 +1351,7 @@ LayoutDLine(
continue;
}
if (chunkPtr == NULL) {
- chunkPtr = (TkTextDispChunk *) ckalloc(sizeof(TkTextDispChunk));
+ chunkPtr = ckalloc(sizeof(TkTextDispChunk));
chunkPtr->nextPtr = NULL;
chunkPtr->clientData = NULL;
}
@@ -1483,7 +1483,7 @@ LayoutDLine(
*/
if (chunkPtr != NULL) {
- ckfree((char *) chunkPtr);
+ ckfree(chunkPtr);
}
break;
}
@@ -1614,7 +1614,7 @@ LayoutDLine(
if (chunkPtr->undisplayProc != NULL) {
chunkPtr->undisplayProc(textPtr, chunkPtr);
}
- ckfree((char *) chunkPtr);
+ ckfree(chunkPtr);
}
if (breakByteOffset != breakChunkPtr->numBytes) {
if (breakChunkPtr->undisplayProc != NULL) {
@@ -2311,9 +2311,9 @@ FreeDLines(
}
FreeStyle(textPtr, chunkPtr->stylePtr);
nextChunkPtr = chunkPtr->nextPtr;
- ckfree((char *) chunkPtr);
+ ckfree(chunkPtr);
}
- ckfree((char *) firstPtr);
+ ckfree(firstPtr);
firstPtr = nextDLinePtr;
}
if (action != DLINE_FREE_TEMP) {
@@ -2891,7 +2891,7 @@ AsyncUpdateLineMetrics(
*/
if (--textPtr->refCount == 0) {
- ckfree((char *) textPtr);
+ ckfree(textPtr);
}
return;
}
@@ -2943,7 +2943,7 @@ AsyncUpdateLineMetrics(
textPtr->refCount--;
if (textPtr->refCount == 0) {
- ckfree((char *) textPtr);
+ ckfree(textPtr);
}
return;
}
@@ -3954,7 +3954,7 @@ DisplayText(
dInfoPtr->flags &= ~REPICK_NEEDED;
TkTextPickCurrent(textPtr, &textPtr->pickEvent);
if (--textPtr->refCount == 0) {
- ckfree((char *) textPtr);
+ ckfree(textPtr);
goto end;
}
if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) {
@@ -6387,7 +6387,7 @@ AsyncUpdateYScrollbar(
}
if (--textPtr->refCount == 0) {
- ckfree((char *) textPtr);
+ ckfree(textPtr);
}
}
@@ -7072,7 +7072,7 @@ TkTextCharLayoutProc(
#if TK_LAYOUT_WITH_BASE_CHUNKS
if (baseCharChunkPtr == NULL) {
baseCharChunkPtr = chunkPtr;
- bciPtr = (BaseCharInfo *) ckalloc(sizeof(BaseCharInfo));
+ bciPtr = ckalloc(sizeof(BaseCharInfo));
baseString = &bciPtr->baseChars;
Tcl_DStringInit(baseString);
bciPtr->width = 0;
@@ -7080,7 +7080,7 @@ TkTextCharLayoutProc(
ciPtr = &bciPtr->ci;
} else {
bciPtr = baseCharChunkPtr->clientData;
- ciPtr = (CharInfo *) ckalloc(sizeof(CharInfo));
+ ciPtr = ckalloc(sizeof(CharInfo));
baseString = &bciPtr->baseChars;
}
@@ -7143,7 +7143,7 @@ TkTextCharLayoutProc(
} else {
Tcl_DStringSetLength(baseString,lineOffset);
}
- ckfree((char *) ciPtr);
+ ckfree(ciPtr);
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
return 0;
}
@@ -7169,8 +7169,7 @@ TkTextCharLayoutProc(
chunkPtr->breakIndex = -1;
#if !TK_LAYOUT_WITH_BASE_CHUNKS
- ciPtr = (CharInfo *)
- ckalloc((unsigned) ((Tk_Offset(CharInfo, chars) + 1) + bytesThatFit));
+ ciPtr = ckalloc((Tk_Offset(CharInfo, chars) + 1) + bytesThatFit);
chunkPtr->clientData = ciPtr;
memcpy(ciPtr->chars, p, (unsigned) bytesThatFit);
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
@@ -7550,7 +7549,7 @@ CharUndisplayProc(
ciPtr->numBytes = 0;
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
- ckfree((char *) ciPtr);
+ ckfree(ciPtr);
chunkPtr->clientData = NULL;
}
}
diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c
index 7f1ce25..ac1ca63 100644
--- a/generic/tkTextImage.c
+++ b/generic/tkTextImage.c
@@ -239,7 +239,7 @@ TkTextImageCmd(
* Create the new image segment and initialize it.
*/
- eiPtr = (TkTextSegment *) ckalloc(EI_SEG_SIZE);
+ eiPtr = ckalloc(EI_SEG_SIZE);
eiPtr->typePtr = &tkTextEmbImageType;
eiPtr->size = 1;
eiPtr->body.ei.sharedTextPtr = textPtr->sharedTextPtr;
@@ -413,7 +413,7 @@ EmbImageConfigure(
}
Tcl_SetHashValue(hPtr, eiPtr);
Tcl_AppendResult(textPtr->interp, name, NULL);
- eiPtr->body.ei.name = ckalloc((unsigned) Tcl_DStringLength(&newName)+1);
+ eiPtr->body.ei.name = ckalloc(Tcl_DStringLength(&newName) + 1);
strcpy(eiPtr->body.ei.name, name);
Tcl_DStringFree(&newName);
@@ -474,7 +474,7 @@ EmbImageDeleteProc(
if (eiPtr->body.ei.name) {
ckfree(eiPtr->body.ei.name);
}
- ckfree((char *) eiPtr);
+ ckfree(eiPtr);
return 0;
}
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c
index e192962..aaabb88 100644
--- a/generic/tkTextIndex.c
+++ b/generic/tkTextIndex.c
@@ -92,10 +92,10 @@ FreeTextIndexInternalRep(
* The text widget has been deleted and we need to free it now.
*/
- ckfree((char *) indexPtr->textPtr);
+ ckfree(indexPtr->textPtr);
}
}
- ckfree((char *) indexPtr);
+ ckfree(indexPtr);
indexObjPtr->typePtr = NULL;
}
@@ -107,7 +107,7 @@ DupTextIndexInternalRep(
int epoch;
TkTextIndex *dupIndexPtr, *indexPtr;
- dupIndexPtr = (TkTextIndex *) ckalloc(sizeof(TkTextIndex));
+ dupIndexPtr = ckalloc(sizeof(TkTextIndex));
indexPtr = GET_TEXTINDEX(srcPtr);
epoch = GET_INDEXEPOCH(srcPtr);
@@ -140,7 +140,7 @@ UpdateStringOfTextIndex(
len = TkTextPrintIndex(indexPtr->textPtr, indexPtr, buffer);
- objPtr->bytes = ckalloc((unsigned) len + 1);
+ objPtr->bytes = ckalloc(len + 1);
strcpy(objPtr->bytes, buffer);
objPtr->length = len;
}
@@ -187,7 +187,7 @@ MakeObjIndex(
* position. */
const TkTextIndex *origPtr) /* Pointer to index. */
{
- TkTextIndex *indexPtr = (TkTextIndex *) ckalloc(sizeof(TkTextIndex));
+ TkTextIndex *indexPtr = ckalloc(sizeof(TkTextIndex));
indexPtr->tree = origPtr->tree;
indexPtr->linePtr = origPtr->linePtr;
@@ -1486,7 +1486,7 @@ TkTextIndexForwChars(
return;
}
if (checkElided) {
- infoPtr = (TkTextElideInfo *) ckalloc(sizeof(TkTextElideInfo));
+ infoPtr = ckalloc(sizeof(TkTextElideInfo));
elide = TkTextIsElided(textPtr, srcPtr, infoPtr);
}
@@ -1614,7 +1614,7 @@ TkTextIndexForwChars(
forwardCharDone:
if (infoPtr != NULL) {
TkTextFreeElideInfo(infoPtr);
- ckfree((char *) infoPtr);
+ ckfree(infoPtr);
}
}
@@ -1670,7 +1670,7 @@ TkTextIndexCount(
seg2Ptr = TkTextIndexToSeg(indexPtr2, &maxBytes);
if (checkElided) {
- infoPtr = (TkTextElideInfo *) ckalloc(sizeof(TkTextElideInfo));
+ infoPtr = ckalloc(sizeof(TkTextElideInfo));
elide = TkTextIsElided(textPtr, indexPtr1, infoPtr);
}
@@ -1810,7 +1810,7 @@ TkTextIndexCount(
countDone:
if (infoPtr != NULL) {
TkTextFreeElideInfo(infoPtr);
- ckfree((char *) infoPtr);
+ ckfree(infoPtr);
}
return count;
}
@@ -1928,7 +1928,7 @@ TkTextIndexBackChars(
return;
}
if (checkElided) {
- infoPtr = (TkTextElideInfo *) ckalloc(sizeof(TkTextElideInfo));
+ infoPtr = ckalloc(sizeof(TkTextElideInfo));
elide = TkTextIsElided(textPtr, srcPtr, infoPtr);
}
@@ -2094,7 +2094,7 @@ TkTextIndexBackChars(
backwardCharDone:
if (infoPtr != NULL) {
TkTextFreeElideInfo(infoPtr);
- ckfree((char *) infoPtr);
+ ckfree(infoPtr);
}
}
diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c
index 4fe035d..8a624d2 100644
--- a/generic/tkTextMark.c
+++ b/generic/tkTextMark.c
@@ -228,7 +228,7 @@ TkTextMarkCmd(
}
TkBTreeUnlinkSegment(markPtr, markPtr->body.mark.linePtr);
Tcl_DeleteHashEntry(hPtr);
- ckfree((char *) markPtr);
+ ckfree(markPtr);
}
}
break;
@@ -307,7 +307,7 @@ TkTextSetMark(
}
TkBTreeUnlinkSegment(markPtr, markPtr->body.mark.linePtr);
} else {
- markPtr = (TkTextSegment *) ckalloc(MSEG_SIZE);
+ markPtr = ckalloc(MSEG_SIZE);
markPtr->typePtr = &tkTextRightMarkType;
markPtr->size = 0;
markPtr->body.mark.textPtr = textPtr;
diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c
index 95fccb7..cf3b0c6 100644
--- a/generic/tkTextTag.c
+++ b/generic/tkTextTag.c
@@ -438,7 +438,7 @@ TkTextTagCmd(
}
}
if (tagPtr->tabArrayPtr != NULL) {
- ckfree((char *) tagPtr->tabArrayPtr);
+ ckfree(tagPtr->tabArrayPtr);
tagPtr->tabArrayPtr = NULL;
}
if (tagPtr->tabStringPtr != NULL) {
@@ -602,8 +602,8 @@ TkTextTagCmd(
Tcl_HashSearch search;
Tcl_HashEntry *hPtr;
- arrayPtr = (TkTextTag **) ckalloc((unsigned)
- (textPtr->sharedTextPtr->numTags * sizeof(TkTextTag *)));
+ arrayPtr = ckalloc(textPtr->sharedTextPtr->numTags
+ * sizeof(TkTextTag *));
for (i=0, hPtr = Tcl_FirstHashEntry(
&textPtr->sharedTextPtr->tagTable, &search);
hPtr != NULL; i++, hPtr = Tcl_NextHashEntry(&search)) {
@@ -636,7 +636,7 @@ TkTextTagCmd(
Tcl_NewStringObj(tagPtr->name,-1));
}
Tcl_SetObjResult(interp, listObj);
- ckfree((char *) arrayPtr);
+ ckfree(arrayPtr);
break;
}
case TAG_NEXTRANGE: {
@@ -965,7 +965,7 @@ TkTextCreateTag(
* to it to the hash table entry.
*/
- tagPtr = (TkTextTag *) ckalloc(sizeof(TkTextTag));
+ tagPtr = ckalloc(sizeof(TkTextTag));
tagPtr->name = name;
tagPtr->textPtr = NULL;
tagPtr->toggleCount = 0;
@@ -1169,7 +1169,7 @@ TkTextFreeTag(
*/
if (tagPtr->tabArrayPtr != NULL) {
- ckfree((char *) tagPtr->tabArrayPtr);
+ ckfree(tagPtr->tabArrayPtr);
}
/*
@@ -1198,7 +1198,7 @@ TkTextFreeTag(
}
textPtr->refCount--;
if (textPtr->refCount == 0) {
- ckfree((char *) textPtr);
+ ckfree(textPtr);
}
tagPtr->textPtr = NULL;
}
@@ -1207,7 +1207,7 @@ TkTextFreeTag(
* Finally free the tag's memory.
*/
- ckfree((char *) tagPtr);
+ ckfree(tagPtr);
}
/*
@@ -1461,7 +1461,7 @@ TkTextBindProc(
done:
if (--textPtr->refCount == 0) {
- ckfree((char *) textPtr);
+ ckfree(textPtr);
}
}
@@ -1593,7 +1593,7 @@ TkTextPickCurrent(
SortTags(textPtr->numCurTags, textPtr->curTagArrayPtr);
if (numNewTags > 0) {
size = numNewTags * sizeof(TkTextTag *);
- copyArrayPtr = (TkTextTag **) ckalloc((unsigned) size);
+ copyArrayPtr = ckalloc(size);
memcpy(copyArrayPtr, newArrayPtr, (size_t) size);
for (i = 0; i < textPtr->numCurTags; i++) {
for (j = 0; j < numNewTags; j++) {
@@ -1635,7 +1635,7 @@ TkTextPickCurrent(
event.xcrossing.detail = NotifyAncestor;
TagBindEvent(textPtr, &event, numOldTags, oldArrayPtr);
}
- ckfree((char *) oldArrayPtr);
+ ckfree(oldArrayPtr);
}
/*
@@ -1657,7 +1657,7 @@ TkTextPickCurrent(
event.xcrossing.detail = NotifyAncestor;
TagBindEvent(textPtr, &event, numNewTags, copyArrayPtr);
}
- ckfree((char *) copyArrayPtr);
+ ckfree(copyArrayPtr);
}
}
@@ -1697,7 +1697,7 @@ TagBindEvent(
*/
if (numTags > NUM_BIND_TAGS) {
- nameArrPtr = (const char **) ckalloc(numTags * sizeof(const char *));
+ nameArrPtr = ckalloc(numTags * sizeof(const char *));
} else {
nameArrPtr = nameArray;
}
@@ -1710,6 +1710,7 @@ TagBindEvent(
for (i = 0; i < numTags; i++) {
TkTextTag *tagPtr = tagArrayPtr[i];
+
if (tagPtr != NULL) {
nameArrPtr[i] = tagPtr->name;
} else {
@@ -1726,7 +1727,7 @@ TagBindEvent(
textPtr->tkwin, numTags, (ClientData *) nameArrPtr);
if (numTags > NUM_BIND_TAGS) {
- ckfree((char *) nameArrPtr);
+ ckfree(nameArrPtr);
}
}
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c
index 8c032c6..e3894fc 100644
--- a/generic/tkTextWind.c
+++ b/generic/tkTextWind.c
@@ -288,7 +288,7 @@ TkTextWindowCmd(
* Create the new window segment and initialize it.
*/
- ewPtr = (TkTextSegment *) ckalloc(EW_SEG_SIZE);
+ ewPtr = ckalloc(EW_SEG_SIZE);
ewPtr->typePtr = &tkTextEmbWindowType;
ewPtr->size = 1;
ewPtr->body.ew.sharedTextPtr = textPtr->sharedTextPtr;
@@ -300,8 +300,7 @@ TkTextWindowCmd(
ewPtr->body.ew.stretch = 0;
ewPtr->body.ew.optionTable = Tk_CreateOptionTable(interp, optionSpecs);
- client = (TkTextEmbWindowClient *)
- ckalloc(sizeof(TkTextEmbWindowClient));
+ client = ckalloc(sizeof(TkTextEmbWindowClient));
client->next = NULL;
client->textPtr = textPtr;
client->tkwin = NULL;
@@ -459,8 +458,7 @@ EmbWinConfigure(
* Have to make the new client.
*/
- client = (TkTextEmbWindowClient *)
- ckalloc(sizeof(TkTextEmbWindowClient));
+ client = ckalloc(sizeof(TkTextEmbWindowClient));
client->next = ewPtr->body.ew.clients;
client->textPtr = textPtr;
client->tkwin = NULL;
@@ -642,7 +640,7 @@ EmbWinLostSlaveProc(
}
loop->next = client->next;
}
- ckfree((char *) client);
+ ckfree(client);
index.tree = ewPtr->body.ew.sharedTextPtr->tree;
index.linePtr = ewPtr->body.ew.linePtr;
@@ -708,7 +706,7 @@ TkTextWinFreeClient(
* Free up this client.
*/
- ckfree((char *) client);
+ ckfree(client);
}
/*
@@ -762,7 +760,7 @@ EmbWinDeleteProc(
* Free up all memory allocated.
*/
- ckfree((char *) ewPtr);
+ ckfree(ewPtr);
return 0;
}
@@ -947,8 +945,7 @@ EmbWinLayoutProc(
* now need to add to our client list.
*/
- client = (TkTextEmbWindowClient *)
- ckalloc(sizeof(TkTextEmbWindowClient));
+ client = ckalloc(sizeof(TkTextEmbWindowClient));
client->next = ewPtr->body.ew.clients;
client->textPtr = textPtr;
client->tkwin = NULL;
diff --git a/generic/tkUndo.c b/generic/tkUndo.c
index 1150cef..2c56c05 100644
--- a/generic/tkUndo.c
+++ b/generic/tkUndo.c
@@ -96,7 +96,7 @@ TkUndoInsertSeparator(
TkUndoAtom *separator;
if (*stack!=NULL && (*stack)->type!=TK_UNDO_SEPARATOR) {
- separator = (TkUndoAtom *) ckalloc(sizeof(TkUndoAtom));
+ separator = ckalloc(sizeof(TkUndoAtom));
separator->type = TK_UNDO_SEPARATOR;
TkUndoPushStack(stack,separator);
return 1;
@@ -137,7 +137,7 @@ TkUndoClearStack(
if (sub->action != NULL) {
Tcl_DecrRefCount(sub->action);
}
- ckfree((char *)sub);
+ ckfree(sub);
sub = next;
}
@@ -148,11 +148,11 @@ TkUndoClearStack(
if (sub->action != NULL) {
Tcl_DecrRefCount(sub->action);
}
- ckfree((char *)sub);
+ ckfree(sub);
sub = next;
}
}
- ckfree((char *)elem);
+ ckfree(elem);
}
*stack = NULL;
}
@@ -183,7 +183,7 @@ TkUndoPushAction(
{
TkUndoAtom *atom;
- atom = (TkUndoAtom *) ckalloc(sizeof(TkUndoAtom));
+ atom = ckalloc(sizeof(TkUndoAtom));
atom->type = TK_UNDO_ACTION;
atom->apply = apply;
atom->revert = revert;
@@ -239,7 +239,7 @@ TkUndoMakeCmdSubAtom(
Tcl_Panic("NULL command and actionScript in TkUndoMakeCmdSubAtom");
}
- atom = (TkUndoSubAtom *) ckalloc(sizeof(TkUndoSubAtom));
+ atom = ckalloc(sizeof(TkUndoSubAtom));
atom->command = command;
atom->funcPtr = NULL;
atom->clientData = NULL;
@@ -301,7 +301,7 @@ TkUndoMakeSubAtom(
Tcl_Panic("NULL funcPtr in TkUndoMakeSubAtom");
}
- atom = (TkUndoSubAtom *) ckalloc(sizeof(TkUndoSubAtom));
+ atom = ckalloc(sizeof(TkUndoSubAtom));
atom->command = NULL;
atom->funcPtr = funcPtr;
atom->clientData = clientData;
@@ -343,7 +343,7 @@ TkUndoInitStack(
{
TkUndoRedoStack *stack; /* An Undo/Redo stack */
- stack = (TkUndoRedoStack *) ckalloc(sizeof(TkUndoRedoStack));
+ stack = ckalloc(sizeof(TkUndoRedoStack));
stack->undoStack = NULL;
stack->redoStack = NULL;
stack->interp = interp;
@@ -406,7 +406,7 @@ TkUndoSetDepth(
if (sub->action != NULL) {
Tcl_DecrRefCount(sub->action);
}
- ckfree((char *)sub);
+ ckfree(sub);
sub = next;
}
sub = elem->revert;
@@ -416,12 +416,12 @@ TkUndoSetDepth(
if (sub->action != NULL) {
Tcl_DecrRefCount(sub->action);
}
- ckfree((char *)sub);
+ ckfree(sub);
sub = next;
}
}
elem = elem->next;
- ckfree((char *) prevelem);
+ ckfree(prevelem);
}
stack->depth = stack->maxdepth;
}
@@ -474,7 +474,7 @@ TkUndoFreeStack(
TkUndoRedoStack *stack) /* An Undo/Redo stack */
{
TkUndoClearStacks(stack);
- ckfree((char *) stack);
+ ckfree(stack);
}
/*
@@ -543,7 +543,7 @@ TkUndoRevert(
}
if (elem->type == TK_UNDO_SEPARATOR) {
- ckfree((char *) elem);
+ ckfree(elem);
elem = TkUndoPopStack(&stack->undoStack);
}
@@ -605,7 +605,7 @@ TkUndoApply(
}
if (elem->type == TK_UNDO_SEPARATOR) {
- ckfree((char *) elem);
+ ckfree(elem);
elem = TkUndoPopStack(&stack->redoStack);
}
diff --git a/generic/tkVisual.c b/generic/tkVisual.c
index 8665636..8b43e6e 100644
--- a/generic/tkVisual.c
+++ b/generic/tkVisual.c
@@ -327,7 +327,7 @@ Tk_GetVisual(
goto done;
}
}
- cmapPtr = (TkColormap *) ckalloc(sizeof(TkColormap));
+ cmapPtr = ckalloc(sizeof(TkColormap));
cmapPtr->colormap = XCreateColormap(Tk_Display(tkwin),
RootWindowOfScreen(Tk_Screen(tkwin)), visual,
AllocNone);
@@ -382,7 +382,7 @@ Tk_GetColormap(
*/
if (strcmp(string, "new") == 0) {
- cmapPtr = (TkColormap *) ckalloc(sizeof(TkColormap));
+ cmapPtr = ckalloc(sizeof(TkColormap));
cmapPtr->colormap = XCreateColormap(Tk_Display(tkwin),
RootWindowOfScreen(Tk_Screen(tkwin)), Tk_Visual(tkwin),
AllocNone);
@@ -481,7 +481,7 @@ Tk_FreeColormap(
} else {
prevPtr->nextPtr = cmapPtr->nextPtr;
}
- ckfree((char *) cmapPtr);
+ ckfree(cmapPtr);
}
return;
}
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 508c961..528fc87 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -294,7 +294,7 @@ TkCloseDisplay(
errorPtr != NULL;
errorPtr = dispPtr->errorPtr) {
dispPtr->errorPtr = errorPtr->nextPtr;
- ckfree((char *) errorPtr);
+ ckfree(errorPtr);
}
}
@@ -309,7 +309,7 @@ TkCloseDisplay(
Tcl_DeleteHashTable(&dispPtr->winTable);
- ckfree((char *) dispPtr);
+ ckfree(dispPtr);
/*
* There is more to clean up, we leave it at this for the time being.
@@ -520,7 +520,7 @@ GetScreen(
Tcl_InitHashTable(&dispPtr->winTable, TCL_ONE_WORD_KEYS);
- dispPtr->name = (char *) ckalloc((unsigned) (length+1));
+ dispPtr->name = ckalloc(length + 1);
strncpy(dispPtr->name, screenName, length);
dispPtr->name[length] = '\0';
break;
@@ -654,9 +654,8 @@ TkAllocWindow(
* inherit visual information. NULL means use
* screen defaults instead of inheriting. */
{
- register TkWindow *winPtr;
+ register TkWindow *winPtr = ckalloc(sizeof(TkWindow));
- winPtr = (TkWindow *) ckalloc(sizeof(TkWindow));
winPtr->display = dispPtr->display;
winPtr->dispPtr = dispPtr;
winPtr->screenNum = screenNum;
@@ -803,7 +802,7 @@ NameWindow(
if ((length1+length2+2) <= FIXED_SIZE) {
pathName = staticSpace;
} else {
- pathName = (char *) ckalloc((unsigned) (length1+length2+2));
+ pathName = ckalloc(length1 + length2 + 2);
}
if (length1 == 1) {
pathName[0] = '.';
@@ -895,7 +894,7 @@ TkCreateMainWindow(
*/
winPtr = (TkWindow *) tkwin;
- mainPtr = (TkMainInfo *) ckalloc(sizeof(TkMainInfo));
+ mainPtr = ckalloc(sizeof(TkMainInfo));
mainPtr->winPtr = winPtr;
mainPtr->refCount = 1;
mainPtr->interp = interp;
@@ -1178,7 +1177,7 @@ Tk_CreateWindowFromPath(
}
numChars = (int) (p-pathName);
if (numChars > FIXED_SPACE) {
- p = (char *) ckalloc((unsigned) (numChars+1));
+ p = ckalloc(numChars + 1);
} else {
p = fixedSpace;
}
@@ -1285,7 +1284,7 @@ Tk_DestroyWindow(
(tsdPtr->halfdeadWindowList->winPtr == winPtr)) {
halfdeadPtr = tsdPtr->halfdeadWindowList;
} else {
- halfdeadPtr = (TkHalfdeadWindow *) ckalloc(sizeof(TkHalfdeadWindow));
+ halfdeadPtr = ckalloc(sizeof(TkHalfdeadWindow));
halfdeadPtr->flags = 0;
halfdeadPtr->winPtr = winPtr;
halfdeadPtr->nextPtr = tsdPtr->halfdeadWindowList;
@@ -1429,7 +1428,7 @@ Tk_DestroyWindow(
} else {
prev_halfdeadPtr->nextPtr = halfdeadPtr->nextPtr;
}
- ckfree((char *) halfdeadPtr);
+ ckfree(halfdeadPtr);
break;
}
prev_halfdeadPtr = halfdeadPtr;
@@ -1554,7 +1553,7 @@ Tk_DestroyWindow(
if (winPtr->flags & TK_EMBEDDED) {
XSync(winPtr->display, False);
}
- ckfree((char *) winPtr->mainPtr);
+ ckfree(winPtr->mainPtr);
/*
* If no other applications are using the display, close the
@@ -3230,7 +3229,7 @@ Initialize(
Tcl_MutexUnlock(&windowMutex);
if (argv != NULL) {
- ckfree((char *) argv);
+ ckfree(argv);
}
code = TkpInit(interp);
if (code == TCL_OK) {
@@ -3269,7 +3268,7 @@ tkInit");
done:
Tcl_MutexUnlock(&windowMutex);
if (argv != NULL) {
- ckfree((char *) argv);
+ ckfree(argv);
}
return code;
}
diff --git a/generic/ttk/ttkBlink.c b/generic/ttk/ttkBlink.c
index 2476fcd..3829619 100644
--- a/generic/ttk/ttkBlink.c
+++ b/generic/ttk/ttkBlink.c
@@ -51,10 +51,10 @@ static void CursorManagerDeleteProc(ClientData clientData, Tcl_Interp *interp)
static CursorManager *GetCursorManager(Tcl_Interp *interp)
{
static const char *cm_key = "ttk::CursorManager";
- CursorManager *cm = (CursorManager *) Tcl_GetAssocData(interp, cm_key,0);
+ CursorManager *cm = Tcl_GetAssocData(interp, cm_key,0);
if (!cm) {
- cm = (CursorManager*)ckalloc(sizeof(*cm));
+ cm = ckalloc(sizeof(*cm));
cm->timer = 0;
cm->owner = 0;
cm->onTime = DEF_CURSOR_ON_TIME;
diff --git a/generic/ttk/ttkCache.c b/generic/ttk/ttkCache.c
index 8bb54ec..9163beb 100644
--- a/generic/ttk/ttkCache.c
+++ b/generic/ttk/ttkCache.c
@@ -50,7 +50,7 @@ struct Ttk_ResourceCache_ {
*/
Ttk_ResourceCache Ttk_CreateResourceCache(Tcl_Interp *interp)
{
- Ttk_ResourceCache cache = (Ttk_ResourceCache)ckalloc(sizeof(*cache));
+ Ttk_ResourceCache cache = ckalloc(sizeof(*cache));
cache->tkwin = NULL; /* initialized later */
cache->interp = interp;
@@ -161,7 +161,7 @@ void Ttk_FreeResourceCache(Ttk_ResourceCache cache)
}
Tcl_DeleteHashTable(&cache->namedColors);
- ckfree((ClientData)cache);
+ ckfree(cache);
}
/*
diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c
index 6f84d9a..e9428ec 100644
--- a/generic/ttk/ttkImage.c
+++ b/generic/ttk/ttkImage.c
@@ -47,7 +47,7 @@ TtkGetImageSpec(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr)
int i = 0, n = 0, objc;
Tcl_Obj **objv;
- imageSpec = (Ttk_ImageSpec *)ckalloc(sizeof(*imageSpec));
+ imageSpec = ckalloc(sizeof(*imageSpec));
imageSpec->baseImage = 0;
imageSpec->mapCount = 0;
imageSpec->states = 0;
@@ -67,8 +67,8 @@ TtkGetImageSpec(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr)
}
n = (objc - 1) / 2;
- imageSpec->states = (Ttk_StateSpec*)ckalloc(n * sizeof(Ttk_StateSpec));
- imageSpec->images = (Tk_Image*)ckalloc(n * sizeof(Tk_Image *));
+ imageSpec->states = ckalloc(n * sizeof(Ttk_StateSpec));
+ imageSpec->images = ckalloc(n * sizeof(Tk_Image *));
/* Get base image:
*/
@@ -117,10 +117,10 @@ void TtkFreeImageSpec(Ttk_ImageSpec *imageSpec)
}
if (imageSpec->baseImage) { Tk_FreeImage(imageSpec->baseImage); }
- if (imageSpec->states) { ckfree((ClientData)imageSpec->states); }
- if (imageSpec->images) { ckfree((ClientData)imageSpec->images); }
+ if (imageSpec->states) { ckfree(imageSpec->states); }
+ if (imageSpec->images) { ckfree(imageSpec->images); }
- ckfree((ClientData)imageSpec);
+ ckfree(imageSpec);
}
/* TtkSelectImage --
@@ -333,7 +333,7 @@ Ttk_CreateImageElement(
return TCL_ERROR;
}
- imageData = (ImageData*)ckalloc(sizeof(*imageData));
+ imageData = ckalloc(sizeof(*imageData));
imageData->imageSpec = imageSpec;
imageData->minWidth = imageData->minHeight = -1;
imageData->sticky = TTK_FILL_BOTH;
diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c
index e3f6a02..6eaf6bb 100644
--- a/generic/ttk/ttkLayout.c
+++ b/generic/ttk/ttkLayout.c
@@ -526,7 +526,7 @@ struct Ttk_LayoutNode_
static Ttk_LayoutNode *Ttk_NewLayoutNode(
unsigned flags, Ttk_ElementClass *elementClass)
{
- Ttk_LayoutNode *node = (Ttk_LayoutNode*)ckalloc(sizeof(*node));
+ Ttk_LayoutNode *node = ckalloc(sizeof(*node));
node->flags = flags;
node->eclass = elementClass;
@@ -542,7 +542,7 @@ static void Ttk_FreeLayoutNode(Ttk_LayoutNode *node)
while (node) {
Ttk_LayoutNode *next = node->next;
Ttk_FreeLayoutNode(node->child);
- ckfree((ClientData)node);
+ ckfree(node);
node = next;
}
}
@@ -559,7 +559,7 @@ struct Ttk_TemplateNode_ {
static Ttk_TemplateNode *Ttk_NewTemplateNode(const char *name, unsigned flags)
{
- Ttk_TemplateNode *op = (Ttk_TemplateNode*)ckalloc(sizeof(*op));
+ Ttk_TemplateNode *op = ckalloc(sizeof(*op));
op->name = ckalloc(strlen(name) + 1); strcpy(op->name, name);
op->flags = flags;
op->next = op->child = 0;
@@ -572,7 +572,7 @@ void Ttk_FreeLayoutTemplate(Ttk_LayoutTemplate op)
Ttk_LayoutTemplate next = op->next;
Ttk_FreeLayoutTemplate(op->child);
ckfree(op->name);
- ckfree((ClientData)op);
+ ckfree(op);
op = next;
}
}
@@ -841,7 +841,7 @@ static Ttk_Layout TTKNewLayout(
void *recordPtr,Tk_OptionTable optionTable, Tk_Window tkwin,
Ttk_LayoutNode *root)
{
- Ttk_Layout layout = (Ttk_Layout)ckalloc(sizeof(*layout));
+ Ttk_Layout layout = ckalloc(sizeof(*layout));
layout->style = style;
layout->recordPtr = recordPtr;
layout->optionTable = optionTable;
@@ -853,7 +853,7 @@ static Ttk_Layout TTKNewLayout(
void Ttk_FreeLayout(Ttk_Layout layout)
{
Ttk_FreeLayoutNode(layout->root);
- ckfree((ClientData)layout);
+ ckfree(layout);
}
/*
diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c
index 1238638..cd10711 100644
--- a/generic/ttk/ttkManager.c
+++ b/generic/ttk/ttkManager.c
@@ -189,7 +189,7 @@ static void SlaveEventHandler(ClientData clientData, XEvent *eventPtr)
static Ttk_Slave *NewSlave(
Ttk_Manager *mgr, Tk_Window slaveWindow, void *slaveData)
{
- Ttk_Slave *slave = (Ttk_Slave*)ckalloc(sizeof(*slave));
+ Ttk_Slave *slave = ckalloc(sizeof(*slave));
slave->slaveWindow = slaveWindow;
slave->manager = mgr;
@@ -201,7 +201,7 @@ static Ttk_Slave *NewSlave(
static void DeleteSlave(Ttk_Slave *slave)
{
- ckfree((ClientData)slave);
+ ckfree(slave);
}
/*------------------------------------------------------------------------
@@ -211,7 +211,7 @@ static void DeleteSlave(Ttk_Slave *slave)
Ttk_Manager *Ttk_CreateManager(
Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window masterWindow)
{
- Ttk_Manager *mgr = (Ttk_Manager*)ckalloc(sizeof(*mgr));
+ Ttk_Manager *mgr = ckalloc(sizeof(*mgr));
mgr->managerSpec = managerSpec;
mgr->managerData = managerData;
@@ -235,12 +235,12 @@ void Ttk_DeleteManager(Ttk_Manager *mgr)
Ttk_ForgetSlave(mgr, mgr->nSlaves - 1);
}
if (mgr->slaves) {
- ckfree((ClientData)mgr->slaves);
+ ckfree(mgr->slaves);
}
Tk_CancelIdleCall(ManagerIdleProc, mgr);
- ckfree((ClientData)mgr);
+ ckfree(mgr);
}
/*------------------------------------------------------------------------
@@ -253,8 +253,7 @@ void Ttk_DeleteManager(Ttk_Manager *mgr)
static void InsertSlave(Ttk_Manager *mgr, Ttk_Slave *slave, int index)
{
int endIndex = mgr->nSlaves++;
- mgr->slaves = (Ttk_Slave**)ckrealloc(
- (ClientData)mgr->slaves, mgr->nSlaves * sizeof(Ttk_Slave *));
+ mgr->slaves = ckrealloc(mgr->slaves, mgr->nSlaves * sizeof(Ttk_Slave *));
while (endIndex > index) {
mgr->slaves[endIndex] = mgr->slaves[endIndex - 1];
diff --git a/generic/ttk/ttkScroll.c b/generic/ttk/ttkScroll.c
index dc9317e..a25a2f3 100644
--- a/generic/ttk/ttkScroll.c
+++ b/generic/ttk/ttkScroll.c
@@ -56,7 +56,7 @@ struct ScrollHandleRec
*/
ScrollHandle TtkCreateScrollHandle(WidgetCore *corePtr, Scrollable *scrollPtr)
{
- ScrollHandle h = (ScrollHandle)ckalloc(sizeof(*h));
+ ScrollHandle h = ckalloc(sizeof(*h));
h->flags = 0;
h->corePtr = corePtr;
@@ -248,6 +248,6 @@ void TtkFreeScrollHandle(ScrollHandle h)
if (h->flags & SCROLL_UPDATE_PENDING) {
Tcl_CancelIdleCall(UpdateScrollbarBG, (ClientData)h);
}
- ckfree((ClientData)h);
+ ckfree(h);
}
diff --git a/generic/ttk/ttkTagSet.c b/generic/ttk/ttkTagSet.c
index dbf6a5c..84e9ea2 100644
--- a/generic/ttk/ttkTagSet.c
+++ b/generic/ttk/ttkTagSet.c
@@ -35,7 +35,7 @@ struct TtkTagTable {
*/
static Ttk_Tag NewTag(Ttk_TagTable tagTable, const char *tagName)
{
- Ttk_Tag tag = (Ttk_Tag)ckalloc(sizeof(*tag));
+ Ttk_Tag tag = ckalloc(sizeof(*tag));
tag->tagRecord = ckalloc(tagTable->recordSize);
memset(tag->tagRecord, 0, tagTable->recordSize);
/* Don't need Tk_InitOptions() here, all defaults should be NULL. */
@@ -48,7 +48,7 @@ static void DeleteTag(Ttk_TagTable tagTable, Ttk_Tag tag)
{
Tk_FreeConfigOptions(tag->tagRecord,tagTable->optionTable,tagTable->tkwin);
ckfree(tag->tagRecord);
- ckfree((void*)tag);
+ ckfree(tag);
}
/*------------------------------------------------------------------------
@@ -59,7 +59,7 @@ Ttk_TagTable Ttk_CreateTagTable(
Tcl_Interp *interp, Tk_Window tkwin,
Tk_OptionSpec optionSpecs[], int recordSize)
{
- Ttk_TagTable tagTable = (Ttk_TagTable)ckalloc(sizeof(*tagTable));
+ Ttk_TagTable tagTable = ckalloc(sizeof(*tagTable));
tagTable->tkwin = tkwin;
tagTable->optionSpecs = optionSpecs;
tagTable->optionTable = Tk_CreateOptionTable(interp, optionSpecs);
@@ -81,7 +81,7 @@ void Ttk_DeleteTagTable(Ttk_TagTable tagTable)
}
Tcl_DeleteHashTable(&tagTable->tags);
- ckfree((void*)tagTable);
+ ckfree(tagTable);
}
Ttk_Tag Ttk_GetTag(Ttk_TagTable tagTable, const char *tagName)
@@ -117,7 +117,7 @@ Ttk_Tag Ttk_GetTagFromObj(Ttk_TagTable tagTable, Tcl_Obj *objPtr)
Ttk_TagSet Ttk_GetTagSetFromObj(
Tcl_Interp *interp, Ttk_TagTable tagTable, Tcl_Obj *objPtr)
{
- Ttk_TagSet tagset = (Ttk_TagSet)(ckalloc(sizeof *tagset));
+ Ttk_TagSet tagset = ckalloc(sizeof(*tagset));
Tcl_Obj **objv;
int i, objc;
@@ -128,11 +128,11 @@ Ttk_TagSet Ttk_GetTagSetFromObj(
}
if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) {
- ckfree((ClientData)tagset);
+ ckfree(tagset);
return NULL;
}
- tagset->tags = (Ttk_Tag*)ckalloc((objc+1) * sizeof(Ttk_Tag));
+ tagset->tags = ckalloc((objc+1) * sizeof(Ttk_Tag));
for (i=0; i<objc; ++i) {
tagset->tags[i] = Ttk_GetTagFromObj(tagTable, objv[i]);
}
@@ -159,8 +159,8 @@ Tcl_Obj *Ttk_NewTagSetObj(Ttk_TagSet tagset)
void Ttk_FreeTagSet(Ttk_TagSet tagset)
{
- ckfree((ClientData)tagset->tags);
- ckfree((ClientData)tagset);
+ ckfree(tagset->tags);
+ ckfree(tagset);
}
/* Ttk_TagSetContains -- test if tag set contains a tag.
@@ -189,7 +189,7 @@ int Ttk_TagSetAdd(Ttk_TagSet tagset, Ttk_Tag tag)
return 0;
}
}
- tagset->tags = (void*)ckrealloc((void*)tagset->tags,
+ tagset->tags = ckrealloc(tagset->tags,
(tagset->nTags+1)*sizeof(tagset->tags[0]));
tagset->tags[tagset->nTags++] = tag;
return 1;
diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c
index e0d1971..2b98eaf 100644
--- a/generic/ttk/ttkTheme.c
+++ b/generic/ttk/ttkTheme.c
@@ -42,7 +42,7 @@ typedef struct Ttk_Style_
static Style *NewStyle()
{
- Style *stylePtr = (Style*)ckalloc(sizeof(Style));
+ Style *stylePtr = ckalloc(sizeof(Style));
stylePtr->styleName = NULL;
stylePtr->parentStyle = NULL;
@@ -77,7 +77,7 @@ static void FreeStyle(Style *stylePtr)
Ttk_FreeLayoutTemplate(stylePtr->layoutTemplate);
- ckfree((ClientData)stylePtr);
+ ckfree(stylePtr);
}
/*
@@ -181,7 +181,7 @@ static const Tk_OptionSpec *TTKGetOptionSpec(
static OptionMap
BuildOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable)
{
- OptionMap optionMap = (OptionMap)ckalloc(
+ OptionMap optionMap = ckalloc(
sizeof(const Tk_OptionSpec) * elementClass->nResources + 1);
int i;
@@ -223,8 +223,7 @@ GetOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable)
static Ttk_ElementClass *
NewElementClass(const char *name, Ttk_ElementSpec *specPtr,void *clientData)
{
- Ttk_ElementClass *elementClass =
- (Ttk_ElementClass*)ckalloc(sizeof(Ttk_ElementClass));
+ Ttk_ElementClass *elementClass = ckalloc(sizeof(Ttk_ElementClass));
int i;
elementClass->name = name;
@@ -240,7 +239,7 @@ NewElementClass(const char *name, Ttk_ElementSpec *specPtr,void *clientData)
/* Initialize default values:
*/
- elementClass->defaultValues = (Tcl_Obj**)
+ elementClass->defaultValues =
ckalloc(elementClass->nResources * sizeof(Tcl_Obj *) + 1);
for (i=0; i < elementClass->nResources; ++i) {
const char *defaultValue = specPtr->options[i].defaultValue;
@@ -277,7 +276,7 @@ static void FreeElementClass(Ttk_ElementClass *elementClass)
Tcl_DecrRefCount(elementClass->defaultValues[i]);
}
}
- ckfree((ClientData)elementClass->defaultValues);
+ ckfree(elementClass->defaultValues);
/*
* Free option map cache:
@@ -290,7 +289,7 @@ static void FreeElementClass(Ttk_ElementClass *elementClass)
Tcl_DeleteHashTable(&elementClass->optMapCache);
ckfree(elementClass->elementRecord);
- ckfree((ClientData)elementClass);
+ ckfree(elementClass);
}
/*------------------------------------------------------------------------
@@ -313,7 +312,7 @@ typedef struct Ttk_Theme_
static Theme *NewTheme(Ttk_ResourceCache cache, Ttk_Theme parent)
{
- Theme *themePtr = (Theme*)ckalloc(sizeof(Theme));
+ Theme *themePtr = ckalloc(sizeof(Theme));
Tcl_HashEntry *entryPtr;
int unused;
@@ -367,7 +366,7 @@ static void FreeTheme(Theme *themePtr)
/*
* Free theme record:
*/
- ckfree((ClientData)themePtr);
+ ckfree(themePtr);
return;
}
@@ -456,11 +455,11 @@ static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp)
while (cleanup) {
Cleanup *next = cleanup->next;
cleanup->cleanupProc(cleanup->clientData);
- ckfree((ClientData)cleanup);
+ ckfree(cleanup);
cleanup = next;
}
- ckfree((ClientData)pkgPtr);
+ ckfree(pkgPtr);
}
/*
@@ -486,7 +485,7 @@ void Ttk_RegisterCleanup(
Tcl_Interp *interp, ClientData clientData, Ttk_CleanupProc *cleanupProc)
{
StylePackageData *pkgPtr = GetStylePackageData(interp);
- Cleanup *cleanup = (Cleanup*)ckalloc(sizeof(*cleanup));
+ Cleanup *cleanup = ckalloc(sizeof(*cleanup));
cleanup->clientData = clientData;
cleanup->cleanupProc = cleanupProc;
@@ -802,7 +801,7 @@ int Ttk_RegisterElementFactory(
Ttk_ElementFactory factory, void *clientData)
{
StylePackageData *pkgPtr = GetStylePackageData(interp);
- FactoryRec *recPtr = (FactoryRec*)ckalloc(sizeof(*recPtr));
+ FactoryRec *recPtr = ckalloc(sizeof(*recPtr));
Tcl_HashEntry *entryPtr;
int newEntry;
@@ -1697,8 +1696,7 @@ void Ttk_StylePkgInit(Tcl_Interp *interp)
{
Tcl_Namespace *nsPtr;
- StylePackageData *pkgPtr = (StylePackageData *)
- ckalloc(sizeof(StylePackageData));
+ StylePackageData *pkgPtr = ckalloc(sizeof(StylePackageData));
pkgPtr->interp = interp;
Tcl_InitHashTable(&pkgPtr->themeTable, TCL_STRING_KEYS);
diff --git a/generic/ttk/ttkTrace.c b/generic/ttk/ttkTrace.c
index cb2f1c7..c8cceaf 100644
--- a/generic/ttk/ttkTrace.c
+++ b/generic/ttk/ttkTrace.c
@@ -76,7 +76,7 @@ Ttk_TraceHandle *Ttk_TraceVariable(
Ttk_TraceProc callback,
void *clientData)
{
- Ttk_TraceHandle *h = (Ttk_TraceHandle*)ckalloc(sizeof(*h));
+ Ttk_TraceHandle *h = ckalloc(sizeof(*h));
int status;
h->interp = interp;
@@ -91,7 +91,7 @@ Ttk_TraceHandle *Ttk_TraceVariable(
if (status != TCL_OK) {
Tcl_DecrRefCount(h->varnameObj);
- ckfree((ClientData)h);
+ ckfree(h);
return NULL;
}
@@ -109,7 +109,7 @@ void Ttk_UntraceVariable(Ttk_TraceHandle *h)
TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
VarTraceProc, (ClientData)h);
Tcl_DecrRefCount(h->varnameObj);
- ckfree((ClientData)h);
+ ckfree(h);
}
}
diff --git a/generic/ttk/ttkTrack.c b/generic/ttk/ttkTrack.c
index a392d94..74b34e0 100644
--- a/generic/ttk/ttkTrack.c
+++ b/generic/ttk/ttkTrack.c
@@ -173,7 +173,7 @@ ElementStateEventProc(ClientData clientData, XEvent *ev)
void TtkTrackElementState(WidgetCore *corePtr)
{
- ElementStateTracker *es = (ElementStateTracker*)ckalloc(sizeof(*es));
+ ElementStateTracker *es = ckalloc(sizeof(*es));
es->corePtr = corePtr;
es->tracking = 0;
es->activeElement = es->pressedElement = 0;
diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c
index d7afb3c..b9fe913 100644
--- a/generic/ttk/ttkTreeview.c
+++ b/generic/ttk/ttkTreeview.c
@@ -86,7 +86,7 @@ static Tk_OptionSpec ItemOptionSpecs[] = {
*/
static TreeItem *NewItem(void)
{
- TreeItem *item = (TreeItem*)ckalloc(sizeof(*item));
+ TreeItem *item = ckalloc(sizeof(*item));
item->entryPtr = 0;
item->parent = item->children = item->next = item->prev = NULL;
@@ -118,7 +118,7 @@ static void FreeItem(TreeItem *item)
if (item->tagset) { Ttk_FreeTagSet(item->tagset); }
if (item->imagespec) { TtkFreeImageSpec(item->imagespec); }
- ckfree((ClientData)item);
+ ckfree(item);
}
static void FreeItemCB(void *clientData) { FreeItem(clientData); }
@@ -613,11 +613,11 @@ static TreeItem **GetItemListFromObj(
return NULL;
}
- items = (TreeItem**)ckalloc((nElements + 1)*sizeof(TreeItem*));
+ items = ckalloc((nElements + 1)*sizeof(TreeItem*));
for (i = 0; i < nElements; ++i) {
items[i] = FindItem(interp, tv, elements[i]);
if (!items[i]) {
- ckfree((ClientData)items);
+ ckfree(items);
return NULL;
}
}
@@ -659,7 +659,7 @@ static void TreeviewFreeColumns(Treeview *tv)
if (tv->tree.columns) {
for (i = 0; i < tv->tree.nColumns; ++i)
FreeColumn(tv->tree.columns + i);
- ckfree((ClientData)tv->tree.columns);
+ ckfree(tv->tree.columns);
tv->tree.columns = 0;
}
}
@@ -688,8 +688,7 @@ static int TreeviewInitColumns(Tcl_Interp *interp, Treeview *tv)
* Initialize columns array and columnNames hash table:
*/
tv->tree.nColumns = ncols;
- tv->tree.columns =
- (TreeColumn*)ckalloc(tv->tree.nColumns * sizeof(TreeColumn));
+ tv->tree.columns = ckalloc(tv->tree.nColumns * sizeof(TreeColumn));
for (i = 0; i < ncols; ++i) {
int isNew;
@@ -734,16 +733,16 @@ static int TreeviewInitDisplayColumns(Tcl_Interp *interp, Treeview *tv)
if (!strcmp(Tcl_GetString(tv->tree.displayColumnsObj), "#all")) {
ndcols = tv->tree.nColumns;
- displayColumns = (TreeColumn**)ckalloc((ndcols+1)*sizeof(TreeColumn*));
+ displayColumns = ckalloc((ndcols+1) * sizeof(TreeColumn*));
for (index = 0; index < ndcols; ++index) {
displayColumns[index+1] = tv->tree.columns + index;
}
} else {
- displayColumns = (TreeColumn**)ckalloc((ndcols+1)*sizeof(TreeColumn*));
+ displayColumns = ckalloc((ndcols+1) * sizeof(TreeColumn*));
for (index = 0; index < ndcols; ++index) {
displayColumns[index+1] = GetColumn(interp, tv, dcolumns[index]);
if (!displayColumns[index+1]) {
- ckfree((ClientData)displayColumns);
+ ckfree(displayColumns);
return TCL_ERROR;
}
}
@@ -751,7 +750,7 @@ static int TreeviewInitDisplayColumns(Tcl_Interp *interp, Treeview *tv)
displayColumns[0] = &tv->tree.column0;
if (tv->tree.displayColumns)
- ckfree((ClientData)tv->tree.displayColumns);
+ ckfree(tv->tree.displayColumns);
tv->tree.displayColumns = displayColumns;
tv->tree.nDisplayColumns = ndcols + 1;
@@ -1987,7 +1986,7 @@ static int TreeviewChildrenCommand(
*/
for (i=0; newChildren[i]; ++i) {
if (!AncestryCheck(interp, tv, newChildren[i], item)) {
- ckfree((ClientData)newChildren);
+ ckfree(newChildren);
return TCL_ERROR;
}
}
@@ -2023,7 +2022,7 @@ static int TreeviewChildrenCommand(
child = newChildren[i];
}
- ckfree((ClientData)newChildren);
+ ckfree(newChildren);
TtkRedisplayWidget(&tv->core);
}
@@ -2649,7 +2648,7 @@ static int TreeviewDetachCommand(
for (i = 0; items[i]; ++i) {
if (items[i] == tv->tree.root) {
Tcl_AppendResult(interp, "Cannot detach root item", NULL);
- ckfree((ClientData)items);
+ ckfree(items);
return TCL_ERROR;
}
}
@@ -2659,7 +2658,7 @@ static int TreeviewDetachCommand(
}
TtkRedisplayWidget(&tv->core);
- ckfree((ClientData)items);
+ ckfree(items);
return TCL_OK;
}
@@ -2695,7 +2694,7 @@ static int TreeviewDeleteCommand(
*/
for (i=0; items[i]; ++i) {
if (items[i] == tv->tree.root) {
- ckfree((ClientData)items);
+ ckfree(items);
Tcl_AppendResult(interp, "Cannot delete root item", NULL);
return TCL_ERROR;
}
@@ -2720,7 +2719,7 @@ static int TreeviewDeleteCommand(
delq = next;
}
- ckfree((ClientData)items);
+ ckfree(items);
TtkRedisplayWidget(&tv->core);
return TCL_OK;
}
@@ -2989,7 +2988,7 @@ static int TreeviewSelectionCommand(
break;
}
- ckfree((ClientData)items);
+ ckfree(items);
TtkSendVirtualEvent(tv->core.tkwin, "TreeviewSelect");
TtkRedisplayWidget(&tv->core);