summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkbltGrAxis.C50
-rw-r--r--generic/tkbltGrAxisOption.C3
-rw-r--r--generic/tkbltGrBind.C3
-rw-r--r--generic/tkbltGrElem.C15
-rw-r--r--generic/tkbltGrElemBar.C41
-rw-r--r--generic/tkbltGrElemLine.C45
-rw-r--r--generic/tkbltGrElemOp.C11
-rw-r--r--generic/tkbltGrElemOption.C9
-rw-r--r--generic/tkbltGrLegd.C4
-rw-r--r--generic/tkbltGrMarker.C3
-rw-r--r--generic/tkbltGrMarkerLine.C9
-rw-r--r--generic/tkbltGrMarkerOption.C3
-rw-r--r--generic/tkbltGrMarkerPolygon.C9
-rw-r--r--generic/tkbltGrPen.C3
-rw-r--r--generic/tkbltGraph.C3
-rw-r--r--generic/tkbltGraphBar.C6
16 files changed, 74 insertions, 143 deletions
diff --git a/generic/tkbltGrAxis.C b/generic/tkbltGrAxis.C
index bad7124..a9cb879 100644
--- a/generic/tkbltGrAxis.C
+++ b/generic/tkbltGrAxis.C
@@ -202,8 +202,7 @@ TickLabel::TickLabel(char* str)
TickLabel::~TickLabel()
{
- if (string)
- delete [] string;
+ delete [] string;
}
Ticks::Ticks(int cnt)
@@ -214,8 +213,7 @@ Ticks::Ticks(int cnt)
Ticks::~Ticks()
{
- if (values)
- delete [] values;
+ delete [] values;
}
Axis::Axis(Graph* graphPtr, const char* name, int margin, Tcl_HashEntry* hPtr)
@@ -310,10 +308,8 @@ Axis::~Axis()
if (hashPtr_)
Tcl_DeleteHashEntry(hashPtr_);
- if (name_)
- delete [] name_;
- if (className_)
- delete [] className_;
+ delete [] name_;
+ delete [] className_;
if (tickGC_)
Tk_FreeGC(graphPtr_->display_, tickGC_);
@@ -321,27 +317,22 @@ Axis::~Axis()
if (activeTickGC_)
Tk_FreeGC(graphPtr_->display_, activeTickGC_);
- if (ops->major.segments)
- delete [] ops->major.segments;
- if (ops->major.gc)
+ delete [] ops->major.segments;
+ if (ops->major.gc)
graphPtr_->freePrivateGC(ops->major.gc);
- if (ops->minor.segments)
- delete [] ops->minor.segments;
+ delete [] ops->minor.segments;
if (ops->minor.gc)
graphPtr_->freePrivateGC(ops->minor.gc);
- if (t1Ptr_)
- delete t1Ptr_;
- if (t2Ptr_)
- delete t2Ptr_;
+ delete t1Ptr_;
+ delete t2Ptr_;
freeTickLabels();
delete tickLabels_;
- if (segments_)
- delete [] segments_;
+ delete [] segments_;
Tk_FreeConfigOptions((char*)ops_, optionTable_, graphPtr_->tkwin_);
free(ops_);
@@ -481,19 +472,13 @@ void Axis::mapGridlines()
needed = t1Ptr->nTicks;
if (needed != ops->major.nAllocated) {
- if (ops->major.segments) {
- delete [] ops->major.segments;
- ops->major.segments = NULL;
- }
+ delete [] ops->major.segments;
ops->major.segments = new Segment2d[needed];
ops->major.nAllocated = needed;
}
needed = (t1Ptr->nTicks * t2Ptr->nTicks);
if (needed != ops->minor.nAllocated) {
- if (ops->minor.segments) {
- delete [] ops->minor.segments;
- ops->minor.segments = NULL;
- }
+ delete [] ops->minor.segments;
ops->minor.segments = new Segment2d[needed];
ops->minor.nAllocated = needed;
}
@@ -730,9 +715,7 @@ void Axis::drawLimits(Drawable drawable)
void Axis::setClass(ClassId classId)
{
- if (className_)
- delete [] className_;
- className_ =NULL;
+ delete [] className_;
classId_ = classId;
switch (classId) {
@@ -746,6 +729,7 @@ void Axis::setClass(ClassId classId)
className_ = dupstr("YAxis");
break;
default:
+ className_ = NULL;
break;
}
}
@@ -1563,10 +1547,8 @@ void Axis::makeSegments(AxisInfo *infoPtr)
{
AxisOptions* ops = (AxisOptions*)ops_;
- if (segments_) {
- delete [] segments_;
- segments_ = NULL;
- }
+ delete [] segments_;
+ segments_ = NULL;
Ticks* t1Ptr = ops->t1UPtr ? ops->t1UPtr : t1Ptr_;
Ticks* t2Ptr = ops->t2UPtr ? ops->t2UPtr : t2Ptr_;
diff --git a/generic/tkbltGrAxisOption.C b/generic/tkbltGrAxisOption.C
index cec594d..6f91d99 100644
--- a/generic/tkbltGrAxisOption.C
+++ b/generic/tkbltGrAxisOption.C
@@ -216,8 +216,7 @@ static void TicksFreeProc(ClientData clientData, Tk_Window tkwin,
char *ptr)
{
Ticks* ticksPtr = *(Ticks**)ptr;
- if (ticksPtr)
- delete ticksPtr;
+ delete ticksPtr;
}
static Tk_CustomOptionSetProc ObjectSetProc;
diff --git a/generic/tkbltGrBind.C b/generic/tkbltGrBind.C
index 2873c8f..3e7e81e 100644
--- a/generic/tkbltGrBind.C
+++ b/generic/tkbltGrBind.C
@@ -160,8 +160,7 @@ void BindTable::doEvent(XEvent* eventPtr)
const char** tagArray = graphPtr_->getTags(item, classId, &nTags);
Tk_BindEvent(table_, eventPtr, graphPtr_->tkwin_, nTags, (void**)tagArray);
- if (tagArray)
- delete [] tagArray;
+ delete [] tagArray;
}
void BindTable::pickItem(XEvent* eventPtr)
diff --git a/generic/tkbltGrElem.C b/generic/tkbltGrElem.C
index 394fa57..faf1b72 100644
--- a/generic/tkbltGrElem.C
+++ b/generic/tkbltGrElem.C
@@ -53,14 +53,12 @@ ElemValues::ElemValues()
ElemValues::~ElemValues()
{
- if (values_)
- delete [] values_;
+ delete [] values_;
}
void ElemValues::reset()
{
- if (values_)
- delete [] values_;
+ delete [] values_;
values_ =NULL;
nValues_ =0;
min_ =0;
@@ -134,8 +132,7 @@ int ElemValuesVector::fetchValues(Blt_Vector* vector)
{
Graph* graphPtr = elemPtr_->graphPtr_;
- if (values_)
- delete [] values_;
+ delete [] values_;
values_ = NULL;
nValues_ = 0;
min_ =0;
@@ -201,11 +198,9 @@ Element::~Element()
if (hashPtr_)
Tcl_DeleteHashEntry(hashPtr_);
- if (name_)
- delete [] name_;
+ delete [] name_;
- if (activeIndices_)
- delete [] activeIndices_;
+ delete [] activeIndices_;
Tk_FreeConfigOptions((char*)ops_, optionTable_, graphPtr_->tkwin_);
free(ops_);
diff --git a/generic/tkbltGrElemBar.C b/generic/tkbltGrElemBar.C
index a5efc7f..6698760 100644
--- a/generic/tkbltGrElemBar.C
+++ b/generic/tkbltGrElemBar.C
@@ -228,8 +228,7 @@ BarElement::~BarElement()
{
BarElementOptions* ops = (BarElementOptions*)ops_;
- if (builtinPenPtr)
- delete builtinPenPtr;
+ delete builtinPenPtr;
reset();
@@ -982,14 +981,12 @@ void BarElement::mergePens(BarStyle** dataToStyle)
void BarElement::mapActive()
{
- if (activeRects_) {
- delete [] activeRects_;
- activeRects_ = NULL;
- }
- if (activeToData_) {
- delete [] activeToData_;
- activeToData_ = NULL;
- }
+ delete [] activeRects_;
+ activeRects_ = NULL;
+
+ delete [] activeToData_;
+ activeToData_ = NULL;
+
nActive_ = 0;
if (nActiveIndices_ > 0) {
@@ -1018,34 +1015,26 @@ void BarElement::reset()
ResetStylePalette(ops->stylePalette);
- if (activeRects_)
- delete [] activeRects_;
+ delete [] activeRects_;
activeRects_ = NULL;
- if (activeToData_)
- delete [] activeToData_;
+ delete [] activeToData_;
activeToData_ = NULL;
- if (xeb_.segments)
- delete [] xeb_.segments;
+ delete [] xeb_.segments;
xeb_.segments = NULL;
- if (xeb_.map)
- delete [] xeb_.map;
+ delete [] xeb_.map;
xeb_.map = NULL;
xeb_.length = 0;
- if (yeb_.segments)
- delete [] yeb_.segments;
+ delete [] yeb_.segments;
yeb_.segments = NULL;
- if (yeb_.map)
- delete [] yeb_.map;
+ delete [] yeb_.map;
yeb_.map = NULL;
yeb_.length = 0;
- if (bars_)
- delete [] bars_;
+ delete [] bars_;
bars_ = NULL;
- if (barToData_)
- delete [] barToData_;
+ delete [] barToData_;
barToData_ = NULL;
nActive_ = 0;
diff --git a/generic/tkbltGrElemLine.C b/generic/tkbltGrElemLine.C
index caea48e..ac2b340 100644
--- a/generic/tkbltGrElemLine.C
+++ b/generic/tkbltGrElemLine.C
@@ -266,8 +266,7 @@ LineElement::~LineElement()
{
LineElementOptions* ops = (LineElementOptions*)ops_;
- if (builtinPenPtr)
- delete builtinPenPtr;
+ delete builtinPenPtr;
reset();
@@ -276,8 +275,7 @@ LineElement::~LineElement()
delete ops->stylePalette;
}
- if (fillPts_)
- delete [] fillPts_;
+ delete [] fillPts_;
}
int LineElement::configure()
@@ -1294,14 +1292,10 @@ void LineElement::mapActiveSymbols()
{
LineElementOptions* ops = (LineElementOptions*)ops_;
- if (activePts_.points) {
- delete [] activePts_.points;
- activePts_.points = NULL;
- }
- if (activePts_.map) {
- delete [] activePts_.map;
- activePts_.map = NULL;
- }
+ delete [] activePts_.points;
+ activePts_.points = NULL;
+ delete [] activePts_.map;
+ activePts_.map = NULL;
Region2d exts;
graphPtr_->extents(&exts);
@@ -1676,38 +1670,29 @@ void LineElement::reset()
stylePtr->yeb.length = 0;
}
- if (symbolPts_.points) {
- delete [] symbolPts_.points;
- symbolPts_.points = NULL;
- }
+ delete [] symbolPts_.points;
+ symbolPts_.points = NULL;
- if (symbolPts_.map)
- delete [] symbolPts_.map;
+ delete [] symbolPts_.map;
symbolPts_.map = NULL;
symbolPts_.length = 0;
- if (activePts_.points)
- delete [] activePts_.points;
+ delete [] activePts_.points;
activePts_.points = NULL;
activePts_.length = 0;
- if (activePts_.map)
- delete [] activePts_.map;
+ delete [] activePts_.map;
activePts_.map = NULL;
- if (xeb_.segments)
- delete [] xeb_.segments;
+ delete [] xeb_.segments;
xeb_.segments = NULL;
- if (xeb_.map)
- delete [] xeb_.map;
+ delete [] xeb_.map;
xeb_.map = NULL;
xeb_.length = 0;
- if (yeb_.segments)
- delete [] yeb_.segments;
+ delete [] yeb_.segments;
yeb_.segments = NULL;
- if (yeb_.map)
- delete [] yeb_.map;
+ delete [] yeb_.map;
yeb_.map = NULL;
yeb_.length = 0;
}
diff --git a/generic/tkbltGrElemOp.C b/generic/tkbltGrElemOp.C
index c4bcbef..af6fc0c 100644
--- a/generic/tkbltGrElemOp.C
+++ b/generic/tkbltGrElemOp.C
@@ -174,10 +174,9 @@ static int ActivateOp(ClientData clientData, Tcl_Interp* interp,
}
}
- if (elemPtr->activeIndices_)
- delete [] elemPtr->activeIndices_;
- elemPtr->nActiveIndices_ = nIndices;
+ delete [] elemPtr->activeIndices_;
elemPtr->activeIndices_ = indices;
+ elemPtr->nActiveIndices_ = nIndices;
elemPtr->active_ = 1;
@@ -306,10 +305,8 @@ static int DeactivateOp(ClientData clientData, Tcl_Interp* interp,
if (graphPtr->getElement(objv[ii], &elemPtr) != TCL_OK)
return TCL_ERROR;
- if (elemPtr->activeIndices_) {
- delete [] elemPtr->activeIndices_;
- elemPtr->activeIndices_ = NULL;
- }
+ delete [] elemPtr->activeIndices_;
+ elemPtr->activeIndices_ = NULL;
elemPtr->nActiveIndices_ = 0;
elemPtr->active_ = 0;
}
diff --git a/generic/tkbltGrElemOption.C b/generic/tkbltGrElemOption.C
index 45591ac..a0a67e6 100644
--- a/generic/tkbltGrElemOption.C
+++ b/generic/tkbltGrElemOption.C
@@ -136,8 +136,7 @@ static Tcl_Obj* ValuesGetProc(ClientData clientData, Tk_Window tkwin,
static void ValuesFreeProc(ClientData clientData, Tk_Window tkwin, char *ptr)
{
ElemValues* valuesPtr = *(ElemValues**)ptr;
- if (valuesPtr)
- delete valuesPtr;
+ delete valuesPtr;
}
static Tk_CustomOptionSetProc PairsSetProc;
@@ -171,12 +170,10 @@ static int PairsSetProc(ClientData clientData, Tcl_Interp* interp,
}
nValues /= 2;
- if (coordsPtr->x)
- delete coordsPtr->x;
+ delete coordsPtr->x;
coordsPtr->x = new ElemValuesSource(nValues);
- if (coordsPtr->y)
- delete coordsPtr->y;
+ delete coordsPtr->y;
coordsPtr->y = new ElemValuesSource(nValues);
int ii=0;
diff --git a/generic/tkbltGrLegd.C b/generic/tkbltGrLegd.C
index 3b08f23..b8822f1 100644
--- a/generic/tkbltGrLegd.C
+++ b/generic/tkbltGrLegd.C
@@ -213,8 +213,8 @@ Legend::~Legend()
if (focusGC_)
graphPtr_->freePrivateGC(focusGC_);
- if (graphPtr_->tkwin_)
- Tk_DeleteSelHandler(graphPtr_->tkwin_, XA_PRIMARY, XA_STRING);
+ if (graphPtr_->tkwin_)
+ Tk_DeleteSelHandler(graphPtr_->tkwin_, XA_PRIMARY, XA_STRING);
delete selected_;
diff --git a/generic/tkbltGrMarker.C b/generic/tkbltGrMarker.C
index 6fdcfd6..6f701f8 100644
--- a/generic/tkbltGrMarker.C
+++ b/generic/tkbltGrMarker.C
@@ -63,8 +63,7 @@ Marker::~Marker()
if (hashPtr_)
Tcl_DeleteHashEntry(hashPtr_);
- if (name_)
- delete [] name_;
+ delete [] name_;
Tk_FreeConfigOptions((char*)ops_, optionTable_, graphPtr_->tkwin_);
free(ops_);
diff --git a/generic/tkbltGrMarkerLine.C b/generic/tkbltGrMarkerLine.C
index 954d4dc..82c9ab8 100644
--- a/generic/tkbltGrMarkerLine.C
+++ b/generic/tkbltGrMarkerLine.C
@@ -103,8 +103,7 @@ LineMarker::~LineMarker()
{
if (gc_)
graphPtr_->freePrivateGC(gc_);
- if (segments_)
- delete [] segments_;
+ delete [] segments_;
}
int LineMarker::configure()
@@ -151,11 +150,9 @@ void LineMarker::map()
{
LineMarkerOptions* ops = (LineMarkerOptions*)ops_;
+ delete [] segments_;
+ segments_ = NULL;
nSegments_ = 0;
- if (segments_) {
- delete [] segments_;
- segments_ = NULL;
- }
if (!ops->worldPts || (ops->worldPts->num < 2))
return;
diff --git a/generic/tkbltGrMarkerOption.C b/generic/tkbltGrMarkerOption.C
index b6eab57..6b13fd9 100644
--- a/generic/tkbltGrMarkerOption.C
+++ b/generic/tkbltGrMarkerOption.C
@@ -119,8 +119,7 @@ static void CoordsFreeProc(ClientData clientData, Tk_Window tkwin,
{
Coords* coordsPtr = *(Coords**)ptr;
if (coordsPtr) {
- if (coordsPtr->points)
- delete [] coordsPtr->points;
+ delete [] coordsPtr->points;
delete coordsPtr;
}
}
diff --git a/generic/tkbltGrMarkerPolygon.C b/generic/tkbltGrMarkerPolygon.C
index 3b67272..383d0e8 100644
--- a/generic/tkbltGrMarkerPolygon.C
+++ b/generic/tkbltGrMarkerPolygon.C
@@ -103,12 +103,9 @@ PolygonMarker::~PolygonMarker()
Tk_FreeGC(graphPtr_->display_, fillGC_);
if (outlineGC_)
graphPtr_->freePrivateGC(outlineGC_);
- if (fillPts_)
- delete [] fillPts_;
- if (outlinePts_)
- delete [] outlinePts_;
- if (screenPts_)
- delete [] screenPts_;
+ delete [] fillPts_;
+ delete [] outlinePts_;
+ delete [] screenPts_;
}
int PolygonMarker::configure()
diff --git a/generic/tkbltGrPen.C b/generic/tkbltGrPen.C
index 42851d8..71e5fe9 100644
--- a/generic/tkbltGrPen.C
+++ b/generic/tkbltGrPen.C
@@ -48,8 +48,7 @@ Pen::Pen(Graph* graphPtr, const char* name, Tcl_HashEntry* hPtr)
Pen::~Pen()
{
- if (name_)
- delete [] name_;
+ delete [] name_;
if (hashPtr_)
Tcl_DeleteHashEntry(hashPtr_);
diff --git a/generic/tkbltGraph.C b/generic/tkbltGraph.C
index 9607f54..f1453dc 100644
--- a/generic/tkbltGraph.C
+++ b/generic/tkbltGraph.C
@@ -141,8 +141,7 @@ Graph::~Graph()
destroyAxes();
destroyPens();
- if (bindTable_)
- delete bindTable_;
+ delete bindTable_;
if (drawGC_)
Tk_FreeGC(display_, drawGC_);
diff --git a/generic/tkbltGraphBar.C b/generic/tkbltGraphBar.C
index 6223270..861c12a 100644
--- a/generic/tkbltGraphBar.C
+++ b/generic/tkbltGraphBar.C
@@ -445,10 +445,8 @@ void BarGraph::initBarSets()
void BarGraph::destroyBarSets()
{
- if (barGroups_) {
- delete [] barGroups_;
- barGroups_ = NULL;
- }
+ delete [] barGroups_;
+ barGroups_ = NULL;
nBarGroups_ = 0;
Tcl_HashSearch iter;