diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-03-03 21:48:08 +0100 |
---|---|---|
committer | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-04-07 00:13:35 +0200 |
commit | 3aa1bb5bfae9a7ebf8f5e6cdbf751afcafdb4baf (patch) | |
tree | e53c177a5efe22da4ab772b9033062e463358e16 /core/dive.h | |
parent | 2417a54675011885c699dbe8a77a427effcb26c5 (diff) | |
download | subsurface-3aa1bb5bfae9a7ebf8f5e6cdbf751afcafdb4baf.tar.gz |
core: add remove_event_from_dc() function
We have a remove_event() function that
1) frees the event
2) works on the current divecomputer
3) compares the events because the profile has copies of events
However, for undo commands
1) we want to keep the event so that we can readd it later
2) we have to work on arbitrary divecomputers
3) we don't work with copies of events
Therefore, create a new remove_event_from_dc() function that
does all that. Moreover, make the event argument to remove_event()
const to (slightly) point out the difference in the API.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/dive.h')
-rw-r--r-- | core/dive.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/dive.h b/core/dive.h index 5bbce4b00..1de68f4ff 100644 --- a/core/dive.h +++ b/core/dive.h @@ -380,7 +380,8 @@ extern void add_gas_switch_event(struct dive *dive, struct divecomputer *dc, int extern struct event *create_event(unsigned int time, int type, int flags, int value, const char *name); extern void add_event_to_dc(struct divecomputer *dc, struct event *ev); extern struct event *add_event(struct divecomputer *dc, unsigned int time, int type, int flags, int value, const char *name); -extern void remove_event(struct event *event); +extern void remove_event_from_dc(struct divecomputer *dc, struct event *event); +extern void remove_event(const struct event *event); extern void update_event_name(struct dive *d, struct event *event, const char *name); extern void add_extra_data(struct divecomputer *dc, const char *key, const char *value); extern void per_cylinder_mean_depth(const struct dive *dive, struct divecomputer *dc, int *mean, int *duration); |