From be9f9efb0eae6f09db4c61de7a5156b186dc2ad6 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 9 Jan 2021 18:58:33 +0100 Subject: profile: pass dive to EventItem Don't access the global displayed_dive variable in an effort to make the profile reentrant. Note that this still accesses the global dc_number variable, which will likely have to be removed. Signed-off-by: Berthold Stoeger --- core/dive.c | 5 +++++ core/dive.h | 1 + 2 files changed, 6 insertions(+) (limited to 'core') diff --git a/core/dive.c b/core/dive.c index 9167724d9..7e0a8a66d 100644 --- a/core/dive.c +++ b/core/dive.c @@ -3316,6 +3316,11 @@ struct divecomputer *get_dive_dc(struct dive *dive, int nr) return dc; } +const struct divecomputer *get_dive_dc_const(const struct dive *dive, int nr) +{ + return get_dive_dc((struct dive *)dive, nr); +} + struct dive *get_dive_by_uniq_id(int id) { int i; diff --git a/core/dive.h b/core/dive.h index a38236fc5..5bd5989d7 100644 --- a/core/dive.h +++ b/core/dive.h @@ -122,6 +122,7 @@ extern const char *get_dive_country(const struct dive *dive); extern const char *get_dive_location(const struct dive *dive); extern unsigned int number_of_computers(const struct dive *dive); extern struct divecomputer *get_dive_dc(struct dive *dive, int nr); +extern const struct divecomputer *get_dive_dc_const(const struct dive *dive, int nr); extern timestamp_t dive_endtime(const struct dive *dive); extern struct dive *make_first_dc(const struct dive *d, int dc_number); -- cgit v1.2.3-70-g09d2