mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Start cleaning up dive accessors
I'm going to add a menu to import (and eventually export) dives, and so we'd like to be able to start out with no dives at all. Right now we croak if that happens - it's not like the code has been written with actual end users in mind. So start cleaning things up. First make the 'current_dive' macro work right even for invalid dives. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
c17300cfaa
commit
00d798854a
2 changed files with 9 additions and 2 deletions
7
dive.h
7
dive.h
|
@ -121,6 +121,13 @@ struct dive_table {
|
|||
|
||||
extern struct dive_table dive_table;
|
||||
|
||||
static inline struct dive *get_dive(unsigned int nr)
|
||||
{
|
||||
if (nr >= dive_table.nr)
|
||||
return NULL;
|
||||
return dive_table.dives[nr];
|
||||
}
|
||||
|
||||
extern void parse_xml_init(void);
|
||||
extern void parse_xml_file(const char *filename);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue