mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Undo: don't modify source-dives on merge
For undo, it is crucial that commands don't modify existing dives. Unfortunately, dive merging would write into the data-structures of the to-be-merged dives. To prevent it from doing so, make the input dives const-pointers. This led to a whole cascade of functions that had to take const and significant churn. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
1afd295c41
commit
8c2383b495
2 changed files with 259 additions and 153 deletions
|
|
@ -573,7 +573,7 @@ extern int split_dive_dont_insert(const struct dive *dive, struct dive **new1, s
|
|||
extern void split_dive(struct dive *);
|
||||
extern int split_dive_at_time_dont_insert(const struct dive *dive, duration_t time, struct dive **new1, struct dive **new2);
|
||||
extern void split_dive_at_time(struct dive *dive, duration_t time);
|
||||
extern struct dive *merge_dives(struct dive *a, struct dive *b, int offset, bool prefer_downloaded, struct dive_trip **trip);
|
||||
extern struct dive *merge_dives(const struct dive *a, const struct dive *b, int offset, bool prefer_downloaded, struct dive_trip **trip);
|
||||
extern struct dive *try_to_merge(struct dive *a, struct dive *b, bool prefer_downloaded);
|
||||
extern struct event *clone_event(const struct event *src_ev);
|
||||
extern void copy_events(const struct divecomputer *s, struct divecomputer *d);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue