Core: add add_dive_to_table() function

Up to now, dives were added to the global dive table with
add_single_dive(). Split out the funtionality to add a dive to
an arbitrary dive in the add_dive_to_table_function(). The
difference compared to record_dive_to_table is that dives
are added at a specific position or the sort-criterion given
by dive_less_than(). This will allow to use a dive tabe for trips
instead of a linked list.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-11-08 14:02:36 +01:00 committed by Dirk Hohndel
parent 0618aa737f
commit bc7afebc23
4 changed files with 30 additions and 20 deletions

View file

@ -22,7 +22,10 @@ extern void process_loaded_dives();
extern void process_imported_dives(struct dive_table *import_table, bool prefer_imported, bool downloaded);
extern char *get_dive_gas_string(const struct dive *dive);
struct dive **grow_dive_table(struct dive_table *table);
extern struct dive **grow_dive_table(struct dive_table *table);
extern int dive_get_insertion_index(struct dive_table *table, struct dive *dive);
extern void add_dive_to_table(struct dive_table *table, int idx, struct dive *dive);
extern void add_single_dive(int idx, struct dive *dive);
extern void get_dive_gas(const struct dive *dive, int *o2_p, int *he_p, int *o2low_p);
extern int get_divenr(const struct dive *dive);
extern int get_divesite_idx(const struct dive_site *ds);