Core: add trip_table parameter to trip-functions

Currently trips are added to the global trip table. If we want to
make dive-import undoable, we should be able to parse trips of a
log-file into a distinct table. Therefore, add a trip_table
parameter to
	- insert_trip()
	- create_and_hookup_trip_from_dive()
	- autogroup_dives()
	- unregister_trip()
	- remove_dive_from_trip()

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-11-26 23:39:37 +01:00 committed by Dirk Hohndel
parent 7df8d8c888
commit ec37c71f5e
9 changed files with 45 additions and 46 deletions

View file

@ -215,7 +215,7 @@ static void record_uemis_dive(device_data_t *devdata, struct dive *dive)
{
if (devdata->create_new_trip) {
if (!devdata->trip)
devdata->trip = create_and_hookup_trip_from_dive(dive);
devdata->trip = create_and_hookup_trip_from_dive(dive, &trip_table);
else
add_dive_to_trip(dive, devdata->trip);
}
@ -859,7 +859,7 @@ static bool uemis_delete_dive(device_data_t *devdata, uint32_t diveid)
if (dive) {
devdata->download_table->dives[--devdata->download_table->nr] = NULL;
if (dive->notrip)
remove_dive_from_trip(dive);
remove_dive_from_trip(dive, &trip_table);
free(dive->dc.sample);
free((void *)dive->notes);