diff options
author | joye <joye> | 2013-08-28 18:47:33 (GMT) |
---|---|---|
committer | joye <joye> | 2013-08-28 18:47:33 (GMT) |
commit | 005cfbd176083223ec47d4613034ae2a15a79b9c (patch) | |
tree | 39721d26ffa5942a4333b06e7bd61e760612cce1 | |
parent | 48974a09f23839821ca95f228fc0f3f53bb1cefa (diff) | |
download | blt-005cfbd176083223ec47d4613034ae2a15a79b9c.zip blt-005cfbd176083223ec47d4613034ae2a15a79b9c.tar.gz blt-005cfbd176083223ec47d4613034ae2a15a79b9c.tar.bz2 |
*** empty log message ***
-rw-r--r-- | src/bltChain.C | 18 | ||||
-rw-r--r-- | src/bltConfig.C | 16 | ||||
-rw-r--r-- | src/bltGrAxis.C | 58 | ||||
-rw-r--r-- | src/bltGrBind.C | 9 | ||||
-rw-r--r-- | src/bltGrElemBar.C | 82 | ||||
-rw-r--r-- | src/bltGrElemLine.C | 216 | ||||
-rw-r--r-- | src/bltGrElemLineSpline.C | 54 | ||||
-rw-r--r-- | src/bltGrElemOp.C | 42 | ||||
-rw-r--r-- | src/bltGrHairs.C | 4 | ||||
-rw-r--r-- | src/bltGrLegd.C | 4 | ||||
-rw-r--r-- | src/bltGrMarker.C | 60 | ||||
-rw-r--r-- | src/bltGrMisc.C | 16 | ||||
-rw-r--r-- | src/bltGrPSOutput.C | 12 | ||||
-rw-r--r-- | src/bltGrPenOp.C | 4 | ||||
-rw-r--r-- | src/bltGrText.C | 14 | ||||
-rw-r--r-- | src/bltGraph.C | 4 | ||||
-rw-r--r-- | src/bltInt.C | 1 | ||||
-rw-r--r-- | src/bltNsUtil.C | 6 | ||||
-rw-r--r-- | src/bltParse.C | 4 | ||||
-rw-r--r-- | src/bltSwitch.C | 10 | ||||
-rw-r--r-- | src/bltVecCmd.C | 40 | ||||
-rw-r--r-- | src/bltVecMath.C | 26 | ||||
-rw-r--r-- | src/bltVector.C | 68 |
23 files changed, 388 insertions, 380 deletions
diff --git a/src/bltChain.C b/src/bltChain.C index b6051b8..54797e1 100644 --- a/src/bltChain.C +++ b/src/bltChain.C @@ -55,7 +55,7 @@ Blt_Chain_Create(void) { Chain *chainPtr; - chainPtr = Blt_Malloc(sizeof(Chain)); + chainPtr = malloc(sizeof(Chain)); if (chainPtr != NULL) { Blt_Chain_Init(chainPtr); } @@ -82,7 +82,7 @@ Blt_Chain_AllocLink(size_t extraSize) size_t linkSize; linkSize = ALIGN(sizeof(ChainLink)); - linkPtr = Blt_AssertCalloc(1, linkSize + extraSize); + linkPtr = calloc(1, linkSize + extraSize); if (extraSize > 0) { /* Point clientData at the memory beyond the normal structure. */ linkPtr->clientData = (ClientData)((char *)linkPtr + linkSize); @@ -127,7 +127,7 @@ Blt_Chain_NewLink(void) { ChainLink *linkPtr; - linkPtr = Blt_AssertMalloc(sizeof(ChainLink)); + linkPtr = malloc(sizeof(ChainLink)); linkPtr->clientData = NULL; linkPtr->next = linkPtr->prev = NULL; return linkPtr; @@ -157,7 +157,7 @@ Blt_Chain_Reset(Chain *chainPtr) /* Chain to clear */ while (linkPtr != NULL) { oldPtr = linkPtr; linkPtr = linkPtr->next; - Blt_Free(oldPtr); + free(oldPtr); } Blt_Chain_Init(chainPtr); } @@ -182,7 +182,8 @@ Blt_Chain_Destroy(Chain *chainPtr) { if (chainPtr != NULL) { Blt_Chain_Reset(chainPtr); - Blt_Free(chainPtr); + free(chainPtr); + chainPtr = NULL; } } @@ -343,7 +344,8 @@ void Blt_Chain_DeleteLink(Blt_Chain chain, Blt_ChainLink link) { Blt_Chain_UnlinkLink(chain, link); - Blt_Free(link); + free(link); + link = NULL; } /* @@ -465,7 +467,7 @@ Blt_Chain_Sort(Chain *chainPtr, Blt_ChainCompareProc *proc) if (chainPtr->nLinks < 2) { return; } - linkArr = Blt_Malloc(sizeof(Blt_ChainLink) * (chainPtr->nLinks + 1)); + linkArr = malloc(sizeof(Blt_ChainLink) * (chainPtr->nLinks + 1)); if (linkArr == NULL) { return; /* Out of memory. */ } @@ -488,7 +490,7 @@ Blt_Chain_Sort(Chain *chainPtr, Blt_ChainCompareProc *proc) } chainPtr->tail = linkPtr; linkPtr->next = NULL; - Blt_Free(linkArr); + free(linkArr); } diff --git a/src/bltConfig.C b/src/bltConfig.C index cf67a23..863cb0d 100644 --- a/src/bltConfig.C +++ b/src/bltConfig.C @@ -1216,9 +1216,10 @@ DoConfig( char *value; value = (objIsEmpty) ? NULL : - Blt_AssertStrdup(Tcl_GetString(objPtr)); + Blt_Strdup(Tcl_GetString(objPtr)); if (*(char **)ptr != NULL) { - Blt_Free(*(char **)ptr); + free(*(char **)ptr); + *((char **) ptr) = NULL; } *(char **)ptr = value; } @@ -1357,7 +1358,8 @@ DoConfig( return TCL_ERROR; } if (*(char ***)ptr != NULL) { - Blt_Free(*(char ***)ptr); + free(*(char ***)ptr); + *((char **) ptr) = NULL; } *(const char ***)ptr = argv; } @@ -2261,7 +2263,7 @@ Blt_FreeOptions( switch (sp->type) { case BLT_CONFIG_STRING: if (*((char **) ptr) != NULL) { - Blt_Free(*((char **) ptr)); + free(*((char **) ptr)); *((char **) ptr) = NULL; } break; @@ -2318,7 +2320,7 @@ Blt_FreeOptions( case BLT_CONFIG_LIST: if (*((char ***) ptr) != NULL) { - Blt_Free(*((char ***) ptr)); + free(*((char ***) ptr)); *((char ***) ptr) = NULL; } break; @@ -2430,7 +2432,7 @@ Blt_ConfigureComponentFromObj( char *tmpName; int isTemporary = FALSE; - tmpName = Blt_AssertStrdup(name); + tmpName = Blt_Strdup(name); /* Window name can't start with an upper case letter */ tmpName[0] = tolower(name[0]); @@ -2450,7 +2452,7 @@ Blt_ConfigureComponentFromObj( return TCL_ERROR; } assert(Tk_Depth(tkwin) == Tk_Depth(parent)); - Blt_Free(tmpName); + free(tmpName); Tk_SetClass(tkwin, className); result = Blt_ConfigureWidgetFromObj(interp, tkwin, sp, objc, objv, widgRec, diff --git a/src/bltGrAxis.C b/src/bltGrAxis.C index f6f54e9..9238e67 100644 --- a/src/bltGrAxis.C +++ b/src/bltGrAxis.C @@ -543,7 +543,7 @@ FreeFormatProc( Axis *axisPtr = (Axis *)(widgRec); if (axisPtr->limitsFormats != NULL) { - Blt_Free(axisPtr->limitsFormats); + free(axisPtr->limitsFormats); axisPtr->limitsFormats = NULL; } axisPtr->nFormats = 0; @@ -584,11 +584,11 @@ ObjToFormatProc( if (argc > 2) { Tcl_AppendResult(interp, "too many elements in limits format list \"", Tcl_GetString(objPtr), "\"", (char *)NULL); - Blt_Free(argv); + free(argv); return TCL_ERROR; } if (axisPtr->limitsFormats != NULL) { - Blt_Free(axisPtr->limitsFormats); + free(axisPtr->limitsFormats); } axisPtr->limitsFormats = argv; axisPtr->nFormats = argc; @@ -623,11 +623,11 @@ FormatToObjProc( if (axisPtr->nFormats == 0) { objPtr = Tcl_NewStringObj("", -1); } else { - const char *string; + char *string; string = Tcl_Merge(axisPtr->nFormats, axisPtr->limitsFormats); objPtr = Tcl_NewStringObj(string, -1); - Blt_Free(string); + free(string); } return objPtr; } @@ -833,7 +833,7 @@ FreeTicksProc( axisPtr->flags |= mask; if (*ticksPtrPtr != NULL) { - Blt_Free(*ticksPtrPtr); + free(*ticksPtrPtr); } *ticksPtrPtr = NULL; } @@ -875,12 +875,12 @@ ObjToTicksProc( if (objc > 0) { int i; - ticksPtr = Blt_AssertMalloc(sizeof(Ticks) + (objc*sizeof(double))); + ticksPtr = malloc(sizeof(Ticks) + (objc*sizeof(double))); for (i = 0; i < objc; i++) { double value; if (Blt_ExprDoubleFromObj(interp, objv[i], &value) != TCL_OK) { - Blt_Free(ticksPtr); + free(ticksPtr); return TCL_ERROR; } ticksPtr->values[i] = value; @@ -1057,7 +1057,7 @@ FreeTickLabels(Blt_Chain chain) TickLabel *labelPtr; labelPtr = Blt_Chain_GetValue(link); - Blt_Free(labelPtr); + free(labelPtr); } Blt_Chain_Reset(chain); } @@ -1121,7 +1121,7 @@ MakeLabel(Axis *axisPtr, double value) Tcl_ResetResult(interp); /* Clear the interpreter's result. */ } } - labelPtr = Blt_AssertMalloc(sizeof(TickLabel) + strlen(string)); + labelPtr = malloc(sizeof(TickLabel) + strlen(string)); strcpy(labelPtr->string, string); labelPtr->anchorPos.x = labelPtr->anchorPos.y = DBL_MAX; return labelPtr; @@ -1476,7 +1476,7 @@ GenerateTicks(TickSweep *sweepPtr) { Ticks *ticksPtr; - ticksPtr = Blt_AssertMalloc(sizeof(Ticks) + + ticksPtr = malloc(sizeof(Ticks) + (sweepPtr->nSteps * sizeof(double))); ticksPtr->nTicks = 0; @@ -1798,13 +1798,13 @@ SweepTicks(Axis *axisPtr) { if (axisPtr->flags & AXIS_AUTO_MAJOR) { if (axisPtr->t1Ptr != NULL) { - Blt_Free(axisPtr->t1Ptr); + free(axisPtr->t1Ptr); } axisPtr->t1Ptr = GenerateTicks(&axisPtr->majorSweep); } if (axisPtr->flags & AXIS_AUTO_MINOR) { if (axisPtr->t2Ptr != NULL) { - Blt_Free(axisPtr->t2Ptr); + free(axisPtr->t2Ptr); } axisPtr->t2Ptr = GenerateTicks(&axisPtr->minorSweep); } @@ -2022,7 +2022,7 @@ DestroyAxis(Axis *axisPtr) Blt_Chain_DeleteLink(axisPtr->chain, axisPtr->link); } if (axisPtr->obj.name != NULL) { - Blt_Free(axisPtr->obj.name); + free(axisPtr->obj.name); } if (axisPtr->hashPtr != NULL) { Blt_DeleteHashEntry(&graphPtr->axes.table, axisPtr->hashPtr); @@ -2044,9 +2044,10 @@ DestroyAxis(Axis *axisPtr) FreeTickLabels(axisPtr->tickLabels); Blt_Chain_Destroy(axisPtr->tickLabels); if (axisPtr->segments != NULL) { - Blt_Free(axisPtr->segments); + free(axisPtr->segments); } - Blt_Free(axisPtr); + free(axisPtr); + axisPtr = NULL; } static void @@ -2433,7 +2434,8 @@ MakeSegments(Axis *axisPtr, AxisInfo *infoPtr) Segment2d *sp; if (axisPtr->segments != NULL) { - Blt_Free(axisPtr->segments); + free(axisPtr->segments); + axisPtr->segments = NULL; } nMajorTicks = nMinorTicks = 0; if (axisPtr->t1Ptr != NULL) { @@ -2443,7 +2445,7 @@ MakeSegments(Axis *axisPtr, AxisInfo *infoPtr) nMinorTicks = axisPtr->t2Ptr->nTicks; } arraySize = 1 + (nMajorTicks * (nMinorTicks + 1)); - segments = Blt_AssertMalloc(arraySize * sizeof(Segment2d)); + segments = malloc(arraySize * sizeof(Segment2d)); sp = segments; if (axisPtr->lineWidth > 0) { /* Axis baseline */ @@ -3015,17 +3017,19 @@ MapGridlines(Axis *axisPtr) needed = t1Ptr->nTicks; if (needed != axisPtr->major.nAllocated) { if (axisPtr->major.segments != NULL) { - Blt_Free(axisPtr->major.segments); + free(axisPtr->major.segments); + axisPtr->major.segments = NULL; } - axisPtr->major.segments = Blt_AssertMalloc(sizeof(Segment2d) * needed); + axisPtr->major.segments = malloc(sizeof(Segment2d) * needed); axisPtr->major.nAllocated = needed; } needed = (t1Ptr->nTicks * t2Ptr->nTicks); if (needed != axisPtr->minor.nAllocated) { if (axisPtr->minor.segments != NULL) { - Blt_Free(axisPtr->minor.segments); + free(axisPtr->minor.segments); + axisPtr->minor.segments = NULL; } - axisPtr->minor.segments = Blt_AssertMalloc(sizeof(Segment2d) * needed); + axisPtr->minor.segments = malloc(sizeof(Segment2d) * needed); axisPtr->minor.nAllocated = needed; } s1 = axisPtr->major.segments, s2 = axisPtr->minor.segments; @@ -3053,10 +3057,10 @@ MapGridlines(Axis *axisPtr) } } if (t1Ptr != axisPtr->t1Ptr) { - Blt_Free(t1Ptr); /* Free generated ticks. */ + free(t1Ptr); /* Free generated ticks. */ } if (t2Ptr != axisPtr->t2Ptr) { - Blt_Free(t2Ptr); /* Free generated ticks. */ + free(t2Ptr); /* Free generated ticks. */ } axisPtr->major.nUsed = s1 - axisPtr->major.segments; axisPtr->minor.nUsed = s2 - axisPtr->minor.segments; @@ -3805,13 +3809,13 @@ NewAxis(Graph *graphPtr, const char *name, int margin) } axisPtr->flags &= ~DELETE_PENDING; } else { - axisPtr = Blt_Calloc(1, sizeof(Axis)); + axisPtr = calloc(1, sizeof(Axis)); if (axisPtr == NULL) { Tcl_AppendResult(graphPtr->interp, "can't allocate memory for axis \"", name, "\"", (char *)NULL); return NULL; } - axisPtr->obj.name = Blt_AssertStrdup(name); + axisPtr->obj.name = Blt_Strdup(name); axisPtr->hashPtr = hPtr; Blt_GraphSetObjectClass(&axisPtr->obj, CID_NONE); axisPtr->obj.graphPtr = graphPtr; @@ -5702,7 +5706,7 @@ TimeGenerateTicks(TickSweep *sweepPtr) { Ticks *ticksPtr; - ticksPtr = Blt_AssertMalloc(sizeof(Ticks) + + ticksPtr = malloc(sizeof(Ticks) + (sweepPtr->nSteps * sizeof(double))); ticksPtr->nTicks = 0; diff --git a/src/bltGrBind.C b/src/bltGrBind.C index 7b288f7..d4d189c 100644 --- a/src/bltGrBind.C +++ b/src/bltGrBind.C @@ -133,7 +133,7 @@ DoEvent( tagArray = staticTags; nTags = Blt_List_GetLength(tagList); if (nTags >= MAX_STATIC_TAGS) { - tagArray = Blt_AssertMalloc(sizeof(ClientData) * nTags); + tagArray = malloc(sizeof(ClientData) * nTags); } nTags = 0; @@ -144,7 +144,7 @@ DoEvent( Tk_BindEvent(bindPtr->bindingTable, eventPtr, bindPtr->tkwin, nTags, tagArray); if (tagArray != staticTags) { - Blt_Free(tagArray); + free(tagArray); } } Blt_List_Destroy(tagList); @@ -607,7 +607,7 @@ Blt_CreateBindingTable( unsigned int mask; BindTable *bindPtr; - bindPtr = Blt_AssertCalloc(1, sizeof(BindTable)); + bindPtr = calloc(1, sizeof(BindTable)); bindPtr->bindingTable = Tk_CreateBindingTable(interp); bindPtr->clientData = clientData; bindPtr->tkwin = tkwin; @@ -630,7 +630,8 @@ Blt_DestroyBindingTable(BindTable *bindPtr) ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask); Tk_DeleteEventHandler(bindPtr->tkwin, mask, BindProc, bindPtr); - Blt_Free(bindPtr); + free(bindPtr); + bindPtr = NULL; } void diff --git a/src/bltGrElemBar.C b/src/bltGrElemBar.C index 328275a..4e472fd 100644 --- a/src/bltGrElemBar.C +++ b/src/bltGrElemBar.C @@ -681,9 +681,9 @@ Blt_BarPen(const char *penName) { BarPen *penPtr; - penPtr = Blt_AssertCalloc(1, sizeof(BarPen)); + penPtr = calloc(1, sizeof(BarPen)); InitializeBarPen(penPtr); - penPtr->name = Blt_AssertStrdup(penName); + penPtr->name = Blt_Strdup(penName); if (strcmp(penName, "activeBar") == 0) { penPtr->flags = ACTIVE_PEN; } @@ -1052,8 +1052,8 @@ MergePens(BarElement *elemPtr, BarStyle **dataToStyle) XRectangle *bars, *bp; int *ip, *barToData; - bars = Blt_AssertMalloc(elemPtr->nBars * sizeof(XRectangle)); - barToData = Blt_AssertMalloc(elemPtr->nBars * sizeof(int)); + bars = malloc(elemPtr->nBars * sizeof(XRectangle)); + barToData = malloc(elemPtr->nBars * sizeof(int)); bp = bars, ip = barToData; for (link = Blt_Chain_FirstLink(elemPtr->stylePalette); link != NULL; link = Blt_Chain_NextLink(link)) { @@ -1074,8 +1074,8 @@ MergePens(BarElement *elemPtr, BarStyle **dataToStyle) } stylePtr->nBars = bp - stylePtr->bars; } - Blt_Free(elemPtr->bars); - Blt_Free(elemPtr->barToData); + free(elemPtr->bars); + free(elemPtr->barToData); elemPtr->bars = bars; elemPtr->barToData = barToData; } @@ -1085,8 +1085,8 @@ MergePens(BarElement *elemPtr, BarStyle **dataToStyle) Segment2d *bars, *sp; int *map, *ip; - bars = Blt_AssertMalloc(elemPtr->xeb.length * sizeof(Segment2d)); - map = Blt_AssertMalloc(elemPtr->xeb.length * sizeof(int)); + bars = malloc(elemPtr->xeb.length * sizeof(Segment2d)); + map = malloc(elemPtr->xeb.length * sizeof(int)); sp = bars, ip = map; for (link = Blt_Chain_FirstLink(elemPtr->stylePalette); link != NULL; link = Blt_Chain_NextLink(link)) { @@ -1106,9 +1106,9 @@ MergePens(BarElement *elemPtr, BarStyle **dataToStyle) } stylePtr->xeb.length = sp - stylePtr->xeb.segments; } - Blt_Free(elemPtr->xeb.segments); + free(elemPtr->xeb.segments); elemPtr->xeb.segments = bars; - Blt_Free(elemPtr->xeb.map); + free(elemPtr->xeb.map); elemPtr->xeb.map = map; } if (elemPtr->yeb.length > 0) { @@ -1116,8 +1116,8 @@ MergePens(BarElement *elemPtr, BarStyle **dataToStyle) Segment2d *bars, *sp; int *map, *ip; - bars = Blt_AssertMalloc(elemPtr->yeb.length * sizeof(Segment2d)); - map = Blt_AssertMalloc(elemPtr->yeb.length * sizeof(int)); + bars = malloc(elemPtr->yeb.length * sizeof(Segment2d)); + map = malloc(elemPtr->yeb.length * sizeof(int)); sp = bars, ip = map; for (link = Blt_Chain_FirstLink(elemPtr->stylePalette); link != NULL; link = Blt_Chain_NextLink(link)) { @@ -1137,9 +1137,9 @@ MergePens(BarElement *elemPtr, BarStyle **dataToStyle) } stylePtr->yeb.length = sp - stylePtr->yeb.segments; } - Blt_Free(elemPtr->yeb.segments); + free(elemPtr->yeb.segments); elemPtr->yeb.segments = bars; - Blt_Free(elemPtr->yeb.map); + free(elemPtr->yeb.map); elemPtr->yeb.map = map; } } @@ -1163,11 +1163,11 @@ static void MapActiveBars(BarElement *elemPtr) { if (elemPtr->activeRects != NULL) { - Blt_Free(elemPtr->activeRects); + free(elemPtr->activeRects); elemPtr->activeRects = NULL; } if (elemPtr->activeToData != NULL) { - Blt_Free(elemPtr->activeToData); + free(elemPtr->activeToData); elemPtr->activeToData = NULL; } elemPtr->nActive = 0; @@ -1178,9 +1178,9 @@ MapActiveBars(BarElement *elemPtr) int i; int count; - activeRects = Blt_AssertMalloc(sizeof(XRectangle) * + activeRects = malloc(sizeof(XRectangle) * elemPtr->nActiveIndices); - activeToData = Blt_AssertMalloc(sizeof(int) * + activeToData = malloc(sizeof(int) * elemPtr->nActiveIndices); count = 0; for (i = 0; i < elemPtr->nBars; i++) { @@ -1208,28 +1208,28 @@ ResetBar(BarElement *elemPtr) /* Release any storage associated with the display of the bar */ ResetStylePalette(elemPtr->stylePalette); if (elemPtr->activeRects != NULL) { - Blt_Free(elemPtr->activeRects); + free(elemPtr->activeRects); } if (elemPtr->activeToData != NULL) { - Blt_Free(elemPtr->activeToData); + free(elemPtr->activeToData); } if (elemPtr->xeb.segments != NULL) { - Blt_Free(elemPtr->xeb.segments); + free(elemPtr->xeb.segments); } if (elemPtr->xeb.map != NULL) { - Blt_Free(elemPtr->xeb.map); + free(elemPtr->xeb.map); } if (elemPtr->yeb.segments != NULL) { - Blt_Free(elemPtr->yeb.segments); + free(elemPtr->yeb.segments); } if (elemPtr->yeb.map != NULL) { - Blt_Free(elemPtr->yeb.map); + free(elemPtr->yeb.map); } if (elemPtr->bars != NULL) { - Blt_Free(elemPtr->bars); + free(elemPtr->bars); } if (elemPtr->barToData != NULL) { - Blt_Free(elemPtr->barToData); + free(elemPtr->barToData); } elemPtr->activeToData = elemPtr->xeb.map = elemPtr->yeb.map = elemPtr->barToData = NULL; @@ -1275,8 +1275,8 @@ MapErrorBars(Graph *graphPtr, BarElement *elemPtr, BarStyle **dataToStyle) int *indexPtr; int i; - segPtr = bars = Blt_AssertMalloc(n * 3 * sizeof(Segment2d)); - indexPtr = map = Blt_AssertMalloc(n * 3 * sizeof(int)); + segPtr = bars = malloc(n * 3 * sizeof(Segment2d)); + indexPtr = map = malloc(n * 3 * sizeof(int)); for (i = 0; i < n; i++) { double x, y; double high, low; @@ -1339,8 +1339,8 @@ MapErrorBars(Graph *graphPtr, BarElement *elemPtr, BarStyle **dataToStyle) int *indexPtr; int i; - segPtr = bars = Blt_AssertMalloc(n * 3 * sizeof(Segment2d)); - indexPtr = map = Blt_AssertMalloc(n * 3 * sizeof(int)); + segPtr = bars = malloc(n * 3 * sizeof(Segment2d)); + indexPtr = map = malloc(n * 3 * sizeof(int)); for (i = 0; i < n; i++) { double x, y; double high, low; @@ -1446,8 +1446,8 @@ MapBarProc(Graph *graphPtr, Element *basePtr) * Create an array of bars representing the screen coordinates of all the * segments in the bar. */ - bars = Blt_AssertCalloc(nPoints, sizeof(XRectangle)); - barToData = Blt_AssertCalloc(nPoints, sizeof(int)); + bars = calloc(nPoints, sizeof(XRectangle)); + barToData = calloc(nPoints, sizeof(int)); x = elemPtr->x.values, y = elemPtr->y.values; count = 0; @@ -1647,7 +1647,7 @@ MapBarProc(Graph *graphPtr, Element *basePtr) MapErrorBars(graphPtr, elemPtr, dataToStyle); } MergePens(elemPtr, dataToStyle); - Blt_Free(dataToStyle); + free(dataToStyle); } /* @@ -2225,7 +2225,7 @@ DestroyBarProc(Graph *graphPtr, Element *basePtr) Blt_Chain_Destroy(elemPtr->stylePalette); } if (elemPtr->activeIndices != NULL) { - Blt_Free(elemPtr->activeIndices); + free(elemPtr->activeIndices); } } @@ -2265,15 +2265,15 @@ Blt_BarElement(Graph *graphPtr, const char *name, ClassId classId) { BarElement *elemPtr; - elemPtr = Blt_AssertCalloc(1, sizeof(BarElement)); + elemPtr = calloc(1, sizeof(BarElement)); elemPtr->procsPtr = &barProcs; elemPtr->configSpecs = barElemConfigSpecs; elemPtr->legendRelief = TK_RELIEF_FLAT; Blt_GraphSetObjectClass(&elemPtr->obj, classId); - elemPtr->obj.name = Blt_AssertStrdup(name); + elemPtr->obj.name = Blt_Strdup(name); elemPtr->obj.graphPtr = graphPtr; /* By default, an element's name and label are the same. */ - elemPtr->label = Blt_AssertStrdup(name); + elemPtr->label = Blt_Strdup(name); elemPtr->builtinPenPtr = &elemPtr->builtinPen; InitializeBarPen(elemPtr->builtinPenPtr); elemPtr->stylePalette = Blt_Chain_Create(); @@ -2352,7 +2352,7 @@ Blt_InitBarSetTable(Graph *graphPtr) key.axes.y = NULL; hPtr = Blt_CreateHashEntry(&setTable, (char *)&key, &isNew); if (isNew) { - tablePtr = Blt_AssertMalloc(sizeof(Blt_HashTable)); + tablePtr = malloc(sizeof(Blt_HashTable)); Blt_InitHashTable(tablePtr, BLT_STRING_KEYS); Blt_SetHashValue(hPtr, tablePtr); } else { @@ -2396,7 +2396,7 @@ Blt_InitBarSetTable(Graph *graphPtr) Blt_HashEntry *hPtr; Blt_HashSearch iter; - graphPtr->barGroups = Blt_AssertCalloc(sum, sizeof(BarGroup)); + graphPtr->barGroups = calloc(sum, sizeof(BarGroup)); groupPtr = graphPtr->barGroups; for (hPtr = Blt_FirstHashEntry(&graphPtr->setTable, &iter); hPtr != NULL; hPtr = Blt_NextHashEntry(&iter)) { @@ -2526,7 +2526,7 @@ Blt_DestroyBarSets(Graph *graphPtr) Blt_HashEntry *hPtr; if (graphPtr->barGroups != NULL) { - Blt_Free(graphPtr->barGroups); + free(graphPtr->barGroups); graphPtr->barGroups = NULL; } graphPtr->nBarGroups = 0; @@ -2536,7 +2536,7 @@ Blt_DestroyBarSets(Graph *graphPtr) tablePtr = Blt_GetHashValue(hPtr); Blt_DeleteHashTable(tablePtr); - Blt_Free(tablePtr); + free(tablePtr); } Blt_DeleteHashTable(&graphPtr->setTable); Blt_InitHashTable(&graphPtr->setTable, sizeof(BarSetKey) / sizeof(int)); diff --git a/src/bltGrElemLine.C b/src/bltGrElemLine.C index 82234da..4028e5b 100644 --- a/src/bltGrElemLine.C +++ b/src/bltGrElemLine.C @@ -1437,9 +1437,9 @@ Blt_LinePen(const char *penName) { LinePen *penPtr; - penPtr = Blt_AssertCalloc(1, sizeof(LinePen)); + penPtr = calloc(1, sizeof(LinePen)); InitLinePen(penPtr); - penPtr->name = Blt_AssertStrdup(penName); + penPtr->name = Blt_Strdup(penName); penPtr->classId = CID_ELEM_LINE; if (strcmp(penName, "activeLine") == 0) { penPtr->flags = ACTIVE_PEN; @@ -1552,8 +1552,8 @@ GetScreenPoints(Graph *graphPtr, LineElement *elemPtr, MapInfo *mapPtr) np = NUMBEROFPOINTS(elemPtr); x = elemPtr->x.values; y = elemPtr->y.values; - points = Blt_AssertMalloc(sizeof(Point2d) * np); - map = Blt_AssertMalloc(sizeof(int) * np); + points = malloc(sizeof(Point2d) * np); + map = malloc(sizeof(int) * np); count = 0; /* Count the valid screen coordinates */ if (graphPtr->inverted) { @@ -1603,9 +1603,9 @@ ReducePoints(MapInfo *mapPtr, double tolerance) Point2d *screenPts; int *map, *simple; - simple = Blt_AssertMalloc(mapPtr->nScreenPts * sizeof(int)); - map = Blt_AssertMalloc(mapPtr->nScreenPts * sizeof(int)); - screenPts = Blt_AssertMalloc(mapPtr->nScreenPts * sizeof(Point2d)); + simple = malloc(mapPtr->nScreenPts * sizeof(int)); + map = malloc(mapPtr->nScreenPts * sizeof(int)); + screenPts = malloc(mapPtr->nScreenPts * sizeof(Point2d)); np = Blt_SimplifyLine(mapPtr->screenPts, 0, mapPtr->nScreenPts - 1, tolerance, simple); for (i = 0; i < np; i++) { @@ -1620,9 +1620,9 @@ ReducePoints(MapInfo *mapPtr, double tolerance) fprintf(stderr, "reduced from %d to %d\n", mapPtr->nScreenPts, np); } #endif - Blt_Free(mapPtr->screenPts); - Blt_Free(mapPtr->map); - Blt_Free(simple); + free(mapPtr->screenPts); + free(mapPtr->map); + free(simple); mapPtr->screenPts = screenPts; mapPtr->map = map; mapPtr->nScreenPts = np; @@ -1654,8 +1654,8 @@ GenerateSteps(MapInfo *mapPtr) int *map; newSize = ((mapPtr->nScreenPts - 1) * 2) + 1; - screenPts = Blt_AssertMalloc(newSize * sizeof(Point2d)); - map = Blt_AssertMalloc(sizeof(int) * newSize); + screenPts = malloc(newSize * sizeof(Point2d)); + map = malloc(sizeof(int) * newSize); screenPts[0] = mapPtr->screenPts[0]; map[0] = 0; @@ -1671,8 +1671,8 @@ GenerateSteps(MapInfo *mapPtr) map[count] = map[count + 1] = mapPtr->map[i]; count += 2; } - Blt_Free(mapPtr->screenPts); - Blt_Free(mapPtr->map); + free(mapPtr->screenPts); + free(mapPtr->map); mapPtr->map = map; mapPtr->screenPts = screenPts; mapPtr->nScreenPts = newSize; @@ -1733,8 +1733,8 @@ GenerateSpline(Graph *graphPtr, LineElement *elemPtr, MapInfo *mapPtr) return; } niPts = nOrigPts + extra + 1; - iPts = Blt_AssertMalloc(niPts * sizeof(Point2d)); - map = Blt_AssertMalloc(sizeof(int) * niPts); + iPts = malloc(niPts * sizeof(Point2d)); + map = malloc(sizeof(int) * niPts); /* Populate the x2 array with both the original X-coordinates and extra * X-coordinates for each horizontal pixel that the line segment * contains. */ @@ -1788,11 +1788,11 @@ GenerateSpline(Graph *graphPtr, LineElement *elemPtr, MapInfo *mapPtr) /* The spline interpolation failed. We'll fallback to the current * coordinates and do no smoothing (standard line segments). */ elemPtr->smooth = PEN_SMOOTH_LINEAR; - Blt_Free(iPts); - Blt_Free(map); + free(iPts); + free(map); } else { - Blt_Free(mapPtr->screenPts); - Blt_Free(mapPtr->map); + free(mapPtr->screenPts); + free(mapPtr->map); mapPtr->map = map; mapPtr->screenPts = iPts; mapPtr->nScreenPts = niPts; @@ -1853,8 +1853,8 @@ GenerateParametricSpline(Graph *graphPtr, LineElement *elemPtr, MapInfo *mapPtr) } } niPts = count; - iPts = Blt_AssertMalloc(niPts * sizeof(Point2d)); - map = Blt_AssertMalloc(sizeof(int) * niPts); + iPts = malloc(niPts * sizeof(Point2d)); + map = malloc(sizeof(int) * niPts); /* * FIXME: This is just plain wrong. The spline should be computed @@ -1920,11 +1920,11 @@ GenerateParametricSpline(Graph *graphPtr, LineElement *elemPtr, MapInfo *mapPtr) /* The spline interpolation failed. We will fall back to the current * coordinates and do no smoothing (standard line segments). */ elemPtr->smooth = PEN_SMOOTH_LINEAR; - Blt_Free(iPts); - Blt_Free(map); + free(iPts); + free(map); } else { - Blt_Free(mapPtr->screenPts); - Blt_Free(mapPtr->map); + free(mapPtr->screenPts); + free(mapPtr->map); mapPtr->map = map; mapPtr->screenPts = iPts; mapPtr->nScreenPts = niPts; @@ -1956,8 +1956,8 @@ MapSymbols(Graph *graphPtr, LineElement *elemPtr, MapInfo *mapPtr) int *map; int i, count; - points = Blt_AssertMalloc(sizeof(Point2d) * mapPtr->nScreenPts); - map = Blt_AssertMalloc(sizeof(int) * mapPtr->nScreenPts); + points = malloc(sizeof(Point2d) * mapPtr->nScreenPts); + map = malloc(sizeof(int) * mapPtr->nScreenPts); Blt_GraphExtents(graphPtr, &exts); count = 0; /* Count the number of visible points */ @@ -1999,16 +1999,16 @@ MapActiveSymbols(Graph *graphPtr, LineElement *elemPtr) int count, i, np; if (elemPtr->activePts.points != NULL) { - Blt_Free(elemPtr->activePts.points); + free(elemPtr->activePts.points); elemPtr->activePts.points = NULL; } if (elemPtr->activePts.map != NULL) { - Blt_Free(elemPtr->activePts.map); + free(elemPtr->activePts.map); elemPtr->activePts.map = NULL; } Blt_GraphExtents(graphPtr, &exts); - points = Blt_AssertMalloc(sizeof(Point2d) * elemPtr->nActiveIndices); - map = Blt_AssertMalloc(sizeof(int) * elemPtr->nActiveIndices); + points = malloc(sizeof(Point2d) * elemPtr->nActiveIndices); + map = malloc(sizeof(int) * elemPtr->nActiveIndices); np = NUMBEROFPOINTS(elemPtr); count = 0; /* Count the visible active points */ for (i = 0; i < elemPtr->nActiveIndices; i++) { @@ -2032,8 +2032,8 @@ MapActiveSymbols(Graph *graphPtr, LineElement *elemPtr) elemPtr->activePts.map = map; } else { /* No active points were visible. */ - Blt_Free(points); - Blt_Free(map); + free(points); + free(map); } elemPtr->activePts.length = count; elemPtr->flags &= ~ACTIVE_PENDING; @@ -2064,13 +2064,13 @@ MapStrip(Graph *graphPtr, LineElement *elemPtr, MapInfo *mapPtr) Segment2d *sp; int count; - indices = Blt_AssertMalloc(sizeof(int) * mapPtr->nScreenPts); + indices = malloc(sizeof(int) * mapPtr->nScreenPts); /* * Create array to hold points for line segments (not polyline * coordinates). So allocate twice the number of points. */ - sp = lines = Blt_AssertMalloc(mapPtr->nScreenPts * sizeof(Segment2d)); + sp = lines = malloc(mapPtr->nScreenPts * sizeof(Segment2d)); Blt_GraphExtents(graphPtr, &exts); count = 0; /* Count the number of segments. */ indexPtr = mapPtr->map; @@ -2133,8 +2133,8 @@ MergePens(LineElement *elemPtr, LineStyle **styleMap) int *ip; int *map; - segments = Blt_AssertMalloc(elemPtr->lines.length * sizeof(Segment2d)); - map = Blt_AssertMalloc(elemPtr->lines.length * sizeof(int)); + segments = malloc(elemPtr->lines.length * sizeof(Segment2d)); + map = malloc(elemPtr->lines.length * sizeof(int)); sp = segments, ip = map; for (link = Blt_Chain_FirstLink(elemPtr->styles); link != NULL; link = Blt_Chain_NextLink(link)) { @@ -2154,9 +2154,9 @@ MergePens(LineElement *elemPtr, LineStyle **styleMap) } stylePtr->lines.length = sp - stylePtr->lines.segments; } - Blt_Free(elemPtr->lines.segments); + free(elemPtr->lines.segments); elemPtr->lines.segments = segments; - Blt_Free(elemPtr->lines.map); + free(elemPtr->lines.map); elemPtr->lines.map = map; } if (elemPtr->symbolPts.length > 0) { @@ -2165,8 +2165,8 @@ MergePens(LineElement *elemPtr, LineStyle **styleMap) Point2d *points, *pp; int *map; - points = Blt_AssertMalloc(elemPtr->symbolPts.length * sizeof(Point2d)); - map = Blt_AssertMalloc(elemPtr->symbolPts.length * sizeof(int)); + points = malloc(elemPtr->symbolPts.length * sizeof(Point2d)); + map = malloc(elemPtr->symbolPts.length * sizeof(int)); pp = points, ip = map; for (link = Blt_Chain_FirstLink(elemPtr->styles); link != NULL; link = Blt_Chain_NextLink(link)) { @@ -2186,8 +2186,8 @@ MergePens(LineElement *elemPtr, LineStyle **styleMap) } stylePtr->symbolPts.length = pp - stylePtr->symbolPts.points; } - Blt_Free(elemPtr->symbolPts.points); - Blt_Free(elemPtr->symbolPts.map); + free(elemPtr->symbolPts.points); + free(elemPtr->symbolPts.map); elemPtr->symbolPts.points = points; elemPtr->symbolPts.map = map; } @@ -2196,8 +2196,8 @@ MergePens(LineElement *elemPtr, LineStyle **styleMap) int *map, *ip; Blt_ChainLink link; - segments = Blt_AssertMalloc(elemPtr->xeb.length * sizeof(Segment2d)); - map = Blt_AssertMalloc(elemPtr->xeb.length * sizeof(int)); + segments = malloc(elemPtr->xeb.length * sizeof(Segment2d)); + map = malloc(elemPtr->xeb.length * sizeof(int)); sp = segments, ip = map; for (link = Blt_Chain_FirstLink(elemPtr->styles); link != NULL; link = Blt_Chain_NextLink(link)) { @@ -2217,8 +2217,8 @@ MergePens(LineElement *elemPtr, LineStyle **styleMap) } stylePtr->xeb.length = sp - stylePtr->xeb.segments; } - Blt_Free(elemPtr->xeb.segments); - Blt_Free(elemPtr->xeb.map); + free(elemPtr->xeb.segments); + free(elemPtr->xeb.map); elemPtr->xeb.segments = segments; elemPtr->xeb.map = map; } @@ -2227,8 +2227,8 @@ MergePens(LineElement *elemPtr, LineStyle **styleMap) int *map, *ip; Blt_ChainLink link; - segments = Blt_AssertMalloc(elemPtr->yeb.length * sizeof(Segment2d)); - map = Blt_AssertMalloc(elemPtr->yeb.length * sizeof(int)); + segments = malloc(elemPtr->yeb.length * sizeof(Segment2d)); + map = malloc(elemPtr->yeb.length * sizeof(int)); sp = segments, ip = map; for (link = Blt_Chain_FirstLink(elemPtr->styles); link != NULL; link = Blt_Chain_NextLink(link)) { @@ -2248,9 +2248,9 @@ MergePens(LineElement *elemPtr, LineStyle **styleMap) } stylePtr->yeb.length = sp - stylePtr->yeb.segments; } - Blt_Free(elemPtr->yeb.segments); + free(elemPtr->yeb.segments); elemPtr->yeb.segments = segments; - Blt_Free(elemPtr->yeb.map); + free(elemPtr->yeb.map); elemPtr->yeb.map = map; } } @@ -2353,9 +2353,9 @@ SaveTrace( int *map; int i, j; - tracePtr = Blt_AssertMalloc(sizeof(Trace)); - screenPts = Blt_AssertMalloc(sizeof(Point2d) * length); - map = Blt_AssertMalloc(sizeof(int) * length); + tracePtr = malloc(sizeof(Trace)); + screenPts = malloc(sizeof(Point2d) * length); + map = malloc(sizeof(int) * length); /* Copy the screen coordinates of the trace into the point array */ @@ -2404,9 +2404,9 @@ FreeTraces(LineElement *elemPtr) Trace *tracePtr; tracePtr = Blt_Chain_GetValue(link); - Blt_Free(tracePtr->screenPts.map); - Blt_Free(tracePtr->screenPts.points); - Blt_Free(tracePtr); + free(tracePtr->screenPts.map); + free(tracePtr->screenPts.points); + free(tracePtr); } Blt_Chain_Destroy(elemPtr->traces); elemPtr->traces = NULL; @@ -2516,7 +2516,7 @@ MapFillArea(Graph *graphPtr, LineElement *elemPtr, MapInfo *mapPtr) int np; if (elemPtr->fillPts != NULL) { - Blt_Free(elemPtr->fillPts); + free(elemPtr->fillPts); elemPtr->fillPts = NULL; elemPtr->nFillPts = 0; } @@ -2526,7 +2526,7 @@ MapFillArea(Graph *graphPtr, LineElement *elemPtr, MapInfo *mapPtr) np = mapPtr->nScreenPts + 3; Blt_GraphExtents(graphPtr, &exts); - origPts = Blt_AssertMalloc(sizeof(Point2d) * np); + origPts = malloc(sizeof(Point2d) * np); if (graphPtr->inverted) { double minX; int i; @@ -2571,12 +2571,12 @@ MapFillArea(Graph *graphPtr, LineElement *elemPtr, MapInfo *mapPtr) origPts[i] = origPts[0]; } - clipPts = Blt_AssertMalloc(sizeof(Point2d) * np * 3); + clipPts = malloc(sizeof(Point2d) * np * 3); np = Blt_PolyRectClip(&exts, origPts, np - 1, clipPts); - Blt_Free(origPts); + free(origPts); if (np < 3) { - Blt_Free(clipPts); + free(clipPts); } else { elemPtr->fillPts = clipPts; elemPtr->nFillPts = np; @@ -2589,34 +2589,34 @@ ResetLine(LineElement *elemPtr) FreeTraces(elemPtr); ResetStylePalette(elemPtr->styles); if (elemPtr->symbolPts.points != NULL) { - Blt_Free(elemPtr->symbolPts.points); + free(elemPtr->symbolPts.points); } if (elemPtr->symbolPts.map != NULL) { - Blt_Free(elemPtr->symbolPts.map); + free(elemPtr->symbolPts.map); } if (elemPtr->lines.segments != NULL) { - Blt_Free(elemPtr->lines.segments); + free(elemPtr->lines.segments); } if (elemPtr->lines.map != NULL) { - Blt_Free(elemPtr->lines.map); + free(elemPtr->lines.map); } if (elemPtr->activePts.points != NULL) { - Blt_Free(elemPtr->activePts.points); + free(elemPtr->activePts.points); } if (elemPtr->activePts.map != NULL) { - Blt_Free(elemPtr->activePts.map); + free(elemPtr->activePts.map); } if (elemPtr->xeb.segments != NULL) { - Blt_Free(elemPtr->xeb.segments); + free(elemPtr->xeb.segments); } if (elemPtr->xeb.map != NULL) { - Blt_Free(elemPtr->xeb.map); + free(elemPtr->xeb.map); } if (elemPtr->yeb.segments != NULL) { - Blt_Free(elemPtr->yeb.segments); + free(elemPtr->yeb.segments); } if (elemPtr->yeb.map != NULL) { - Blt_Free(elemPtr->yeb.map); + free(elemPtr->yeb.map); } elemPtr->xeb.segments = elemPtr->yeb.segments = elemPtr->lines.segments = NULL; elemPtr->symbolPts.points = elemPtr->activePts.points = NULL; @@ -2662,8 +2662,8 @@ MapErrorBars(Graph *graphPtr, LineElement *elemPtr, LineStyle **styleMap) int *indexPtr; int i; - segPtr = errorBars = Blt_AssertMalloc(n * 3 * sizeof(Segment2d)); - indexPtr = errorToData = Blt_AssertMalloc(n * 3 * sizeof(int)); + segPtr = errorBars = malloc(n * 3 * sizeof(Segment2d)); + indexPtr = errorToData = malloc(n * 3 * sizeof(int)); for (i = 0; i < n; i++) { double x, y; double high, low; @@ -2726,8 +2726,8 @@ MapErrorBars(Graph *graphPtr, LineElement *elemPtr, LineStyle **styleMap) int *indexPtr; int i; - segPtr = errorBars = Blt_AssertMalloc(n * 3 * sizeof(Segment2d)); - indexPtr = errorToData = Blt_AssertMalloc(n * 3 * sizeof(int)); + segPtr = errorBars = malloc(n * 3 * sizeof(Segment2d)); + indexPtr = errorToData = malloc(n * 3 * sizeof(int)); for (i = 0; i < n; i++) { double x, y; double high, low; @@ -2865,8 +2865,8 @@ MapLineProc(Graph *graphPtr, Element *basePtr) MapTraces(graphPtr, elemPtr, &mi); } } - Blt_Free(mi.screenPts); - Blt_Free(mi.map); + free(mi.screenPts); + free(mi.map); /* Set the symbol size of all the pen styles. */ for (link = Blt_Chain_FirstLink(elemPtr->styles); link != NULL; @@ -2889,7 +2889,7 @@ MapLineProc(Graph *graphPtr, Element *basePtr) MapErrorBars(graphPtr, elemPtr, styleMap); } MergePens(elemPtr, styleMap); - Blt_Free(styleMap); + free(styleMap); } static double @@ -3565,7 +3565,7 @@ DrawCircles(Display *display, Drawable drawable, LineElement *elemPtr, int count; s = radius + radius; - arcs = Blt_AssertMalloc(nSymbolPts * sizeof(XArc)); + arcs = malloc(nSymbolPts * sizeof(XArc)); if (elemPtr->symbolInterval > 0) { Point2d *pp, *pend; @@ -3611,7 +3611,7 @@ DrawCircles(Display *display, Drawable drawable, LineElement *elemPtr, XDrawArcs(display, drawable, penPtr->symbol.outlineGC, arcs + i, n); } } - Blt_Free(arcs); + free(arcs); } #endif @@ -3626,7 +3626,7 @@ DrawSquares(Display *display, Drawable drawable, LineElement *elemPtr, int s, count; s = r + r; - rectangles = Blt_AssertMalloc(nSymbolPts * sizeof(XRectangle)); + rectangles = malloc(nSymbolPts * sizeof(XRectangle)); if (elemPtr->symbolInterval > 0) { Point2d *pp, *pend; XRectangle *rp; @@ -3670,7 +3670,7 @@ DrawSquares(Display *display, Drawable drawable, LineElement *elemPtr, XDrawRectangles(display, drawable, penPtr->symbol.outlineGC, rp, n); } } - Blt_Free(rectangles); + free(rectangles); } /* @@ -3711,7 +3711,7 @@ DrawSymbols( Point2d *pp, *endp; XPoint *points, *xpp; - xpp = points = Blt_AssertMalloc(nSymbolPts * sizeof(XPoint)); + xpp = points = malloc(nSymbolPts * sizeof(XPoint)); for (pp = symbolPts, endp = pp + nSymbolPts; pp < endp; pp++) { xpp->x = Round(pp->x); xpp->y = Round(pp->y); @@ -3719,7 +3719,7 @@ DrawSymbols( } XDrawPoints(graphPtr->display, drawable, penPtr->symbol.fillGC, points, nSymbolPts, CoordModeOrigin); - Blt_Free(points); + free(points); } return; } @@ -3757,7 +3757,7 @@ DrawSymbols( pattern[0].x = pattern[2].y = -r2; pattern[1].x = pattern[3].y = r2; } - segments = Blt_AssertMalloc(nSymbolPts * 2 * sizeof(XSegment)); + segments = malloc(nSymbolPts * 2 * sizeof(XSegment)); if (elemPtr->symbolInterval > 0) { Point2d *pp, *endp; XSegment *sp; @@ -3813,7 +3813,7 @@ DrawSymbols( XDrawSegments(graphPtr->display, drawable, penPtr->symbol.outlineGC, segments + i, chunk); } - Blt_Free(segments); + free(segments); } break; @@ -3861,7 +3861,7 @@ DrawSymbols( } pattern[12] = pattern[0]; } - polygon = Blt_AssertMalloc(nSymbolPts * 13 * sizeof(XPoint)); + polygon = malloc(nSymbolPts * 13 * sizeof(XPoint)); if (elemPtr->symbolInterval > 0) { Point2d *pp, *endp; XPoint *xpp; @@ -3920,7 +3920,7 @@ DrawSymbols( penPtr->symbol.outlineGC, xpp, 13, CoordModeOrigin); } } - Blt_Free(polygon); + free(polygon); } break; @@ -3943,7 +3943,7 @@ DrawSymbols( pattern[3].y = pattern[2].x = r1; pattern[4] = pattern[0]; - polygon = Blt_AssertMalloc(nSymbolPts * 5 * sizeof(XPoint)); + polygon = malloc(nSymbolPts * 5 * sizeof(XPoint)); if (elemPtr->symbolInterval > 0) { Point2d *pp, *endp; XPoint *xpp; @@ -4003,7 +4003,7 @@ DrawSymbols( penPtr->symbol.outlineGC, xpp, 5, CoordModeOrigin); } } - Blt_Free(polygon); + free(polygon); } break; @@ -4046,7 +4046,7 @@ DrawSymbols( pattern[2].y = pattern[1].y = h2; pattern[2].x = -b2; } - polygon = Blt_AssertMalloc(nSymbolPts * 4 * sizeof(XPoint)); + polygon = malloc(nSymbolPts * 4 * sizeof(XPoint)); if (elemPtr->symbolInterval > 0) { Point2d *pp, *endp; XPoint *xpp; @@ -4107,7 +4107,7 @@ DrawSymbols( penPtr->symbol.outlineGC, xpp, 4, CoordModeOrigin); } } - Blt_Free(polygon); + free(polygon); } break; @@ -4301,7 +4301,7 @@ DrawTraces( } else { np = Blt_MaxRequestSize(graphPtr->display, sizeof(POINT)) - 1; } - points = Blt_AssertMalloc((np + 1) * sizeof(POINT)); + points = malloc((np + 1) * sizeof(POINT)); dc = TkWinGetDrawableDC(graphPtr->display, drawable, &state); @@ -4368,7 +4368,7 @@ DrawTraces( Polyline(dc, points, remaining + 1); } } - Blt_Free(points); + free(points); DeletePen(SelectPen(dc, oldPen)); DeleteBrush(SelectBrush(dc, oldBrush)); TkWinReleaseDrawableDC(drawable, dc, &state); @@ -4385,7 +4385,7 @@ DrawTraces(Graph *graphPtr, Drawable drawable, LineElement *elemPtr, int np; np = Blt_MaxRequestSize(graphPtr->display, sizeof(XPoint)) - 1; - points = Blt_AssertMalloc((np + 1) * sizeof(XPoint)); + points = malloc((np + 1) * sizeof(XPoint)); for (link = Blt_Chain_FirstLink(elemPtr->traces); link != NULL; link = Blt_Chain_NextLink(link)) { @@ -4445,7 +4445,7 @@ DrawTraces(Graph *graphPtr, Drawable drawable, LineElement *elemPtr, remaining + 1, CoordModeOrigin); } } - Blt_Free(points); + free(points); } #endif /* WIN32 */ @@ -4587,7 +4587,7 @@ DrawNormalLineProc(Graph *graphPtr, Drawable drawable, Element *basePtr) XPoint *points; Point2d *endp, *pp; - points = Blt_AssertMalloc(sizeof(XPoint) * elemPtr->nFillPts); + points = malloc(sizeof(XPoint) * elemPtr->nFillPts); count = 0; for (pp = elemPtr->fillPts, endp = pp + elemPtr->nFillPts; pp < endp; pp++) { @@ -4600,7 +4600,7 @@ DrawNormalLineProc(Graph *graphPtr, Drawable drawable, Element *basePtr) Blt_FillBackgroundPolygon(graphPtr->tkwin, drawable, elemPtr->fillBg, points, elemPtr->nFillPts, 0, TK_RELIEF_FLAT); } - Blt_Free(points); + free(points); } /* Lines: stripchart segments or graph traces. */ @@ -5159,10 +5159,10 @@ DestroyLineProc(Graph *graphPtr, Element *basePtr) Blt_Chain_Destroy(elemPtr->styles); } if (elemPtr->activeIndices != NULL) { - Blt_Free(elemPtr->activeIndices); + free(elemPtr->activeIndices); } if (elemPtr->fillPts != NULL) { - Blt_Free(elemPtr->fillPts); + free(elemPtr->fillPts); } if (elemPtr->fillGC != NULL) { Tk_FreeGC(graphPtr->display, elemPtr->fillGC); @@ -5208,19 +5208,19 @@ Blt_LineElement(Graph *graphPtr, const char *name, ClassId classId) { LineElement *elemPtr; - elemPtr = Blt_AssertCalloc(1, sizeof(LineElement)); + elemPtr = calloc(1, sizeof(LineElement)); elemPtr->procsPtr = &lineProcs; if (classId == CID_ELEM_LINE) { elemPtr->configSpecs = lineElemConfigSpecs; } else { elemPtr->configSpecs = stripElemConfigSpecs; } - elemPtr->obj.name = Blt_AssertStrdup(name); + elemPtr->obj.name = Blt_Strdup(name); Blt_GraphSetObjectClass(&elemPtr->obj, classId); elemPtr->flags = SCALE_SYMBOL; elemPtr->obj.graphPtr = graphPtr; /* By default an element's name and label are the same. */ - elemPtr->label = Blt_AssertStrdup(name); + elemPtr->label = Blt_Strdup(name); elemPtr->legendRelief = TK_RELIEF_FLAT; elemPtr->penDir = PEN_BOTH_DIRECTIONS; elemPtr->styles = Blt_Chain_Create(); @@ -5318,8 +5318,8 @@ MapLineProc(Graph *graphPtr, Element *basePtr) MapTraces(graphPtr, elemPtr, &mi); } } - Blt_Free(mi.screenPts); - Blt_Free(mi.map); + free(mi.screenPts); + free(mi.map); /* Set the symbol size of all the pen styles. */ for (link = Blt_Chain_FirstLink(elemPtr->styles); link != NULL; @@ -5342,6 +5342,6 @@ MapLineProc(Graph *graphPtr, Element *basePtr) MapErrorBars(graphPtr, elemPtr, styleMap); } MergePens(elemPtr, styleMap); - Blt_Free(styleMap); + free(styleMap); } #endif diff --git a/src/bltGrElemLineSpline.C b/src/bltGrElemLineSpline.C index 3f3b621..77fdb3c 100644 --- a/src/bltGrElemLineSpline.C +++ b/src/bltGrElemLineSpline.C @@ -750,12 +750,12 @@ Blt_QuadraticSpline(Point2d *origPts, int nOrigPts, Point2d *intpPts, double *work; int result; - work = Blt_AssertMalloc(nOrigPts * sizeof(double)); + work = malloc(nOrigPts * sizeof(double)); epsilon = 0.0; /* TBA: adjust error via command-line option */ /* allocate space for vectors used in calculation */ QuadSlopes(origPts, work, nOrigPts); result = QuadEval(origPts, nOrigPts, intpPts, nIntpPts, work, epsilon); - Blt_Free(work); + free(work); if (result > 1) { return FALSE; } @@ -787,7 +787,7 @@ Blt_NaturalSpline(Point2d *origPts, int nOrigPts, Point2d *intpPts, int isKnot; int i, j, n; - dx = Blt_AssertMalloc(sizeof(double) * nOrigPts); + dx = malloc(sizeof(double) * nOrigPts); /* Calculate vector of differences */ for (i = 0, j = 1; j < nOrigPts; i++, j++) { dx[i] = origPts[j].x - origPts[i].x; @@ -796,9 +796,9 @@ Blt_NaturalSpline(Point2d *origPts, int nOrigPts, Point2d *intpPts, } } n = nOrigPts - 1; /* Number of intervals. */ - A = Blt_AssertMalloc(sizeof(TriDiagonalMatrix) * nOrigPts); + A = malloc(sizeof(TriDiagonalMatrix) * nOrigPts); if (A == NULL) { - Blt_Free(dx); + free(dx); return 0; } /* Vectors to solve the tridiagonal matrix */ @@ -815,10 +815,10 @@ Blt_NaturalSpline(Point2d *origPts, int nOrigPts, Point2d *intpPts, A[j][2] = (alpha - dx[i] * A[i][2]) / A[j][0]; } - eq = Blt_Malloc(sizeof(Cubic2D) * nOrigPts); + eq = malloc(sizeof(Cubic2D) * nOrigPts); if (eq == NULL) { - Blt_Free(A); - Blt_Free(dx); + free(A); + free(dx); return FALSE; } eq[0].c = eq[n].c = 0.0; @@ -828,8 +828,8 @@ Blt_NaturalSpline(Point2d *origPts, int nOrigPts, Point2d *intpPts, eq[i].b = (dy) / dx[i] - dx[i] * (eq[j].c + 2.0 * eq[i].c) / 3.0; eq[i].d = (eq[j].c - eq[i].c) / (3.0 * dx[i]); } - Blt_Free(A); - Blt_Free(dx); + free(A); + free(dx); /* Now calculate the new values */ for (ip = intpPts, iend = ip + nIntpPts; ip < iend; ip++) { @@ -850,7 +850,7 @@ Blt_NaturalSpline(Point2d *origPts, int nOrigPts, Point2d *intpPts, ip->y = origPts[i].y + x * (eq[i].b + x * (eq[i].c + x * eq[i].d)); } } - Blt_Free(eq); + free(eq); return TRUE; } @@ -931,17 +931,17 @@ SplineCmd( return TCL_ERROR; } } - origPts = Blt_Malloc(sizeof(Point2d) * nOrigPts); + origPts = malloc(sizeof(Point2d) * nOrigPts); if (origPts == NULL) { Tcl_AppendResult(interp, "can't allocate \"", Blt_Itoa(nOrigPts), "\" points", (char *)NULL); return TCL_ERROR; } - intpPts = Blt_Malloc(sizeof(Point2d) * nIntpPts); + intpPts = malloc(sizeof(Point2d) * nIntpPts); if (intpPts == NULL) { Tcl_AppendResult(interp, "can't allocate \"", Blt_Itoa(nIntpPts), "\" points", (char *)NULL); - Blt_Free(origPts); + free(origPts); return TCL_ERROR; } xArr = Blt_VecData(x); @@ -959,16 +959,16 @@ SplineCmd( if (!(*proc) (origPts, nOrigPts, intpPts, nIntpPts)) { Tcl_AppendResult(interp, "error generating spline for \"", Blt_NameOfVector(splY), "\"", (char *)NULL); - Blt_Free(origPts); - Blt_Free(intpPts); + free(origPts); + free(intpPts); return TCL_ERROR; } yArr = Blt_VecData(splY); for (i = 0; i < nIntpPts; i++) { yArr[i] = intpPts[i].y; } - Blt_Free(origPts); - Blt_Free(intpPts); + free(origPts); + free(intpPts); /* Finally update the vector. The size of the vector hasn't * changed, just the data. Reset the vector using TCL_STATIC to @@ -1123,13 +1123,13 @@ CubicSlopes( double norm, dx, dy; TriDiagonalMatrix *A; /* The tri-diagonal matrix is saved here. */ - spline = Blt_Malloc(sizeof(CubicSpline) * nPoints); + spline = malloc(sizeof(CubicSpline) * nPoints); if (spline == NULL) { return NULL; } - A = Blt_Malloc(sizeof(TriDiagonalMatrix) * nPoints); + A = malloc(sizeof(TriDiagonalMatrix) * nPoints); if (A == NULL) { - Blt_Free(spline); + free(spline); return NULL; } /* @@ -1210,8 +1210,8 @@ CubicSlopes( if (SolveCubic1(A, n)) { /* Cholesky decomposition */ SolveCubic2(A, spline, n); /* A * dxdt2 = b_x */ } else { /* Should not happen, but who knows ... */ - Blt_Free(A); - Blt_Free(spline); + free(A); + free(spline); return NULL; } /* Shift all second derivatives one place right and update the ends. */ @@ -1230,7 +1230,7 @@ CubicSlopes( spline[n + 1].x = spline[n].x; spline[n + 1].y = spline[n].y; } - Blt_Free( A); + free( A); return spline; } @@ -1333,7 +1333,7 @@ Blt_NaturalParametricSpline(Point2d *origPts, int nOrigPts, Region2d *extsPtr, return 0; } result= CubicEval(origPts, nOrigPts, intpPts, nIntpPts, spline); - Blt_Free(spline); + free(spline); return result; } @@ -1380,7 +1380,7 @@ Blt_CatromParametricSpline(Point2d *points, int nPoints, Point2d *intpPts, * that we can select the abscissas of the interpolated points from each * pixel horizontally across the plotting area. */ - origPts = Blt_AssertMalloc((nPoints + 4) * sizeof(Point2d)); + origPts = malloc((nPoints + 4) * sizeof(Point2d)); memcpy(origPts + 1, points, sizeof(Point2d) * nPoints); origPts[0] = origPts[1]; @@ -1394,6 +1394,6 @@ Blt_CatromParametricSpline(Point2d *points, int nPoints, Point2d *intpPts, intpPts[i].x = (d.x + t * (c.x + t * (b.x + t * a.x))) / 2.0; intpPts[i].y = (d.y + t * (c.y + t * (b.y + t * a.y))) / 2.0; } - Blt_Free(origPts); + free(origPts); return 1; } diff --git a/src/bltGrElemOp.C b/src/bltGrElemOp.C index 6f509ac..c6886ea 100644 --- a/src/bltGrElemOp.C +++ b/src/bltGrElemOp.C @@ -109,7 +109,7 @@ Blt_DestroyTableClients(Graph *graphPtr) if (clientPtr->table != NULL) { Blt_Table_Close(clientPtr->table); } - Blt_Free(clientPtr); + free(clientPtr); } Blt_DeleteHashTable(&graphPtr->dataTables); } @@ -177,9 +177,9 @@ FetchVectorValues(Tcl_Interp *interp, ElemValues *valuesPtr, Blt_Vector *vector) double *array; if (valuesPtr->values == NULL) { - array = Blt_Malloc(Blt_VecLength(vector) * sizeof(double)); + array = malloc(Blt_VecLength(vector) * sizeof(double)); } else { - array = Blt_Realloc(valuesPtr->values, + array = realloc(valuesPtr->values, Blt_VecLength(vector) * sizeof(double)); } if (array == NULL) { @@ -271,7 +271,7 @@ FetchTableValues(Tcl_Interp *interp, ElemValues *valuesPtr, Blt_TableColumn col) Blt_Table table; table = valuesPtr->tableSource.table; - array = Blt_Malloc(sizeof(double) * Blt_Table_NumRows(table)); + array = malloc(sizeof(double) * Blt_Table_NumRows(table)); if (array == NULL) { return TCL_ERROR; } @@ -287,7 +287,7 @@ FetchTableValues(Tcl_Interp *interp, ElemValues *valuesPtr, Blt_TableColumn col) } } if (valuesPtr->values != NULL) { - Blt_Free(valuesPtr->values); + free(valuesPtr->values); } valuesPtr->nValues = j; valuesPtr->values = array; @@ -319,7 +319,7 @@ FreeTableSource(ElemValues *valuesPtr) if (srcPtr->table != NULL) { Blt_Table_Close(srcPtr->table); } - Blt_Free(clientPtr); + free(clientPtr); Blt_DeleteHashEntry(&graphPtr->dataTables, srcPtr->hashPtr); srcPtr->hashPtr = NULL; } @@ -423,7 +423,7 @@ GetTableData(Tcl_Interp *interp, ElemValues *valuesPtr, const char *tableName, if (Blt_Table_Open(interp, tableName, &srcPtr->table) != TCL_OK) { return TCL_ERROR; } - clientPtr = Blt_AssertMalloc(sizeof(TableClient)); + clientPtr = malloc(sizeof(TableClient)); clientPtr->table = srcPtr->table; clientPtr->refCount = 1; Blt_SetHashValue(srcPtr->hashPtr, clientPtr); @@ -469,14 +469,14 @@ ParseValues(Tcl_Interp *interp, Tcl_Obj *objPtr, int *nValuesPtr, double *p; int i; - array = Blt_Malloc(sizeof(double) * objc); + array = malloc(sizeof(double) * objc); if (array == NULL) { Tcl_AppendResult(interp, "can't allocate new vector", (char *)NULL); return TCL_ERROR; } for (p = array, i = 0; i < objc; i++, p++) { if (Blt_ExprDoubleFromObj(interp, objv[i], p) != TCL_OK) { - Blt_Free(array); + free(array); return TCL_ERROR; } } @@ -498,7 +498,7 @@ FreeDataValues(ElemValues *valuesPtr) break; } if (valuesPtr->values != NULL) { - Blt_Free(valuesPtr->values); + free(valuesPtr->values); } valuesPtr->values = NULL; valuesPtr->nValues = 0; @@ -798,7 +798,7 @@ ObjToValuePairs( } if (nValues & 1) { Tcl_AppendResult(interp, "odd number of data points", (char *)NULL); - Blt_Free(values); + free(values); return TCL_ERROR; } nValues /= 2; @@ -809,14 +809,14 @@ ObjToValuePairs( double *p; int i; - elemPtr->x.values = Blt_AssertMalloc(newSize); - elemPtr->y.values = Blt_AssertMalloc(newSize); + elemPtr->x.values = malloc(newSize); + elemPtr->y.values = malloc(newSize); elemPtr->x.nValues = elemPtr->y.nValues = nValues; for (p = values, i = 0; i < nValues; i++) { elemPtr->x.values[i] = *p++; elemPtr->y.values[i] = *p++; } - Blt_Free(values); + free(values); FindRange(&elemPtr->x); FindRange(&elemPtr->y); } @@ -1141,7 +1141,7 @@ Blt_StyleMap(Element *elemPtr) * Create a style mapping array (data point index to style), * initialized to the default style. */ - dataToStyle = Blt_AssertMalloc(nPoints * sizeof(PenStyle *)); + dataToStyle = malloc(nPoints * sizeof(PenStyle *)); for (i = 0; i < nPoints; i++) { dataToStyle[i] = stylePtr; } @@ -1267,12 +1267,12 @@ DestroyElement(Element *elemPtr) Blt_DeleteHashEntry(&graphPtr->elements.table, elemPtr->hashPtr); } if (elemPtr->obj.name != NULL) { - Blt_Free(elemPtr->obj.name); + free(elemPtr->obj.name); } if (elemPtr->label != NULL) { - Blt_Free(elemPtr->label); + free(elemPtr->label); } - Blt_Free(elemPtr); + free(elemPtr); } static void @@ -1587,7 +1587,7 @@ ActivateOp( int *activePtr; nIndices = objc - 4; - activePtr = indices = Blt_AssertMalloc(sizeof(int) * nIndices); + activePtr = indices = malloc(sizeof(int) * nIndices); for (i = 4; i < objc; i++) { if (GetIndex(interp, elemPtr, objv[i], activePtr) != TCL_OK) { return TCL_ERROR; @@ -1596,7 +1596,7 @@ ActivateOp( } } if (elemPtr->activeIndices != NULL) { - Blt_Free(elemPtr->activeIndices); + free(elemPtr->activeIndices); } elemPtr->nActiveIndices = nIndices; elemPtr->activeIndices = indices; @@ -1986,7 +1986,7 @@ DeactivateOp( } elemPtr->flags &= ~(ACTIVE | ACTIVE_PENDING); if (elemPtr->activeIndices != NULL) { - Blt_Free(elemPtr->activeIndices); + free(elemPtr->activeIndices); elemPtr->activeIndices = NULL; } elemPtr->nActiveIndices = 0; diff --git a/src/bltGrHairs.C b/src/bltGrHairs.C index 86ebb57..6cbd3c4 100644 --- a/src/bltGrHairs.C +++ b/src/bltGrHairs.C @@ -282,7 +282,7 @@ Blt_DestroyCrosshairs(Graph *graphPtr) if (chPtr->gc != NULL) { Blt_FreePrivateGC(graphPtr->display, chPtr->gc); } - Blt_Free(chPtr); + free(chPtr); } } @@ -307,7 +307,7 @@ Blt_CreateCrosshairs(Graph *graphPtr) { Crosshairs *chPtr; - chPtr = Blt_AssertCalloc(1, sizeof(Crosshairs)); + chPtr = calloc(1, sizeof(Crosshairs)); chPtr->hidden = TRUE; chPtr->hotSpot.x = chPtr->hotSpot.y = -1; graphPtr->crosshairs = chPtr; diff --git a/src/bltGrLegd.C b/src/bltGrLegd.C index 9ed3169..88c6c8b 100644 --- a/src/bltGrLegd.C +++ b/src/bltGrLegd.C @@ -1752,7 +1752,7 @@ Blt_DestroyLegend(Graph *graphPtr) Tk_DestroyWindow(tkwin); } } - Blt_Free(legendPtr); + free(legendPtr); } /* @@ -1773,7 +1773,7 @@ Blt_CreateLegend(Graph *graphPtr) { Legend *legendPtr; - legendPtr = Blt_AssertCalloc(1, sizeof(Legend)); + legendPtr = calloc(1, sizeof(Legend)); graphPtr->legend = legendPtr; legendPtr->graphPtr = graphPtr; legendPtr->tkwin = graphPtr->tkwin; diff --git a/src/bltGrMarker.C b/src/bltGrMarker.C index c9546f6..7c8e212 100644 --- a/src/bltGrMarker.C +++ b/src/bltGrMarker.C @@ -1170,7 +1170,7 @@ ParseCoordinates( return TCL_ERROR; } nWorldPts = objc / 2; - worldPts = Blt_Malloc(nWorldPts * sizeof(Point2d)); + worldPts = malloc(nWorldPts * sizeof(Point2d)); if (worldPts == NULL) { Tcl_AppendResult(interp, "can't allocate new coordinate array", (char *)NULL); @@ -1186,7 +1186,7 @@ ParseCoordinates( if ((GetCoordinate(interp, objv[i], &x) != TCL_OK) || (GetCoordinate(interp, objv[i + 1], &y) != TCL_OK)) { - Blt_Free(worldPts); + free(worldPts); return TCL_ERROR; } pp->x = x, pp->y = y, pp++; @@ -1195,7 +1195,7 @@ ParseCoordinates( /* Don't free the old coordinate array until we've parsed the new * coordinates without errors. */ if (markerPtr->worldPts != NULL) { - Blt_Free(markerPtr->worldPts); + free(markerPtr->worldPts); } markerPtr->worldPts = worldPts; markerPtr->nWorldPts = nWorldPts; @@ -1215,7 +1215,7 @@ FreeCoordsProc( Point2d **pointsPtr = (Point2d **)(widgRec + offset); if (*pointsPtr != NULL) { - Blt_Free(*pointsPtr); + free(*pointsPtr); *pointsPtr = NULL; } markerPtr->nWorldPts = 0; @@ -1799,7 +1799,7 @@ CreateMarker( markerPtr->obj.graphPtr = graphPtr; markerPtr->drawUnder = FALSE; markerPtr->flags |= MAP_ITEM; - markerPtr->obj.name = Blt_AssertStrdup(name); + markerPtr->obj.name = Blt_Strdup(name); Blt_GraphSetObjectClass(&markerPtr->obj, classId); return markerPtr; } @@ -1836,9 +1836,9 @@ DestroyMarker(Marker *markerPtr) Blt_Chain_DeleteLink(graphPtr->markers.displayList, markerPtr->link); } if (markerPtr->obj.name != NULL) { - Blt_Free(markerPtr->obj.name); + free(markerPtr->obj.name); } - Blt_Free(markerPtr); + free(markerPtr); } static void @@ -2359,7 +2359,7 @@ CreateBitmapProc(void) { BitmapMarker *bmPtr; - bmPtr = Blt_AssertCalloc(1, sizeof(BitmapMarker)); + bmPtr = calloc(1, sizeof(BitmapMarker)); bmPtr->classPtr = &bitmapMarkerClass; return (Marker *)bmPtr; } @@ -2706,7 +2706,7 @@ CreateImageProc(void) { ImageMarker *imPtr; - imPtr = Blt_AssertCalloc(1, sizeof(ImageMarker)); + imPtr = calloc(1, sizeof(ImageMarker)); imPtr->classPtr = &imageMarkerClass; return (Marker *)imPtr; } @@ -3026,7 +3026,7 @@ CreateTextProc(void) { TextMarker *tmPtr; - tmPtr = Blt_AssertCalloc(1, sizeof(TextMarker)); + tmPtr = calloc(1, sizeof(TextMarker)); tmPtr->classPtr = &textMarkerClass; Blt_Ts_InitStyle(tmPtr->style); tmPtr->style.anchor = TK_ANCHOR_NW; @@ -3305,7 +3305,7 @@ CreateWindowProc(void) { WindowMarker *wmPtr; - wmPtr = Blt_AssertCalloc(1, sizeof(WindowMarker)); + wmPtr = calloc(1, sizeof(WindowMarker)); wmPtr->classPtr = &windowMarkerClass; return (Marker *)wmPtr; } @@ -3430,7 +3430,7 @@ MapLineProc(Marker *markerPtr) lmPtr->nSegments = 0; if (lmPtr->segments != NULL) { - Blt_Free(lmPtr->segments); + free(lmPtr->segments); } if (markerPtr->nWorldPts < 2) { return; /* Too few points */ @@ -3443,7 +3443,7 @@ MapLineProc(Marker *markerPtr) * because clipping against the plot area may chop the line into several * disconnected segments. */ - segments = Blt_AssertMalloc(markerPtr->nWorldPts * sizeof(Segment2d)); + segments = malloc(markerPtr->nWorldPts * sizeof(Segment2d)); srcPtr = markerPtr->worldPts; p = MapPoint(srcPtr, &markerPtr->axes); p.x += markerPtr->xOffset; @@ -3707,7 +3707,7 @@ FreeLineProc(Marker *markerPtr) Blt_FreePrivateGC(graphPtr->display, lmPtr->gc); } if (lmPtr->segments != NULL) { - Blt_Free(lmPtr->segments); + free(lmPtr->segments); } } @@ -3732,7 +3732,7 @@ CreateLineProc(void) { LineMarker *lmPtr; - lmPtr = Blt_AssertCalloc(1, sizeof(LineMarker)); + lmPtr = calloc(1, sizeof(LineMarker)); lmPtr->classPtr = &lineMarkerClass; lmPtr->xor = FALSE; lmPtr->capStyle = CapButt; @@ -3763,17 +3763,17 @@ MapPolygonProc(Marker *markerPtr) int nScreenPts; if (pmPtr->outlinePts != NULL) { - Blt_Free(pmPtr->outlinePts); + free(pmPtr->outlinePts); pmPtr->outlinePts = NULL; pmPtr->nOutlinePts = 0; } if (pmPtr->fillPts != NULL) { - Blt_Free(pmPtr->fillPts); + free(pmPtr->fillPts); pmPtr->fillPts = NULL; pmPtr->nFillPts = 0; } if (pmPtr->screenPts != NULL) { - Blt_Free(pmPtr->screenPts); + free(pmPtr->screenPts); pmPtr->screenPts = NULL; } if (markerPtr->nWorldPts < 3) { @@ -3785,7 +3785,7 @@ MapPolygonProc(Marker *markerPtr) * the polygon. */ nScreenPts = markerPtr->nWorldPts + 1; - screenPts = Blt_AssertMalloc((nScreenPts + 1) * sizeof(Point2d)); + screenPts = malloc((nScreenPts + 1) * sizeof(Point2d)); { Point2d *sp, *dp, *send; @@ -3805,10 +3805,10 @@ MapPolygonProc(Marker *markerPtr) Point2d *fillPts; int n; - fillPts = Blt_AssertMalloc(sizeof(Point2d) * nScreenPts * 3); + fillPts = malloc(sizeof(Point2d) * nScreenPts * 3); n = Blt_PolyRectClip(&extents, screenPts, markerPtr->nWorldPts,fillPts); if (n < 3) { - Blt_Free(fillPts); + free(fillPts); } else { pmPtr->nFillPts = n; pmPtr->fillPts = fillPts; @@ -3824,7 +3824,7 @@ MapPolygonProc(Marker *markerPtr) * Generate line segments representing the polygon outline. The * resulting outline may or may not be closed from viewport clipping. */ - outlinePts = Blt_Malloc(nScreenPts * sizeof(Segment2d)); + outlinePts = malloc(nScreenPts * sizeof(Segment2d)); if (outlinePts == NULL) { return; /* Can't allocate point array */ } @@ -3891,7 +3891,7 @@ DrawPolygonProc(Marker *markerPtr, Drawable drawable) XPoint *dp, *points; Point2d *sp, *send; - points = Blt_Malloc(pmPtr->nFillPts * sizeof(XPoint)); + points = malloc(pmPtr->nFillPts * sizeof(XPoint)); if (points == NULL) { return; } @@ -3905,7 +3905,7 @@ DrawPolygonProc(Marker *markerPtr, Drawable drawable) XFillPolygon(graphPtr->display, drawable, pmPtr->fillGC, points, pmPtr->nFillPts, Complex, CoordModeOrigin); - Blt_Free(points); + free(points); } /* and then the outline */ if ((pmPtr->nOutlinePts > 0) && (pmPtr->lineWidth > 0) && @@ -4122,13 +4122,13 @@ FreePolygonProc(Marker *markerPtr) Blt_FreePrivateGC(graphPtr->display, pmPtr->outlineGC); } if (pmPtr->fillPts != NULL) { - Blt_Free(pmPtr->fillPts); + free(pmPtr->fillPts); } if (pmPtr->outlinePts != NULL) { - Blt_Free(pmPtr->outlinePts); + free(pmPtr->outlinePts); } if (pmPtr->screenPts != NULL) { - Blt_Free(pmPtr->screenPts); + free(pmPtr->screenPts); } } @@ -4152,7 +4152,7 @@ CreatePolygonProc(void) { PolygonMarker *pmPtr; - pmPtr = Blt_AssertCalloc(1, sizeof(PolygonMarker)); + pmPtr = calloc(1, sizeof(PolygonMarker)); pmPtr->classPtr = &polygonMarkerClass; pmPtr->capStyle = CapButt; pmPtr->joinStyle = JoinMiter; @@ -4194,7 +4194,7 @@ RenameMarker(Graph *graphPtr, Marker *markerPtr, const char *oldName, "\" already exists", (char *)NULL); return TCL_ERROR; } - markerPtr->obj.name = Blt_AssertStrdup(newName); + markerPtr->obj.name = Blt_Strdup(newName); markerPtr->hashPtr = hPtr; Blt_SetHashValue(hPtr, (char *)markerPtr); @@ -4202,7 +4202,7 @@ RenameMarker(Graph *graphPtr, Marker *markerPtr, const char *oldName, hPtr = Blt_FindHashEntry(&graphPtr->markers.table, oldName); Blt_DeleteHashEntry(&graphPtr->markers.table, hPtr); if (oldName != NULL) { - Blt_Free(oldName); + free(oldName); } return TCL_OK; } diff --git a/src/bltGrMisc.C b/src/bltGrMisc.C index 101273e..b63df8c 100644 --- a/src/bltGrMisc.C +++ b/src/bltGrMisc.C @@ -1120,7 +1120,7 @@ Blt_Draw2DSegments( XSegment *dp, *xsegments; Segment2d *sp, *send; - xsegments = Blt_Malloc(nSegments * sizeof(XSegment)); + xsegments = malloc(nSegments * sizeof(XSegment)); if (xsegments == NULL) { return; } @@ -1133,7 +1133,7 @@ Blt_Draw2DSegments( dp++; } XDrawSegments(display, drawable, gc, xsegments, nSegments); - Blt_Free(xsegments); + free(xsegments); } void @@ -1534,7 +1534,7 @@ FreeBorder(display, borderPtr) if (borderPtr->bgGC != NULL) { Blt_FreePrivateGC(tkwin, borderPtr->bgGC); } - Blt_Free(borderPtr); + free(borderPtr); } void @@ -1604,7 +1604,7 @@ Blt_Get3DBorder(Tcl_Interp *interp, Tk_Window tkwin, const char *borderName) } /* Create a new border */ - borderPtr = Blt_AssertCalloc(1, sizeof(Blt_3DBorder)); + borderPtr = calloc(1, sizeof(Blt_3DBorder)); borderPtr->screen = Tk_Screen(tkwin); borderPtr->visual = Tk_Visual(tkwin); borderPtr->depth = Tk_Depth(tkwin); @@ -1642,13 +1642,13 @@ Blt_Get3DBorder(Tcl_Interp *interp, Tk_Window tkwin, const char *borderName) } Blt_SetHashValue(hPtr, borderPtr); if (argv != NULL) { - Blt_Free(argv); + free(argv); } return TCL_OK; error: if (argv != NULL) { - Blt_Free(argv); + free(argv); } if (bgColorPtr != NULL) { Tk_FreeColor(bgColorPtr); @@ -1768,7 +1768,7 @@ CreateArcBall (float w, float h) { ArcBall *arcPtr; - arcPtr = Blt_AssertCalloc(1, sizeof(ArcBall)); + arcPtr = calloc(1, sizeof(ArcBall)); SetArcBallBounds (arcPtr, w, h); return arcPtr; } @@ -1777,7 +1777,7 @@ static void DestroyArcBall(ArcBall *arcPtr) { if (arcPtr != NULL) { - Blt_Free(arcPtr); + free(arcPtr); } } diff --git a/src/bltGrPSOutput.C b/src/bltGrPSOutput.C index 44cfdb8..030ffde 100644 --- a/src/bltGrPSOutput.C +++ b/src/bltGrPSOutput.C @@ -233,7 +233,7 @@ Blt_Ps_Create(Tcl_Interp *interp, PageSetup *setupPtr) { PostScript *psPtr; - psPtr = Blt_AssertMalloc(sizeof(PostScript)); + psPtr = malloc(sizeof(PostScript)); psPtr->setupPtr = setupPtr; psPtr->interp = interp; Tcl_DStringInit(&psPtr->dString); @@ -256,7 +256,7 @@ void Blt_Ps_Free(PostScript *psPtr) { Tcl_DStringFree(&psPtr->dString); - Blt_Free(psPtr); + free(psPtr); } const char * @@ -607,7 +607,7 @@ Blt_Ps_XSetBitmapData( byteCount++; } } /* y */ - Blt_Free(srcBits); + free(srcBits); Blt_Ps_Append(psPtr, ">\n"); } @@ -1357,13 +1357,13 @@ Blt_Ps_XSetFont(PostScript *psPtr, Blt_Font font) fontName = argv[0]; if ((argc != 2) || (Tcl_GetInt(interp, argv[1], &newSize) != TCL_OK)) { - Blt_Free(argv); + free(argv); return; } pointSize = (double)newSize; Blt_Ps_Format(psPtr, "%g /%s SetFont\n", pointSize, fontName); - Blt_Free(argv); + free(argv); return; } /*FallThru*/ @@ -1518,7 +1518,7 @@ Blt_Ps_DrawText( Blt_Ps_XSetForeground(ps, tsPtr->color); TextLayoutToPostScript(ps, 0, 0, textPtr); - Blt_Free(textPtr); + free(textPtr); Blt_Ps_Append(ps, "EndText\n"); } diff --git a/src/bltGrPenOp.C b/src/bltGrPenOp.C index 2e13b3a..b370f25 100644 --- a/src/bltGrPenOp.C +++ b/src/bltGrPenOp.C @@ -303,12 +303,12 @@ DestroyPen(Pen *penPtr) Blt_FreeOptions(penPtr->configSpecs, (char *)penPtr, graphPtr->display, 0); (*penPtr->destroyProc) (graphPtr, penPtr); if ((penPtr->name != NULL) && (penPtr->name[0] != '\0')) { - Blt_Free(penPtr->name); + free(penPtr->name); } if (penPtr->hashPtr != NULL) { Blt_DeleteHashEntry(&graphPtr->penTable, penPtr->hashPtr); } - Blt_Free(penPtr); + free(penPtr); } void diff --git a/src/bltGrText.C b/src/bltGrText.C index d9cb33b..b91e2e5 100644 --- a/src/bltGrText.C +++ b/src/bltGrText.C @@ -577,7 +577,7 @@ Blt_Ts_CreateLayout(const char *text, int textLen, TextStyle *tsPtr) } size = sizeof(TextLayout) + (sizeof(TextFragment) * (nFrags - 1)); - layoutPtr = Blt_AssertCalloc(1, size); + layoutPtr = calloc(1, size); layoutPtr->nFrags = nFrags; nFrags = count = 0; @@ -1239,7 +1239,7 @@ Blt_Ts_DrawText( layoutPtr = Blt_Ts_CreateLayout(text, textLen, stylePtr); Blt_Ts_DrawLayout(tkwin, drawable, layoutPtr, stylePtr, x, y); - Blt_Free(layoutPtr); + free(layoutPtr); } void @@ -1276,7 +1276,7 @@ Blt_DrawText2( } areaPtr->width = width; areaPtr->height = height; - Blt_Free(layoutPtr); + free(layoutPtr); } void @@ -1294,7 +1294,7 @@ Blt_DrawText( } layoutPtr = Blt_Ts_CreateLayout(string, -1, stylePtr); Blt_Ts_DrawLayout(tkwin, drawable, layoutPtr, stylePtr, x, y); - Blt_Free(layoutPtr); + free(layoutPtr); } void @@ -1402,7 +1402,7 @@ Blt_FreeTextLayout(Tk_TextLayout textLayout) TkTextLayout *layoutPtr = (TkTextLayout *) textLayout; if (layoutPtr != NULL) { - Blt_Free(layoutPtr); + free(layoutPtr); } } @@ -1442,7 +1442,7 @@ NewChunk(TkTextLayout **layoutPtrPtr, int *maxPtr, const char *start, if (layoutPtr->numChunks == maxChunks) { maxChunks *= 2; s = sizeof(TkTextLayout) + ((maxChunks - 1) * sizeof(LayoutChunk)); - layoutPtr = Blt_Realloc(layoutPtr, s); + layoutPtr = realloc(layoutPtr, s); *layoutPtrPtr = layoutPtr; *maxPtr = maxChunks; } @@ -1543,7 +1543,7 @@ Blt_ComputeTextLayout( maxChunks = 1; - layoutPtr = Blt_AssertMalloc(sizeof(TkTextLayout) + (maxChunks - 1) * + layoutPtr = malloc(sizeof(TkTextLayout) + (maxChunks - 1) * sizeof(LayoutChunk)); layoutPtr->font = font; layoutPtr->string = string; diff --git a/src/bltGraph.C b/src/bltGraph.C index de768f1..8402dae 100644 --- a/src/bltGraph.C +++ b/src/bltGraph.C @@ -810,7 +810,7 @@ DestroyGraph(DestroyData dataPtr) if (graphPtr->cache != None) { Tk_FreePixmap(graphPtr->display, graphPtr->cache); } - Blt_Free(graphPtr); + free(graphPtr); } /* @@ -842,7 +842,7 @@ CreateGraph(Tcl_Interp *interp, int objc, Tcl_Obj *const *objv, ClassId classId) if (tkwin == NULL) { return NULL; } - graphPtr = Blt_AssertCalloc(1, sizeof(Graph)); + graphPtr = calloc(1, sizeof(Graph)); /* Initialize the graph data structure. */ diff --git a/src/bltInt.C b/src/bltInt.C index ac4640c..da3ac95 100644 --- a/src/bltInt.C +++ b/src/bltInt.C @@ -308,7 +308,6 @@ Blt_core_Init(Tcl_Interp *interp) /* Interpreter to add extra commands */ return TCL_ERROR; }; #endif - Blt_AllocInit(NULL, NULL, NULL); /* * Check that the versions of TCL that have been loaded are the same ones diff --git a/src/bltNsUtil.C b/src/bltNsUtil.C index 62f727d..c4340d6 100644 --- a/src/bltNsUtil.C +++ b/src/bltNsUtil.C @@ -98,10 +98,10 @@ Blt_EnterNamespace(Tcl_Interp *interp, Tcl_Namespace *nsPtr) { Tcl_CallFrame *framePtr; - framePtr = Blt_AssertMalloc(sizeof(Tcl_CallFrame)); + framePtr = malloc(sizeof(Tcl_CallFrame)); if (Tcl_PushCallFrame(interp, framePtr, (Tcl_Namespace *)nsPtr, 0) != TCL_OK) { - Blt_Free(framePtr); + free(framePtr); return NULL; } return framePtr; @@ -111,7 +111,7 @@ void Blt_LeaveNamespace(Tcl_Interp *interp, Tcl_CallFrame *framePtr) { Tcl_PopCallFrame(interp); - Blt_Free(framePtr); + free(framePtr); } int diff --git a/src/bltParse.C b/src/bltParse.C index 10703f3..fc051f3 100644 --- a/src/bltParse.C +++ b/src/bltParse.C @@ -404,7 +404,7 @@ Blt_ExpandParseValue( } else { size += size; } - buffer = Blt_AssertMalloc((unsigned int)size); + buffer = malloc((unsigned int)size); /* * Copy from old buffer to new, free old buffer if needed, and @@ -414,7 +414,7 @@ Blt_ExpandParseValue( (size_t) (parsePtr->next - parsePtr->buffer)); parsePtr->next = buffer + (parsePtr->next - parsePtr->buffer); if (parsePtr->clientData != 0) { - Blt_Free(parsePtr->buffer); + free(parsePtr->buffer); } parsePtr->buffer = buffer; parsePtr->end = buffer + size - 1; diff --git a/src/bltSwitch.C b/src/bltSwitch.C index 35228d1..6d1aa31 100644 --- a/src/bltSwitch.C +++ b/src/bltSwitch.C @@ -268,9 +268,9 @@ DoSwitch( char *value; value = Tcl_GetString(objPtr); - value = (*value == '\0') ? NULL : Blt_AssertStrdup(value); + value = (*value == '\0') ? NULL : Blt_Strdup(value); if (*(char **)ptr != NULL) { - Blt_Free(*(char **)ptr); + free(*(char **)ptr); } *(char **)ptr = value; } @@ -282,10 +282,10 @@ DoSwitch( string = Tcl_GetString(objPtr); strPtr = (char **)ptr; new = ((*string == '\0') && (sp->flags & BLT_SWITCH_NULL_OK)) - ? NULL : Blt_AssertStrdup(string); + ? NULL : Blt_Strdup(string); old = *strPtr; if (old != NULL) { - Blt_Free(old); + free(old); } *strPtr = new; } @@ -454,7 +454,7 @@ Blt_FreeSwitches( case BLT_SWITCH_STRING: case BLT_SWITCH_LIST: if (*((char **) ptr) != NULL) { - Blt_Free(*((char **) ptr)); + free(*((char **) ptr)); *((char **) ptr) = NULL; } break; diff --git a/src/bltVecCmd.C b/src/bltVecCmd.C index c113347..ac2a8f2 100644 --- a/src/bltVecCmd.C +++ b/src/bltVecCmd.C @@ -402,7 +402,7 @@ DeleteOp(Vector *vPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) } /* Allocate an "unset" bitmap the size of the vector. */ - unsetArr = Blt_AssertCalloc(sizeof(unsigned char), (vPtr->length + 7) / 8); + unsetArr = calloc(sizeof(unsigned char), (vPtr->length + 7) / 8); #define SetBit(i) \ unsetArr[(i) >> 3] |= (1 << ((i) & 0x07)) #define GetBit(i) \ @@ -413,7 +413,7 @@ DeleteOp(Vector *vPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) if (Blt_Vec_GetIndexRange(interp, vPtr, string, (INDEX_COLON | INDEX_CHECK), (Blt_VectorIndexProc **) NULL) != TCL_OK) { - Blt_Free(unsetArr); + free(unsetArr); return TCL_ERROR; } for (j = vPtr->first; j <= vPtr->last; j++) { @@ -430,7 +430,7 @@ DeleteOp(Vector *vPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) } count++; } - Blt_Free(unsetArr); + free(unsetArr); vPtr->length = count; if (vPtr->flush) { Blt_Vec_FlushCache(vPtr); @@ -764,7 +764,7 @@ MergeOp(Vector *vPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) /* Allocate an array of vector pointers of each vector to be * merged in the current vector. */ - vecArr = Blt_AssertMalloc(sizeof(Vector *) * objc); + vecArr = malloc(sizeof(Vector *) * objc); vPtrPtr = vecArr; refSize = -1; @@ -775,7 +775,7 @@ MergeOp(Vector *vPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) if (Blt_Vec_LookupName(vPtr->dataPtr, Tcl_GetString(objv[i]), &v2Ptr) != TCL_OK) { - Blt_Free(vecArr); + free(vecArr); return TCL_ERROR; } /* Check that all the vectors are the same length */ @@ -786,7 +786,7 @@ MergeOp(Vector *vPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) Tcl_AppendResult(vPtr->interp, "vectors \"", vPtr->name, "\" and \"", v2Ptr->name, "\" differ in length", (char *)NULL); - Blt_Free(vecArr); + free(vecArr); return TCL_ERROR; } *vPtrPtr++ = v2Ptr; @@ -794,7 +794,7 @@ MergeOp(Vector *vPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) } *vPtrPtr = NULL; - valueArr = Blt_Malloc(sizeof(double) * nElem); + valueArr = malloc(sizeof(double) * nElem); if (valueArr == NULL) { Tcl_AppendResult(vPtr->interp, "not enough memory to allocate ", Blt_Itoa(nElem), " vector elements", (char *)NULL); @@ -810,7 +810,7 @@ MergeOp(Vector *vPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) *valuePtr++ = (*vpp)->valueArr[i + (*vpp)->first]; } } - Blt_Free(vecArr); + free(vecArr); Blt_Vec_Reset(vPtr, valueArr, nElem, nElem, TCL_DYNAMIC); return TCL_OK; } @@ -1469,7 +1469,7 @@ BinreadOp(Vector *vPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) arraySize = count * size; } - byteArr = Blt_AssertMalloc(arraySize); + byteArr = malloc(arraySize); /* FIXME: restore old channel translation later? */ if (Tcl_SetChannelOption(interp, channel, "-translation", "binary") != TCL_OK) { @@ -1498,7 +1498,7 @@ BinreadOp(Vector *vPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) break; } } - Blt_Free(byteArr); + free(byteArr); if (vPtr->flush) { Blt_Vec_FlushCache(vPtr); @@ -1783,14 +1783,14 @@ SimplifyOp(Vector *vPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) length = vPtr->length; nPoints = vPtr->length / 2; - simple = Blt_AssertMalloc(nPoints * sizeof(int)); - reduced = Blt_AssertMalloc(nPoints * sizeof(Point2d)); + simple = malloc(nPoints * sizeof(int)); + reduced = malloc(nPoints * sizeof(Point2d)); orig = (Point2d *)vPtr->valueArr; n = Blt_SimplifyLine(orig, 0, nPoints - 1, tolerance, simple); for (i = 0; i < n; i++) { reduced[i] = orig[simple[i]]; } - Blt_Free(simple); + free(simple); Blt_Vec_Reset(vPtr, (double *)reduced, n * 2, vPtr->length, TCL_DYNAMIC); /* * The vector has changed; so flush the array indices (they're wrong @@ -1913,7 +1913,7 @@ Blt_Vec_SortMap(Vector **vectors, int nVectors) int length; length = vPtr->last - vPtr->first + 1; - map = Blt_AssertMalloc(sizeof(size_t) * length); + map = malloc(sizeof(size_t) * length); for (i = vPtr->first; i <= vPtr->last; i++) { map[i] = i; } @@ -1932,7 +1932,7 @@ SortVectors(Vector *vPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) size_t *map; int i; - vectors = Blt_AssertMalloc(sizeof(Vector *) * (objc + 1)); + vectors = malloc(sizeof(Vector *) * (objc + 1)); vectors[0] = vPtr; map = NULL; for (i = 0; i < objc; i++) { @@ -1950,7 +1950,7 @@ SortVectors(Vector *vPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) } map = Blt_Vec_SortMap(vectors, objc + 1); error: - Blt_Free(vectors); + free(vectors); return map; } @@ -2010,7 +2010,7 @@ SortOp(Vector *vPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) * indices found in the index array. */ nBytes = sizeof(double) * sortLength; - copy = Blt_AssertMalloc(nBytes); + copy = malloc(nBytes); memcpy((char *)copy, (char *)vPtr->valueArr, nBytes); if (switches.flags & SORT_UNIQUE) { int count; @@ -2061,8 +2061,8 @@ SortOp(Vector *vPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) } result = TCL_OK; error: - Blt_Free(copy); - Blt_Free(map); + free(copy); + free(map); return result; } @@ -2307,7 +2307,7 @@ Blt_Vec_VarTrace(ClientData clientData, Tcl_Interp *interp, const char *part1, if (part2 == NULL) { if (flags & TCL_TRACE_UNSETS) { - Blt_Free(vPtr->arrayName); + free(vPtr->arrayName); vPtr->arrayName = NULL; if (vPtr->freeOnUnset) { Blt_Vec_Free(vPtr); diff --git a/src/bltVecMath.C b/src/bltVecMath.C index a0bd4af..8481770 100644 --- a/src/bltVecMath.C +++ b/src/bltVecMath.C @@ -200,15 +200,15 @@ Sort(Vector *vPtr) int i; map = Blt_Vec_SortMap(&vPtr, 1); - values = Blt_AssertMalloc(sizeof(double) * vPtr->length); + values = malloc(sizeof(double) * vPtr->length); for(i = vPtr->first; i <= vPtr->last; i++) { values[i] = vPtr->valueArr[map[i]]; } - Blt_Free(map); + free(map); for (i = vPtr->first; i <= vPtr->last; i++) { vPtr->valueArr[i] = values[i]; } - Blt_Free(values); + free(values); return TCL_OK; } @@ -445,7 +445,7 @@ Median(Blt_Vector *vectorPtr) q2 = (vPtr->valueArr[map[mid]] + vPtr->valueArr[map[mid + 1]]) * 0.5; } - Blt_Free(map); + free(map); return q2; } @@ -481,7 +481,7 @@ Q1(Blt_Vector *vectorPtr) vPtr->valueArr[map[q + 1]]) * 0.5; } } - Blt_Free(map); + free(map); return q1; } @@ -518,7 +518,7 @@ Q3(Blt_Vector *vectorPtr) vPtr->valueArr[map[q + 1]]) * 0.5; } } - Blt_Free(map); + free(map); return q3; } @@ -1303,7 +1303,7 @@ NextValue( double *hold; int j; - hold = Blt_AssertMalloc(sizeof(double) * offset); + hold = malloc(sizeof(double) * offset); for (i = 0; i < offset; i++) { hold[i] = opnd[i]; } @@ -1314,7 +1314,7 @@ NextValue( j < vPtr->length; i++, j++) { opnd[j] = hold[i]; } - Blt_Free(hold); + free(hold); } } break; @@ -1328,7 +1328,7 @@ NextValue( double *hold; int j; - hold = Blt_AssertMalloc(sizeof(double) * offset); + hold = malloc(sizeof(double) * offset); for (i = vPtr->length - offset, j = 0; i < vPtr->length; i++, j++) { hold[j] = opnd[i]; @@ -1340,7 +1340,7 @@ NextValue( for (i = 0; i < offset; i++) { opnd[i] = hold[i]; } - Blt_Free(hold); + free(hold); } } break; @@ -1579,14 +1579,14 @@ NextValue( } done: if (value2.pv.buffer != value2.staticSpace) { - Blt_Free(value2.pv.buffer); + free(value2.pv.buffer); } Blt_Vec_Free(v2Ptr); return result; error: if (value2.pv.buffer != value2.staticSpace) { - Blt_Free(value2.pv.buffer); + free(value2.pv.buffer); } Blt_Vec_Free(v2Ptr); return TCL_ERROR; @@ -1800,7 +1800,7 @@ Blt_Vec_UninstallMathFunctions(Blt_HashTable *tablePtr) mathPtr = Blt_GetHashValue(hPtr); if (mathPtr->name == NULL) { - Blt_Free(mathPtr); + free(mathPtr); } } } diff --git a/src/bltVector.C b/src/bltVector.C index e332b9d..6134b9f 100644 --- a/src/bltVector.C +++ b/src/bltVector.C @@ -717,7 +717,7 @@ UnmapVariable(Vector *vPtr) Tcl_UnsetVar2(interp, vPtr->arrayName, (char *)NULL, vPtr->varFlags); if (vPtr->arrayName != NULL) { - Blt_Free(vPtr->arrayName); + free(vPtr->arrayName); vPtr->arrayName = NULL; } } @@ -802,7 +802,7 @@ Blt_Vec_MapVariable( /* Create a full-array trace on reads, writes, and unsets. */ Tcl_TraceVar2(interp, newPath, (char *)NULL, TRACE_ALL, Blt_Vec_VarTrace, vPtr); - vPtr->arrayName = Blt_AssertStrdup(newPath); + vPtr->arrayName = Blt_Strdup(newPath); Tcl_DStringFree(&dString); return TCL_OK; } @@ -846,7 +846,7 @@ Blt_Vec_SetSize( double *newArr; /* Old memory was dynamically allocated, so use realloc. */ - newArr = Blt_Realloc(vPtr->valueArr, newSize * sizeof(double)); + newArr = realloc(vPtr->valueArr, newSize * sizeof(double)); if (newArr == NULL) { if (interp != NULL) { Tcl_AppendResult(interp, "can't reallocate ", @@ -866,7 +866,7 @@ Blt_Vec_SetSize( /* Old memory was created specially (static or special allocator). * Replace with dynamically allocated memory (malloc-ed). */ - newArr = Blt_Calloc(newSize, sizeof(double)); + newArr = calloc(newSize, sizeof(double)); if (newArr == NULL) { if (interp != NULL) { Tcl_AppendResult(interp, "can't allocate ", @@ -901,7 +901,7 @@ Blt_Vec_SetSize( */ if (vPtr->freeProc != TCL_STATIC) { if (vPtr->freeProc == TCL_DYNAMIC) { - Blt_Free(vPtr->valueArr); + free(vPtr->valueArr); } else { (*vPtr->freeProc) ((char *)vPtr->valueArr); } @@ -1048,7 +1048,7 @@ Blt_Vec_Reset( * the current vector. */ if ((valueArr == NULL) || (size == 0)) { /* Empty array. Set up default values */ - valueArr = Blt_Malloc(sizeof(double) * DEF_ARRAY_SIZE); + valueArr = malloc(sizeof(double) * DEF_ARRAY_SIZE); size = DEF_ARRAY_SIZE; if (valueArr == NULL) { Tcl_AppendResult(vPtr->interp, "can't allocate ", @@ -1061,7 +1061,7 @@ Blt_Vec_Reset( } else if (freeProc == TCL_VOLATILE) { double *newArr; /* Data is volatile. Make a copy of the value array. */ - newArr = Blt_Malloc(size * sizeof(double)); + newArr = malloc(size * sizeof(double)); if (newArr == NULL) { Tcl_AppendResult(vPtr->interp, "can't allocate ", Blt_Itoa(size), " elements for vector \"", @@ -1078,7 +1078,7 @@ Blt_Vec_Reset( /* Old data was dynamically allocated. Free it before attaching * new data. */ if (vPtr->freeProc == TCL_DYNAMIC) { - Blt_Free(vPtr->valueArr); + free(vPtr->valueArr); } else { (*freeProc) ((char *)vPtr->valueArr); } @@ -1101,10 +1101,10 @@ Blt_Vec_New(VectorInterpData *dataPtr) /* Interpreter-specific data. */ { Vector *vPtr; - vPtr = Blt_AssertCalloc(1, sizeof(Vector)); - vPtr->valueArr = Blt_Malloc(sizeof(double) * DEF_ARRAY_SIZE); + vPtr = calloc(1, sizeof(Vector)); + vPtr->valueArr = malloc(sizeof(double) * DEF_ARRAY_SIZE); if (vPtr->valueArr == NULL) { - Blt_Free(vPtr); + free(vPtr); return NULL; } vPtr->size = DEF_ARRAY_SIZE; @@ -1169,12 +1169,12 @@ Blt_Vec_Free(Vector *vPtr) VectorClient *clientPtr; clientPtr = Blt_Chain_GetValue(link); - Blt_Free(clientPtr); + free(clientPtr); } Blt_Chain_Destroy(vPtr->chain); if ((vPtr->valueArr != NULL) && (vPtr->freeProc != TCL_STATIC)) { if (vPtr->freeProc == TCL_DYNAMIC) { - Blt_Free(vPtr->valueArr); + free(vPtr->valueArr); } else { (*vPtr->freeProc) ((char *)vPtr->valueArr); } @@ -1187,7 +1187,7 @@ Blt_Vec_Free(Vector *vPtr) Blt_DestroyNsDeleteNotify(vPtr->interp, vPtr->nsPtr, vPtr); } #endif /* NAMESPACE_DELETE_NOTIFY */ - Blt_Free(vPtr); + free(vPtr); } /* @@ -1791,7 +1791,7 @@ VectorInterpDeleteProc( Blt_DeleteHashTable(&dataPtr->indexProcTable); Tcl_DeleteAssocData(interp, VECTOR_THREAD_KEY); - Blt_Free(dataPtr); + free(dataPtr); } VectorInterpData * @@ -1803,7 +1803,7 @@ Blt_Vec_GetInterpData(Tcl_Interp *interp) dataPtr = (VectorInterpData *) Tcl_GetAssocData(interp, VECTOR_THREAD_KEY, &proc); if (dataPtr == NULL) { - dataPtr = Blt_AssertMalloc(sizeof(VectorInterpData)); + dataPtr = malloc(sizeof(VectorInterpData)); dataPtr->interp = interp; dataPtr->nextId = 0; Tcl_SetAssocData(interp, VECTOR_THREAD_KEY, VectorInterpDeleteProc, @@ -1889,9 +1889,9 @@ Blt_CreateVector2( } dataPtr = Blt_Vec_GetInterpData(interp); - nameCopy = Blt_AssertStrdup(vecName); + nameCopy = Blt_Strdup(vecName); vPtr = Blt_Vec_Create(dataPtr, nameCopy, cmdName, varName, &isNew); - Blt_Free(nameCopy); + free(nameCopy); if (vPtr == NULL) { return TCL_ERROR; @@ -1980,10 +1980,10 @@ Blt_DeleteVectorByName(Tcl_Interp *interp, const char *name) * the string. Therefore make a writable copy and free it when we're * done. */ - nameCopy = Blt_AssertStrdup(name); + nameCopy = Blt_Strdup(name); dataPtr = Blt_Vec_GetInterpData(interp); result = Blt_Vec_LookupName(dataPtr, nameCopy, &vPtr); - Blt_Free(nameCopy); + free(nameCopy); if (result != TCL_OK) { return TCL_ERROR; @@ -2042,9 +2042,9 @@ Blt_VectorExists(Tcl_Interp *interp, const char *vecName) * the string. Therefore make a writable copy and free it when we're * done. */ - nameCopy = Blt_AssertStrdup(vecName); + nameCopy = Blt_Strdup(vecName); result = Blt_VectorExists2(interp, nameCopy); - Blt_Free(nameCopy); + free(nameCopy); return result; } @@ -2077,9 +2077,9 @@ Blt_GetVector(Tcl_Interp *interp, const char *name, Blt_Vector **vecPtrPtr) * the string. Therefore make a writable copy and free it when we're * done. */ - nameCopy = Blt_AssertStrdup(name); + nameCopy = Blt_Strdup(name); result = Blt_Vec_LookupName(dataPtr, nameCopy, &vPtr); - Blt_Free(nameCopy); + free(nameCopy); if (result != TCL_OK) { return TCL_ERROR; } @@ -2232,15 +2232,15 @@ Blt_AllocVectorId(Tcl_Interp *interp, const char *name) * the string. Therefore make a writable copy and free it when we're * done. */ - nameCopy = Blt_AssertStrdup(name); + nameCopy = Blt_Strdup(name); result = Blt_Vec_LookupName(dataPtr, nameCopy, &vPtr); - Blt_Free(nameCopy); + free(nameCopy); if (result != TCL_OK) { return (Blt_VectorId) 0; } /* Allocate a new client structure */ - clientPtr = Blt_AssertCalloc(1, sizeof(VectorClient)); + clientPtr = calloc(1, sizeof(VectorClient)); clientPtr->magic = VECTOR_MAGIC; /* Add the new client to the server's list of clients */ @@ -2317,7 +2317,7 @@ Blt_FreeVectorId(Blt_VectorId clientId) /* Remove the client from the server's list */ Blt_Chain_DeleteLink(clientPtr->serverPtr->chain, clientPtr->link); } - Blt_Free(clientPtr); + free(clientPtr); } /* @@ -2562,7 +2562,7 @@ Blt_Vec_FFT( } /* Allocate memory zero-filled array. */ - paddedData = Blt_Calloc(pow2len * 2, sizeof(double)); + paddedData = calloc(pow2len * 2, sizeof(double)); if (paddedData == NULL) { Tcl_AppendResult(interp, "can't allocate memory for padded data", (char *)NULL); @@ -2648,7 +2648,7 @@ Blt_Vec_FFT( } /* Memory is necessarily dynamic, because nobody touched it ! */ - Blt_Free(paddedData); + free(paddedData); realPtr->offset = 0; return TCL_OK; @@ -2689,7 +2689,7 @@ Blt_Vec_InverseFFT(Tcl_Interp *interp, Vector *srcImagPtr, Vector *destRealPtr, return TCL_ERROR; } - paddedData = Blt_AssertMalloc( pow2len*2*sizeof(double) ); + paddedData = malloc( pow2len*2*sizeof(double) ); if( paddedData == NULL ){ if (interp != NULL) { Tcl_AppendResult(interp, "memory allocation failed", (char *)NULL); @@ -2723,7 +2723,7 @@ for(i=0;i<pow2len;i++){ } /* memory is necessarily dynamic, because nobody touched it ! */ - Blt_Free( paddedData ); + free( paddedData ); return TCL_OK; } @@ -2789,7 +2789,7 @@ Blt_SimplifyLine(Point2d *inputPts, int low, int high, double tolerance, int s = -1; /* Points to top stack item. */ int count; - stack = Blt_AssertMalloc(sizeof(int) * (high - low + 1)); + stack = malloc(sizeof(int) * (high - low + 1)); StackPush(high); count = 0; indices[count++] = 0; @@ -2803,6 +2803,6 @@ Blt_SimplifyLine(Point2d *inputPts, int low, int high, double tolerance, StackPop(low); } } - Blt_Free(stack); + free(stack); return count; } |