mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: make get_trip_by_uniq_id a member of trip_table
Don't access the global trip_table in an attempt to cut down on implicit accesses of global variables. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
eacad89531
commit
71518fa77e
3 changed files with 6 additions and 7 deletions
|
|
@ -138,11 +138,10 @@ std::pair<dive_trip *, std::unique_ptr<dive_trip>> get_trip_for_new_dive(const s
|
|||
}
|
||||
|
||||
/* lookup of trip in main trip_table based on its id */
|
||||
dive_trip *get_trip_by_uniq_id(int tripId)
|
||||
dive_trip *trip_table::get_by_uniq_id(int tripId) const
|
||||
{
|
||||
auto it = std::find_if(divelog.trips->begin(), divelog.trips->end(),
|
||||
[tripId](auto &t) { return t->id == tripId; });
|
||||
return it != divelog.trips->end() ? it->get() : nullptr;
|
||||
auto it = std::find_if(begin(), end(), [tripId](auto &t) { return t->id == tripId; });
|
||||
return it != end() ? it->get() : nullptr;
|
||||
}
|
||||
|
||||
/* Check if two trips overlap time-wise up to trip threshold. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue