summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEduardo M. Fleury <eduardo.fleury@openbossa.org>2009-07-14 20:53:52 (GMT)
committerEduardo M. Fleury <eduardo.fleury@openbossa.org>2009-07-22 18:04:50 (GMT)
commit9438460039f077f67afb398b0623992fe6a6f0e2 (patch)
tree1f9039baaa22460dc2b206a234936facc1431b12
parent4a5b176b5bd302903a7baf1517e7cb9dced70d3f (diff)
downloadQt-9438460039f077f67afb398b0623992fe6a6f0e2.zip
Qt-9438460039f077f67afb398b0623992fe6a6f0e2.tar.gz
Qt-9438460039f077f67afb398b0623992fe6a6f0e2.tar.bz2
QGraphicsAnchorLayout: Use Q_ASSERT instead of "if" tests
Replacing two IF tests for Q_ASSERT statements instead. These tests are sanity checks that should never be false. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Anselmo Lacerda S. de Melo <anselmo.melo@openbossa.org>
-rw-r--r--src/gui/graphicsview/qgraph_p.h14
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.cpp6
2 files changed, 10 insertions, 10 deletions
diff --git a/src/gui/graphicsview/qgraph_p.h b/src/gui/graphicsview/qgraph_p.h
index 9128df8..053114b 100644
--- a/src/gui/graphicsview/qgraph_p.h
+++ b/src/gui/graphicsview/qgraph_p.h
@@ -174,13 +174,13 @@ protected:
void removeDirectedEdge(Vertex *from, Vertex *to)
{
QHash<Vertex *, EdgeData *> *adjacentToFirst = m_graph.value(from);
- if (adjacentToFirst) {
- adjacentToFirst->remove(to);
- if (adjacentToFirst->isEmpty()) {
- //nobody point to 'from' so we can remove it from the graph
- m_graph.remove(from);
- delete adjacentToFirst;
- }
+ Q_ASSERT(adjacentToFirst);
+
+ adjacentToFirst->remove(to);
+ if (adjacentToFirst->isEmpty()) {
+ //nobody point to 'from' so we can remove it from the graph
+ m_graph.remove(from);
+ delete adjacentToFirst;
}
}
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
index e969e40..c83f939 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -701,10 +701,10 @@ void QGraphicsAnchorLayoutPrivate::removeAnchor(QGraphicsLayoutItem *firstItem,
AnchorVertex *v1 = internalVertex(firstItem, firstEdge);
AnchorVertex *v2 = internalVertex(secondItem, secondEdge);
+ Q_ASSERT(v1 && v2);
+
// Remove edge from graph
- if (v1 && v2) {
- graph[edgeOrientation(firstEdge)].removeEdge(v1, v2);
- }
+ graph[edgeOrientation(firstEdge)].removeEdge(v1, v2);
// Decrease vertices reference count (may trigger a deletion)
removeInternalVertex(firstItem, firstEdge);