summaryrefslogtreecommitdiffstats
path: root/core/trip.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-06-04 20:59:08 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-06-19 13:11:10 -0700
commit3df32044ee46caf518b23cc6359f98501f7ca961 (patch)
tree860615069cf0b5f36627b0815d374c66e265dbde /core/trip.c
parentf4ef1c4bc8805600e018777f18f3f29682e40c2d (diff)
downloadsubsurface-3df32044ee46caf518b23cc6359f98501f7ca961.tar.gz
Cleanup: generate clear_*_table() functions by macro
In analogy to the other table functions, generate these by a macro as well. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/trip.c')
-rw-r--r--core/trip.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/core/trip.c b/core/trip.c
index a864e8dfb..446f153eb 100644
--- a/core/trip.c
+++ b/core/trip.c
@@ -49,6 +49,7 @@ static MAKE_ADD_TO(trip_table, struct dive_trip *, trips)
static MAKE_REMOVE_FROM(trip_table, trips)
MAKE_SORT(trip_table, struct dive_trip *, trips, comp_trips)
MAKE_REMOVE(trip_table, struct dive_trip *, trip)
+MAKE_CLEAR_TABLE(trip_table, trips, trip)
timestamp_t trip_date(const struct dive_trip *trip)
{
@@ -294,13 +295,6 @@ dive_trip_t *combine_trips(struct dive_trip *trip_a, struct dive_trip *trip_b)
return trip;
}
-void clear_trip_table(struct trip_table *table)
-{
- for (int i = 0; i < table->nr; i++)
- free_trip(table->trips[i]);
- table->nr = 0;
-}
-
/* Trips are compared according to the first dive in the trip. */
int comp_trips(const struct dive_trip *a, const struct dive_trip *b)
{