core: replace dive_site::dives by an std::vector<>

Since this is now in C++, we don't have to use our crazy
TABLE_* macros.

This contains a logic change: the dives associated to a
dive site are now unsorted.

The old code was subtly buggy: dives were added in a sorted
manner, but when the dive was edited the list was not
resorted. Very unlikely that this leads to a serious
problem, still not good.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-05-04 14:41:04 +02:00 committed by bstoeger
parent 3f8b4604be
commit 801b5d50b2
12 changed files with 39 additions and 45 deletions

View file

@ -1150,7 +1150,7 @@ void process_imported_dives(struct divelog *import_log, int flags,
if (!old_ds) {
/* Dive site doesn't exist. Add it to list of dive sites to be added. */
new_ds->dives.nr = 0; /* Caller is responsible for adding dives to site */
new_ds->dives.clear(); /* Caller is responsible for adding dives to site */
add_dive_site_to_table(new_ds, sites_to_add);
continue;
}