Cleanup: removed unused functions in divelist.h

find_trip_by_idx() and find_matching_trip() weren't used anywhere.
The trip index actually is only misused as a "trip saved"-flag.

trip_has_selected_dives() only existed as a comment.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-07-18 07:48:45 +02:00 committed by Dirk Hohndel
parent b7bb9b4177
commit 3a933637da
2 changed files with 0 additions and 47 deletions

View file

@ -6,15 +6,12 @@
* dive_trip_t *dive_trip_list;
* unsigned int amount_selected;
* void dump_selection(void)
* dive_trip_t *find_trip_by_idx(int idx)
* int trip_has_selected_dives(dive_trip_t *trip)
* void get_dive_gas(struct dive *dive, int *o2_p, int *he_p, int *o2low_p)
* int total_weight(struct dive *dive)
* int get_divenr(struct dive *dive)
* int init_decompression(struct dive *dive)
* void update_cylinder_related_info(struct dive *dive)
* void dump_trip_list(void)
* dive_trip_t *find_matching_trip(timestamp_t when)
* void insert_trip(dive_trip_t **dive_trip_p)
* void remove_dive_from_trip(struct dive *dive)
* void add_dive_to_trip(struct dive *dive, dive_trip_t *trip)
@ -81,21 +78,6 @@ void set_autogroup(bool value)
autogroup = value;
}
dive_trip_t *find_trip_by_idx(int idx)
{
dive_trip_t *trip = dive_trip_list;
if (idx >= 0)
return NULL;
idx = -idx;
while (trip) {
if (trip->index == idx)
return trip;
trip = trip->next;
}
return NULL;
}
/*
* Get "maximal" dive gas for a dive.
* Rules:
@ -711,32 +693,6 @@ void dump_trip_list(void)
}
#endif
/* this finds the last trip that at or before the time given */
dive_trip_t *find_matching_trip(timestamp_t when)
{
dive_trip_t *trip = dive_trip_list;
if (!trip || trip->when > when) {
#ifdef DEBUG_TRIP
printf("no matching trip\n");
#endif
return NULL;
}
while (trip->next && trip->next->when <= when)
trip = trip->next;
#ifdef DEBUG_TRIP
{
struct tm tm;
utc_mkdate(trip->when, &tm);
printf("found trip %p @ %04d-%02d-%02d %02d:%02d:%02d\n",
trip,
tm.tm_year, tm.tm_mon + 1, tm.tm_mday,
tm.tm_hour, tm.tm_min, tm.tm_sec);
}
#endif
return trip;
}
/* insert the trip into the dive_trip_list - but ensure you don't have
* two trips for the same date; but if you have, make sure you don't
* keep the one with less information */

View file

@ -21,13 +21,10 @@ extern int init_decompression(struct deco_state *ds, struct dive *dive);
extern void process_dives(bool imported, bool prefer_imported);
extern char *get_dive_gas_string(struct dive *dive);
extern dive_trip_t *find_trip_by_idx(int idx);
struct dive **grow_dive_table(struct dive_table *table);
extern void get_dive_gas(struct dive *dive, int *o2_p, int *he_p, int *o2low_p);
extern int get_divenr(struct dive *dive);
extern int get_divesite_idx(struct dive_site *ds);
extern dive_trip_t *find_matching_trip(timestamp_t when);
extern void remove_dive_from_trip(struct dive *dive, short was_autogen);
extern dive_trip_t *create_and_hookup_trip_from_dive(struct dive *dive);
extern void autogroup_dives(void);