mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
e1971e9425
commit
e0c0ac5d5c
5 changed files with 21 additions and 28 deletions
8
dive.h
8
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue