From e0c0ac5d5c7c218011278fbe57da291a7e10c8eb Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 12 May 2014 14:22:46 -0300 Subject: Rename getDiveById to get_dive_by_id to keep current c code organized. This commit renames getDiveById to get_dive_by_id, and it also removes the Q_ASSERTS and if(!dive) return that the callers of this function were calling. If it has a Q_ASSERT this means that the dive must exist, so checking for nullness was bogus too. I've changed the assert (done in a silly C-Way. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/profile/diveprofileitem.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'qt-ui/profile/diveprofileitem.cpp') diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp index c239d39a9..1615be87f 100644 --- a/qt-ui/profile/diveprofileitem.cpp +++ b/qt-ui/profile/diveprofileitem.cpp @@ -427,8 +427,7 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo int last_pressure[MAX_CYLINDERS] = { 0, }; int last_time[MAX_CYLINDERS] = { 0, }; struct plot_data *entry; - struct dive *dive = getDiveById(dataModel->id()); - Q_ASSERT(dive != NULL); + struct dive *dive = get_dive_by_diveid(dataModel->id()); cyl = -1; for (int i = 0, count = dataModel->rowCount(); i < count; i++) { @@ -490,9 +489,7 @@ void DiveGasPressureItem::paint(QPainter *painter, const QStyleOptionGraphicsIte QPen pen; pen.setCosmetic(true); pen.setWidth(2); - struct dive *d = getDiveById(dataModel->id()); - if (!d) - return; + struct dive *d = get_dive_by_diveid(dataModel->id()); struct plot_data *entry = dataModel->data().entry; Q_FOREACH(const QPolygonF & poly, polygons) { for (int i = 1, count = poly.count(); i < count; i++, entry++) { -- cgit v1.2.3-70-g09d2