mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-03 15:43:09 +00:00
core: remove get_event_mutable()
We can now return mutable/imutable depending on const-ness of the parameter, owing to parameter overloading. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
b8c7b173c6
commit
5960fb7340
4 changed files with 5 additions and 6 deletions
|
@ -166,7 +166,7 @@ AddGasSwitch::AddGasSwitch(struct dive *d, int dcNr, int seconds, int tank) : Ev
|
||||||
// support that anyway.
|
// support that anyway.
|
||||||
struct divecomputer *dc = get_dive_dc(d, dcNr);
|
struct divecomputer *dc = get_dive_dc(d, dcNr);
|
||||||
struct event *gasChangeEvent = dc->events;
|
struct event *gasChangeEvent = dc->events;
|
||||||
while ((gasChangeEvent = get_next_event_mutable(gasChangeEvent, "gaschange")) != NULL) {
|
while ((gasChangeEvent = get_next_event(gasChangeEvent, "gaschange")) != NULL) {
|
||||||
if (gasChangeEvent->time.seconds == seconds) {
|
if (gasChangeEvent->time.seconds == seconds) {
|
||||||
eventsToRemove.push_back(gasChangeEvent);
|
eventsToRemove.push_back(gasChangeEvent);
|
||||||
int idx = gasChangeEvent->gas.index;
|
int idx = gasChangeEvent->gas.index;
|
||||||
|
|
|
@ -652,7 +652,7 @@ void update_setpoint_events(const struct dive *dive, struct divecomputer *dc)
|
||||||
// an "SP change" event at t=0 is currently our marker for OC vs CCR
|
// an "SP change" event at t=0 is currently our marker for OC vs CCR
|
||||||
// this will need to change to a saner setup, but for now we can just
|
// this will need to change to a saner setup, but for now we can just
|
||||||
// check if such an event is there and adjust it, or add that event
|
// check if such an event is there and adjust it, or add that event
|
||||||
ev = get_next_event_mutable(dc->events, "SP change");
|
ev = get_next_event(dc->events, "SP change");
|
||||||
if (ev && ev->time.seconds == 0) {
|
if (ev && ev->time.seconds == 0) {
|
||||||
ev->value = new_setpoint;
|
ev->value = new_setpoint;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -56,8 +56,7 @@ extern struct event *clone_event_rename(const struct event *ev, const std::strin
|
||||||
extern bool same_event(const struct event *a, const struct event *b);
|
extern bool same_event(const struct event *a, const struct event *b);
|
||||||
extern enum event_severity get_event_severity(const struct event *ev);
|
extern enum event_severity get_event_severity(const struct event *ev);
|
||||||
|
|
||||||
/* Since C doesn't have parameter-based overloading, two versions of get_next_event. */
|
|
||||||
extern const struct event *get_next_event(const struct event *event, const std::string &name);
|
extern const struct event *get_next_event(const struct event *event, const std::string &name);
|
||||||
extern struct event *get_next_event_mutable(struct event *event, const std::string &name);
|
extern struct event *get_next_event(struct event *event, const std::string &name);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -221,7 +221,7 @@ int get_cylinder_index(const struct dive *dive, const struct event *ev)
|
||||||
return best < 0 ? 0 : best;
|
return best < 0 ? 0 : best;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct event *get_next_event_mutable(struct event *event, const std::string &name)
|
struct event *get_next_event(struct event *event, const std::string &name)
|
||||||
{
|
{
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -235,7 +235,7 @@ struct event *get_next_event_mutable(struct event *event, const std::string &nam
|
||||||
|
|
||||||
const struct event *get_next_event(const struct event *event, const std::string &name)
|
const struct event *get_next_event(const struct event *event, const std::string &name)
|
||||||
{
|
{
|
||||||
return get_next_event_mutable((struct event *)event, name);
|
return get_next_event((struct event *)event, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int count_events(const struct divecomputer *dc)
|
static int count_events(const struct divecomputer *dc)
|
||||||
|
|
Loading…
Reference in a new issue