diff options
Diffstat (limited to 'generic/tkTextBTree.c')
-rw-r--r-- | generic/tkTextBTree.c | 205 |
1 files changed, 102 insertions, 103 deletions
diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c index 67ff79d..e34dae7 100644 --- a/generic/tkTextBTree.c +++ b/generic/tkTextBTree.c @@ -273,9 +273,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; @@ -296,7 +296,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; @@ -306,7 +306,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; @@ -314,7 +314,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; @@ -478,10 +478,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); } /* @@ -543,7 +543,7 @@ TkBTreeRemoveClient( */ DestroyNode(treePtr->rootPtr); - ckfree((char *) treePtr); + ckfree(treePtr); return; } else if (pixelReference == -1) { /* @@ -632,11 +632,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) @@ -652,11 +650,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) { @@ -739,7 +735,7 @@ AdjustPixelClient( *counting = 0; } if (newPixelReferences != treePtr->pixelReferences) { - linePtr->pixels = (int *) ckrealloc((char *) linePtr->pixels, + linePtr->pixels = ckrealloc(linePtr->pixels, sizeof(int) * 2 * newPixelReferences); } @@ -756,7 +752,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; @@ -805,7 +801,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) { @@ -826,7 +822,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; @@ -865,10 +861,10 @@ DestroyNode( while (linePtr->segPtr != NULL) { segPtr = linePtr->segPtr; linePtr->segPtr = segPtr->nextPtr; - (*segPtr->typePtr->deleteProc)(segPtr, linePtr, 1); + segPtr->typePtr->deleteProc(segPtr, linePtr, 1); } - ckfree((char *) linePtr->pixels); - ckfree((char *) linePtr); + ckfree(linePtr->pixels); + ckfree(linePtr); } } else { register Node *childPtr; @@ -880,8 +876,8 @@ DestroyNode( } } DeleteSummaries(nodePtr->summaryPtr); - ckfree((char *) nodePtr->numPixels); - ckfree((char *) nodePtr); + ckfree(nodePtr->numPixels); + ckfree(nodePtr); } /* @@ -910,7 +906,7 @@ DeleteSummaries( while (summaryPtr != NULL) { nextPtr = summaryPtr->nextPtr; - ckfree((char *) summaryPtr); + ckfree(summaryPtr); summaryPtr = nextPtr; } } @@ -1047,8 +1043,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; } @@ -1064,7 +1059,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; @@ -1086,8 +1081,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; @@ -1147,7 +1142,7 @@ TkBTreeInsertChars( } } if (treePtr->pixelReferences > PIXEL_CLIENTS) { - ckfree((char *) changeToPixelCount); + ckfree(changeToPixelCount); } nodePtr = linePtr->parentPtr; @@ -1205,7 +1200,7 @@ SplitSeg( if (count == 0) { return prevPtr; } - segPtr = (*segPtr->typePtr->splitProc)(segPtr, count); + segPtr = segPtr->typePtr->splitProc(segPtr, count); if (prevPtr == NULL) { indexPtr->linePtr->segPtr = segPtr; } else { @@ -1231,8 +1226,9 @@ SplitSeg( /* * Reached end of the text. */ + } else { + segPtr = linePtr->segPtr; } - segPtr = linePtr->segPtr; } } Tcl_Panic("SplitSeg reached end of line!"); @@ -1280,7 +1276,7 @@ CleanupLine( segPtr != NULL; prevPtrPtr = &(*prevPtrPtr)->nextPtr, segPtr = *prevPtrPtr) { if (segPtr->typePtr->cleanupProc != NULL) { - *prevPtrPtr = (*segPtr->typePtr->cleanupProc)(segPtr, linePtr); + *prevPtrPtr = segPtr->typePtr->cleanupProc(segPtr, linePtr); if (segPtr != *prevPtrPtr) { anyChanges = 1; } @@ -1387,6 +1383,7 @@ TkBTreeDeleteIndexRange( } } changeToLineCount++; + CLANG_ASSERT(curNodePtr); curNodePtr->numChildren--; /* @@ -1417,8 +1414,8 @@ TkBTreeDeleteIndexRange( checkCount++; } } - ckfree((char *) curLinePtr->pixels); - ckfree((char *) curLinePtr); + ckfree(curLinePtr->pixels); + ckfree(curLinePtr); } curLinePtr = nextLinePtr; segPtr = curLinePtr->segPtr; @@ -1442,7 +1439,7 @@ TkBTreeDeleteIndexRange( prevNodePtr->nextPtr = curNodePtr->nextPtr; } parentPtr->numChildren--; - ckfree((char *) curNodePtr); + ckfree(curNodePtr); curNodePtr = parentPtr; } curNodePtr = curLinePtr->parentPtr; @@ -1450,7 +1447,7 @@ TkBTreeDeleteIndexRange( } nextPtr = segPtr->nextPtr; - if ((*segPtr->typePtr->deleteProc)(segPtr, curLinePtr, 0) != 0) { + if (segPtr->typePtr->deleteProc(segPtr, curLinePtr, 0) != 0) { /* * This segment refuses to die. Move it to prevPtr and advance * prevPtr if the segment has left gravity. @@ -1481,7 +1478,7 @@ TkBTreeDeleteIndexRange( for (segPtr = lastPtr; segPtr != NULL; segPtr = segPtr->nextPtr) { if (segPtr->typePtr->lineChangeProc != NULL) { - (*segPtr->typePtr->lineChangeProc)(segPtr, index2Ptr->linePtr); + segPtr->typePtr->lineChangeProc(segPtr, index2Ptr->linePtr); } } curNodePtr = index2Ptr->linePtr->parentPtr; @@ -1537,8 +1534,8 @@ TkBTreeDeleteIndexRange( checkCount++; } } - ckfree((char *) index2Ptr->linePtr->pixels); - ckfree((char *) index2Ptr->linePtr); + ckfree(index2Ptr->linePtr->pixels); + ckfree(index2Ptr->linePtr); Rebalance((BTree *) index2Ptr->tree, curNodePtr); } @@ -2158,7 +2155,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) { @@ -2203,7 +2200,7 @@ TkBTreeTag( } else { changed = 0; } - ckfree((char *) segPtr); + ckfree(segPtr); /* * The code below is a bit tricky. After deleting a toggle we @@ -2229,7 +2226,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) { @@ -2354,7 +2351,7 @@ ChangeNodeToggleCount( } else { prevPtr->nextPtr = summaryPtr->nextPtr; } - ckfree((char *) summaryPtr); + ckfree(summaryPtr); } else { /* * This tag isn't currently in the summary information list. @@ -2373,7 +2370,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; @@ -2382,7 +2379,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; @@ -2439,7 +2436,7 @@ ChangeNodeToggleCount( } else { prevPtr->nextPtr = summaryPtr->nextPtr; } - ckfree((char *) summaryPtr); + ckfree(summaryPtr); tagPtr->tagRootPtr = node2Ptr; break; } @@ -2488,7 +2485,7 @@ FindTagStart( * level 0 node. */ - while (nodePtr->level > 0) { + while (nodePtr && nodePtr->level > 0) { for (nodePtr = nodePtr->children.nodePtr ; nodePtr != NULL; nodePtr = nodePtr->nextPtr) { for (summaryPtr = nodePtr->summaryPtr ; summaryPtr != NULL; @@ -2502,6 +2499,10 @@ FindTagStart( continue; } + if (nodePtr == NULL) { + return NULL; + } + /* * Work through the lines attached to the level-0 node. */ @@ -2569,7 +2570,7 @@ FindTagEnd( * level 0 node. */ - while (nodePtr->level > 0) { + while (nodePtr && nodePtr->level > 0) { for (lastNodePtr = NULL, nodePtr = nodePtr->children.nodePtr ; nodePtr != NULL; nodePtr = nodePtr->nextPtr) { for (summaryPtr = nodePtr->summaryPtr ; summaryPtr != NULL; @@ -2583,6 +2584,10 @@ FindTagEnd( nodePtr = lastNodePtr; } + if (nodePtr == NULL) { + return NULL; + } + /* * Work through the lines attached to the level-0 node. */ @@ -2952,7 +2957,7 @@ TkBTreeNextTag( } searchPtr->linesLeft -= nodePtr->numLines; if (nodePtr->nextPtr == NULL) { - Tcl_Panic("TkBTreeNextTag found incorrect tag summary info."); + Tcl_Panic("TkBTreeNextTag found incorrect tag summary info"); } } nextChild: @@ -3170,7 +3175,7 @@ TkBTreePrevTag( continue; } if (prevNodePtr == NULL) { - Tcl_Panic("TkBTreePrevTag found incorrect tag summary info."); + Tcl_Panic("TkBTreePrevTag found incorrect tag summary info"); } searchPtr->linesLeft -= linesSkipped; nodePtr = prevNodePtr; @@ -3350,10 +3355,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. @@ -3438,9 +3441,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; @@ -3497,8 +3500,7 @@ TkTextIsElided( int elide; if (elideInfo == NULL) { - infoPtr = (TkTextElideInfo *) - ckalloc((unsigned) sizeof(TkTextElideInfo)); + infoPtr = ckalloc(sizeof(TkTextElideInfo)); } else { infoPtr = elideInfo; } @@ -3513,10 +3515,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++) { @@ -3645,11 +3645,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; @@ -3678,8 +3678,8 @@ TkTextFreeElideInfo( * structure. */ { if (LOTSA_TAGS < elideInfo->numTags) { - ckfree((char *) elideInfo->tagCnts); - ckfree((char *) elideInfo->tagPtrs); + ckfree(elideInfo->tagCnts); + ckfree(elideInfo->tagPtrs); } } @@ -3730,16 +3730,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; } @@ -3787,7 +3786,7 @@ TkBTreeCheck( for (entryPtr=Tcl_FirstHashEntry(&treePtr->sharedTextPtr->tagTable,&search); entryPtr != NULL ; entryPtr = Tcl_NextHashEntry(&search)) { - tagPtr = (TkTextTag *) Tcl_GetHashValue(entryPtr); + tagPtr = Tcl_GetHashValue(entryPtr); nodePtr = tagPtr->tagRootPtr; if (nodePtr == NULL) { if (tagPtr->toggleCount != 0) { @@ -3939,7 +3938,7 @@ CheckNodeConsistency( numChildren = 0; numLines = 0; if (references > PIXEL_CLIENTS) { - numPixels = (int *) ckalloc(sizeof(int) * references); + numPixels = ckalloc(sizeof(int) * references); } else { numPixels = pixels; } @@ -3959,7 +3958,7 @@ CheckNodeConsistency( for (segPtr = linePtr->segPtr; segPtr != NULL; segPtr = segPtr->nextPtr) { if (segPtr->typePtr->checkProc != NULL) { - (*segPtr->typePtr->checkProc)(segPtr, linePtr); + segPtr->typePtr->checkProc(segPtr, linePtr); } if ((segPtr->size == 0) && (!segPtr->typePtr->leftGravity) && (segPtr->nextPtr != NULL) @@ -4028,7 +4027,7 @@ CheckNodeConsistency( } } if (references > PIXEL_CLIENTS) { - ckfree((char *) numPixels); + ckfree(numPixels); } for (summaryPtr = nodePtr->summaryPtr; summaryPtr != NULL; @@ -4127,7 +4126,7 @@ Rebalance( */ if (nodePtr->parentPtr == NULL) { - newPtr = (Node *) ckalloc(sizeof(Node)); + newPtr = ckalloc(sizeof(Node)); newPtr->parentPtr = NULL; newPtr->nextPtr = NULL; newPtr->summaryPtr = NULL; @@ -4135,7 +4134,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]; @@ -4143,8 +4142,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; @@ -4201,7 +4200,7 @@ Rebalance( treePtr->rootPtr = nodePtr->children.nodePtr; treePtr->rootPtr->parentPtr = NULL; DeleteSummaries(nodePtr->summaryPtr); - ckfree((char *) nodePtr); + ckfree(nodePtr); } return; } @@ -4290,7 +4289,7 @@ Rebalance( nodePtr->nextPtr = otherPtr->nextPtr; nodePtr->parentPtr->numChildren--; DeleteSummaries(otherPtr->summaryPtr); - ckfree((char *) otherPtr); + ckfree(otherPtr); continue; } @@ -4300,9 +4299,11 @@ Rebalance( */ if (nodePtr->level == 0) { + CLANG_ASSERT(halfwayLinePtr); otherPtr->children.linePtr = halfwayLinePtr->nextPtr; halfwayLinePtr->nextPtr = NULL; } else { + CLANG_ASSERT(halfwayNodePtr); otherPtr->children.nodePtr = halfwayNodePtr->nextPtr; halfwayNodePtr->nextPtr = NULL; } @@ -4386,7 +4387,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; @@ -4414,7 +4415,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; @@ -4463,11 +4464,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; } } @@ -4567,9 +4568,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; @@ -4580,7 +4580,7 @@ CharSplitProc( newPtr2->size = segPtr->size - index; memcpy(newPtr2->body.chars, segPtr->body.chars + index, newPtr2->size); newPtr2->body.chars[newPtr2->size] = 0; - ckfree((char *) segPtr); + ckfree(segPtr); return newPtr1; } @@ -4615,16 +4615,15 @@ 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; memcpy(newPtr->body.chars, segPtr->body.chars, segPtr->size); memcpy(newPtr->body.chars + segPtr->size, segPtr2->body.chars, segPtr2->size); newPtr->body.chars[newPtr->size] = 0; - ckfree((char *) segPtr); - ckfree((char *) segPtr2); + ckfree(segPtr); + ckfree(segPtr2); return newPtr; } @@ -4653,7 +4652,7 @@ CharDeleteProc( * deleted, so everything must get cleaned * up. */ { - ckfree((char *) segPtr); + ckfree(segPtr); return 0; } @@ -4729,7 +4728,7 @@ ToggleDeleteProc( * up. */ { if (treeGone) { - ckfree((char *) segPtr); + ckfree(segPtr); return 0; } @@ -4803,9 +4802,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; } } |