Core: keep trips in table(s)

Currently, all trips are kept in a linked list. Replace the list
by a table in analogy to dive_table. Use this to keep the trip_table
sorted as suggested by dump_trip_list(). When inserting a trip into
the table do that after adding the dives, to avoid warnings coming
out of dump_trip_list().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-11-24 12:31:35 +01:00 committed by Dirk Hohndel
parent 54fcda4c32
commit 517fb7a462
7 changed files with 89 additions and 78 deletions

View file

@ -637,8 +637,8 @@ void save_dives_buffer(struct membuffer *b, const bool select_only, bool anonymi
put_format(b, "</site>\n");
}
put_format(b, "</divesites>\n<dives>\n");
for (trip = dive_trip_list; trip != NULL; trip = trip->next)
trip->saved = 0;
for (i = 0; i < trip_table.nr; ++i)
trip_table.trips[i]->saved = 0;
/* save the dives */
for_each_dive(i, dive) {