Cleanup: remove unused parameter was_autogen

In commit 6bf4120dbb the trip-flags
were replaced by a simple boolean. This made the was_autogen
parameter to the remove_dive_from_trip() and unregister_dive_from_trip()
functions unused. Remove these parameters.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-12-23 10:08:44 +01:00 committed by Dirk Hohndel
parent 95736506fe
commit 99d29a7838
4 changed files with 13 additions and 12 deletions

View file

@ -19,7 +19,8 @@
* void insert_trip(dive_trip_t *dive_trip_p) * void insert_trip(dive_trip_t *dive_trip_p)
* void unregister_trip(dive_trip_t *trip) * void unregister_trip(dive_trip_t *trip)
* void free_trip(dive_trip_t *trip) * void free_trip(dive_trip_t *trip)
* void remove_dive_from_trip(struct dive *dive, bool was_autogen) * void remove_dive_from_trip(struct dive *dive)
* struct dive_trip *unregister_dive_from_trip(struct dive *dive)
* void add_dive_to_trip(struct dive *dive, dive_trip_t *trip) * void add_dive_to_trip(struct dive *dive, dive_trip_t *trip)
* dive_trip_t *create_and_hookup_trip_from_dive(struct dive *dive) * dive_trip_t *create_and_hookup_trip_from_dive(struct dive *dive)
* dive_trip_t *get_dives_to_autogroup(int start, int *from, int *to, bool *allocated) * dive_trip_t *get_dives_to_autogroup(int start, int *from, int *to, bool *allocated)
@ -884,7 +885,7 @@ static void unregister_dive_from_table(struct dive_table *table, int idx)
* trip if this was the last dive in the trip. the caller is responsible * trip if this was the last dive in the trip. the caller is responsible
* for removing the trip, if the trip->dives.nr went to 0. * for removing the trip, if the trip->dives.nr went to 0.
*/ */
struct dive_trip *unregister_dive_from_trip(struct dive *dive, short was_autogen) struct dive_trip *unregister_dive_from_trip(struct dive *dive)
{ {
dive_trip_t *trip = dive->divetrip; dive_trip_t *trip = dive->divetrip;
int idx; int idx;
@ -899,9 +900,9 @@ struct dive_trip *unregister_dive_from_trip(struct dive *dive, short was_autogen
return trip; return trip;
} }
void remove_dive_from_trip(struct dive *dive, short was_autogen) void remove_dive_from_trip(struct dive *dive)
{ {
struct dive_trip *trip = unregister_dive_from_trip(dive, was_autogen); struct dive_trip *trip = unregister_dive_from_trip(dive);
if (trip && trip->dives.nr == 0) if (trip && trip->dives.nr == 0)
delete_trip(trip); delete_trip(trip);
} }
@ -1097,7 +1098,7 @@ void delete_single_dive(int idx)
return; /* this should never happen */ return; /* this should never happen */
if (dive->selected) if (dive->selected)
deselect_dive(dive); deselect_dive(dive);
remove_dive_from_trip(dive, false); remove_dive_from_trip(dive);
delete_dive_from_table(&dive_table, idx); delete_dive_from_table(&dive_table, idx);
} }
@ -1406,9 +1407,9 @@ static bool try_to_merge_into(struct dive *dive_to_add, int idx, bool prefer_imp
merged->selected = old_dive->selected; merged->selected = old_dive->selected;
dive_table.dives[idx] = merged; dive_table.dives[idx] = merged;
if (trip) if (trip)
remove_dive_from_trip(old_dive, false); remove_dive_from_trip(old_dive);
free_dive(old_dive); free_dive(old_dive);
remove_dive_from_trip(dive_to_add, false); remove_dive_from_trip(dive_to_add);
free_dive(dive_to_add); free_dive(dive_to_add);
return true; return true;

View file

@ -28,8 +28,8 @@ extern void add_single_dive(int idx, struct dive *dive);
extern void get_dive_gas(const struct dive *dive, int *o2_p, int *he_p, int *o2low_p); extern void get_dive_gas(const struct dive *dive, int *o2_p, int *he_p, int *o2low_p);
extern int get_divenr(const struct dive *dive); extern int get_divenr(const struct dive *dive);
extern int get_divesite_idx(const struct dive_site *ds); extern int get_divesite_idx(const struct dive_site *ds);
extern struct dive_trip *unregister_dive_from_trip(struct dive *dive, short was_autogen); extern struct dive_trip *unregister_dive_from_trip(struct dive *dive);
extern void remove_dive_from_trip(struct dive *dive, short was_autogen); extern void remove_dive_from_trip(struct dive *dive);
extern dive_trip_t *alloc_trip(void); extern dive_trip_t *alloc_trip(void);
extern dive_trip_t *create_trip_from_dive(struct dive *dive); extern dive_trip_t *create_trip_from_dive(struct dive *dive);
extern dive_trip_t *create_and_hookup_trip_from_dive(struct dive *dive); extern dive_trip_t *create_and_hookup_trip_from_dive(struct dive *dive);

View file

@ -859,7 +859,7 @@ static bool uemis_delete_dive(device_data_t *devdata, uint32_t diveid)
if (dive) { if (dive) {
devdata->download_table->dives[--devdata->download_table->nr] = NULL; devdata->download_table->dives[--devdata->download_table->nr] = NULL;
if (dive->notrip) if (dive->notrip)
remove_dive_from_trip(dive, false); remove_dive_from_trip(dive);
free(dive->dc.sample); free(dive->dc.sample);
free((void *)dive->notes); free((void *)dive->notes);

View file

@ -65,7 +65,7 @@ DiveToAdd DiveListBase::removeDive(struct dive *d)
// remove dive from trip - if this is the last dive in the trip // remove dive from trip - if this is the last dive in the trip
// remove the whole trip. // remove the whole trip.
res.trip = unregister_dive_from_trip(d, false); res.trip = unregister_dive_from_trip(d);
if (res.trip && res.trip->dives.nr == 0) { if (res.trip && res.trip->dives.nr == 0) {
unregister_trip(res.trip); // Remove trip from backend unregister_trip(res.trip); // Remove trip from backend
res.tripToAdd.reset(res.trip); // Take ownership of trip res.tripToAdd.reset(res.trip); // Take ownership of trip
@ -226,7 +226,7 @@ static OwningTripPtr moveDiveToTrip(DiveToTrip &diveToTrip)
OwningTripPtr res; OwningTripPtr res;
// Remove dive from trip - if this is the last dive in the trip, remove the whole trip. // Remove dive from trip - if this is the last dive in the trip, remove the whole trip.
dive_trip *trip = unregister_dive_from_trip(diveToTrip.dive, false); dive_trip *trip = unregister_dive_from_trip(diveToTrip.dive);
if (trip && trip->dives.nr == 0) { if (trip && trip->dives.nr == 0) {
unregister_trip(trip); // Remove trip from backend unregister_trip(trip); // Remove trip from backend
res.reset(trip); res.reset(trip);