summaryrefslogtreecommitdiffstats
path: root/dive.h
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-05-12 14:22:46 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-13 09:24:37 +0900
commite0c0ac5d5c7c218011278fbe57da291a7e10c8eb (patch)
tree85ad06d20621a0bed01ee4266e5e4f6bbc8e6838 /dive.h
parente1971e9425dfc5266fa1e15579ff36d2b17658da (diff)
downloadsubsurface-e0c0ac5d5c7c218011278fbe57da291a7e10c8eb.tar.gz
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 <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.h')
-rw-r--r--dive.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/dive.h b/dive.h
index 6ad21aa1f..b27eff218 100644
--- a/dive.h
+++ b/dive.h
@@ -436,7 +436,7 @@ static inline struct dive *get_dive_by_uemis_diveid(uint32_t diveid, uint32_t de
return NULL;
}
-static inline struct dive *getDiveById(int id)
+static inline struct dive *get_dive_by_diveid(int id)
{
int i;
struct dive *dive = NULL;
@@ -445,6 +445,12 @@ static inline struct dive *getDiveById(int id)
if (dive->id == id)
break;
}
+#ifdef DEBUG
+ if(dive == NULL){
+ fprintf(stderr, "Invalid id %x passed to get_dive_by_diveid, try to fix the code\n", id);
+ exit(1);
+ }
+#endif
return dive;
}