diff options
author | joye <joye> | 2014-03-07 18:10:02 (GMT) |
---|---|---|
committer | joye <joye> | 2014-03-07 18:10:02 (GMT) |
commit | 0fbac41586031f4a63ffec936094e638bc72ed36 (patch) | |
tree | db7908f48a44b335bcee7c84c847505b65d3f846 /src | |
parent | 12a846eac63f59945efc9ad76f1858386c05ce75 (diff) | |
download | blt-0fbac41586031f4a63ffec936094e638bc72ed36.zip blt-0fbac41586031f4a63ffec936094e638bc72ed36.tar.gz blt-0fbac41586031f4a63ffec936094e638bc72ed36.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r-- | src/bltGrAxis.C | 6 | ||||
-rw-r--r-- | src/bltGrElemOp.C | 30 | ||||
-rw-r--r-- | src/bltGrPenOp.C | 5 | ||||
-rw-r--r-- | src/bltGraph.C | 7 |
4 files changed, 24 insertions, 24 deletions
diff --git a/src/bltGrAxis.C b/src/bltGrAxis.C index 5058e4d..a236311 100644 --- a/src/bltGrAxis.C +++ b/src/bltGrAxis.C @@ -525,6 +525,9 @@ int Blt_CreateAxes(Graph* graphPtr) if (!axisPtr) return TCL_ERROR; + axisPtr->hashPtr = hPtr; + Tcl_SetHashValue(hPtr, axisPtr); + axisPtr->refCount = 1; /* Default axes are assumed in use. */ axisPtr->margin = ii; axisPtr->use =1; @@ -543,9 +546,6 @@ int Blt_CreateAxes(Graph* graphPtr) if ((axisPtr->margin == MARGIN_RIGHT) || (axisPtr->margin == MARGIN_TOP)) axisPtr->hide = 1; - axisPtr->hashPtr = hPtr; - Tcl_SetHashValue(hPtr, axisPtr); - graphPtr->axisChain[ii] = chain; axisPtr->link = Blt_Chain_Append(chain, axisPtr); axisPtr->chain = chain; diff --git a/src/bltGrElemOp.C b/src/bltGrElemOp.C index bc0507e..be7955b 100644 --- a/src/bltGrElemOp.C +++ b/src/bltGrElemOp.C @@ -318,14 +318,14 @@ static int CreateElement(Graph* graphPtr, Tcl_Interp* interp, int objc, if (!elemPtr) return TCL_ERROR; + elemPtr->hashPtr = hPtr; + Tcl_SetHashValue(hPtr, elemPtr); + if ((Tk_InitOptions(graphPtr->interp, (char*)elemPtr, elemPtr->optionTable, graphPtr->tkwin) != TCL_OK) || (ElementObjConfigure(interp,graphPtr, elemPtr, objc-4, objv+4) != TCL_OK)) { DestroyElement(elemPtr); return TCL_ERROR; } - elemPtr->hashPtr = hPtr; - Tcl_SetHashValue(hPtr, elemPtr); - elemPtr->link = Blt_Chain_Append(graphPtr->elements.displayList, elemPtr); elemPtr->flags |= MAP_ITEM; graphPtr->flags |= CACHE_DIRTY; @@ -513,7 +513,7 @@ static int ActivateOp(Graph* graphPtr, Tcl_Interp* interp, activePtr++; } } - if (elemPtr->activeIndices != NULL) { + if (elemPtr->activeIndices) { free(elemPtr->activeIndices); } elemPtr->nActiveIndices = nIndices; @@ -732,7 +732,7 @@ static int DeactivateOp(Graph* graphPtr, Tcl_Interp* interp, return TCL_ERROR; /* Can't find named element */ } elemPtr->flags &= ~(ACTIVE | ACTIVE_PENDING); - if (elemPtr->activeIndices != NULL) { + if (elemPtr->activeIndices) { free(elemPtr->activeIndices); elemPtr->activeIndices = NULL; } @@ -781,7 +781,7 @@ static int GetOp(Graph* graphPtr, Tcl_Interp* interp, elemPtr = Blt_GetCurrentItem(graphPtr->bindTable); /* Report only on elements. */ - if ((elemPtr != NULL) && ((elemPtr->flags & DELETE_PENDING) == 0) && + if ((elemPtr) && ((elemPtr->flags & DELETE_PENDING) == 0) && (elemPtr->obj.classId >= CID_ELEM_BAR) && (elemPtr->obj.classId <= CID_ELEM_LINE)) { Tcl_SetStringObj(Tcl_GetObjResult(interp), elemPtr->obj.name,-1); @@ -1039,7 +1039,7 @@ static int GetPenStyleFromObj(Tcl_Interp* interp, Graph* graphPtr, return TCL_ERROR; } if ((objc != 1) && (objc != 3)) { - if (interp != NULL) { + if (interp) { Tcl_AppendResult(interp, "bad style entry \"", Tcl_GetString(objPtr), "\": should be \"penName\" or \"penName min max\"", @@ -1065,7 +1065,7 @@ static int GetPenStyleFromObj(Tcl_Interp* interp, Graph* graphPtr, static void FreeVectorSource(ElemValues *valuesPtr) { - if (valuesPtr->vectorSource.vector != NULL) { + if (valuesPtr->vectorSource.vector) { Blt_SetVectorChangedProc(valuesPtr->vectorSource.vector, NULL, NULL); Blt_FreeVectorId(valuesPtr->vectorSource.vector); valuesPtr->vectorSource.vector = NULL; @@ -1084,7 +1084,7 @@ static int FetchVectorValues(Tcl_Interp* interp, ElemValues *valuesPtr, Blt_VecLength(vector) * sizeof(double)); } if (array == NULL) { - if (interp != NULL) { + if (interp) { Tcl_AppendResult(interp, "can't allocate new vector", (char *)NULL); } return TCL_ERROR; @@ -1189,7 +1189,7 @@ static void FreeDataValues(ElemValues *valuesPtr) case ELEM_SOURCE_VALUES: break; } - if (valuesPtr->values != NULL) { + if (valuesPtr->values) { free(valuesPtr->values); } valuesPtr->values = NULL; @@ -1260,7 +1260,7 @@ void Blt_FreeStylePalette(Blt_Chain stylePalette) /* Skip the first slot. It contains the built-in "normal" pen of * the element. */ link = Blt_Chain_FirstLink(stylePalette); - if (link != NULL) { + if (link) { Blt_ChainLink next; for (link = Blt_Chain_NextLink(link); link != NULL; link = next) { @@ -1349,7 +1349,7 @@ int Blt_GetElement(Tcl_Interp* interp, Graph* graphPtr, Tcl_Obj *objPtr, name = Tcl_GetString(objPtr); hPtr = Tcl_FindHashEntry(&graphPtr->elements.table, name); if (hPtr == NULL) { - if (interp != NULL) { + if (interp) { Tcl_AppendResult(interp, "can't find element \"", name, "\" in \"", Tk_PathName(graphPtr->tkwin), "\"", (char *)NULL); @@ -1369,8 +1369,10 @@ void Blt_DestroyElements(Graph* graphPtr) for (hPtr = Tcl_FirstHashEntry(&graphPtr->elements.table, &iter); hPtr != NULL; hPtr = Tcl_NextHashEntry(&iter)) { elemPtr = Tcl_GetHashValue(hPtr); - elemPtr->hashPtr = NULL; - DestroyElement(elemPtr); + if (elemPtr) { + elemPtr->hashPtr = NULL; + DestroyElement(elemPtr); + } } Tcl_DeleteHashTable(&graphPtr->elements.table); Tcl_DeleteHashTable(&graphPtr->elements.tagTable); diff --git a/src/bltGrPenOp.C b/src/bltGrPenOp.C index 228daae..f79b825 100644 --- a/src/bltGrPenOp.C +++ b/src/bltGrPenOp.C @@ -135,15 +135,14 @@ int Blt_CreatePen(Graph* graphPtr, Tcl_Interp* interp, penPtr->graphPtr = graphPtr; penPtr->classId = classId; + penPtr->hashPtr = hPtr; + Tcl_SetHashValue(hPtr, penPtr); if ((Tk_InitOptions(graphPtr->interp, (char*)penPtr, penPtr->optionTable, graphPtr->tkwin) != TCL_OK) || (PenObjConfigure(interp, graphPtr, penPtr, objc-4, objv+4) != TCL_OK)) { DestroyPen(penPtr); return TCL_ERROR; } - penPtr->hashPtr = hPtr; - Tcl_SetHashValue(hPtr, penPtr); - graphPtr->flags |= CACHE_DIRTY; Blt_EventuallyRedrawGraph(graphPtr); diff --git a/src/bltGraph.C b/src/bltGraph.C index c2ef849..97e60f0 100644 --- a/src/bltGraph.C +++ b/src/bltGraph.C @@ -232,9 +232,8 @@ static int NewGraph(ClientData clientData, Tcl_Interp*interp, } Tk_Window tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp), - Tcl_GetString(objv[1]), - (char*)NULL); - if (tkwin == NULL) + Tcl_GetString(objv[1]), NULL); + if (!tkwin) return TCL_ERROR; Tk_OptionTable optionTable = Tk_CreateOptionTable(interp, optionSpecs); @@ -318,7 +317,7 @@ static int NewGraph(ClientData clientData, Tcl_Interp*interp, if ((Tk_InitOptions(interp, (char*)graphPtr, optionTable, tkwin) != TCL_OK) || (GraphObjConfigure(interp, graphPtr, objc-2, objv+2) != TCL_OK)) - goto error; + return TCL_ERROR; if (Blt_ConfigurePageSetup(graphPtr) != TCL_OK) goto error; |