core: move get_same_dive_site() into dive_site_table class

This was the only dive_site_table function that accessed
to global divelog, which is odd. Make it consistent with
the others.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-05-11 18:41:49 +02:00 committed by bstoeger
parent 4ac2486a23
commit 512eada468
4 changed files with 7 additions and 10 deletions

View file

@ -3,7 +3,6 @@
#include "divesite.h"
#include "dive.h"
#include "divelist.h"
#include "divelog.h"
#include "errorhelper.h"
#include "format.h"
#include "membuffer.h"
@ -179,10 +178,9 @@ static bool same(const struct dive_site &a, const struct dive_site &b)
&& a.notes == b.notes;
}
struct dive_site *get_same_dive_site(const struct dive_site &site)
dive_site *dive_site_table::get_same(const struct dive_site &site) const
{
return get_by_predicate(*divelog.sites,
[site](const auto &ds) { return same(*ds, site); });
return get_by_predicate(*this, [site](const auto &ds) { return same(*ds, site); });
}
void dive_site::merge(dive_site &b)