diff options
Diffstat (limited to 'core/divelist.c')
-rw-r--r-- | core/divelist.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/divelist.c b/core/divelist.c index a903c06f6..db84f53cf 100644 --- a/core/divelist.c +++ b/core/divelist.c @@ -42,6 +42,8 @@ * bool is_trip_before_after(const struct dive *dive, bool before) * void delete_dive_from_table(struct dive_table *table, int idx) * int find_next_visible_dive(timestamp_t when); + * void clear_dive_file_data() + * void clear_table(struct dive_table *table) */ #include <unistd.h> #include <stdio.h> @@ -1683,6 +1685,16 @@ void clear_dive_file_data() saved_git_id = ""; } +/* + * Clear a dive_table + */ +void clear_table(struct dive_table *table) +{ + for (int i = 0; i < table->nr; i++) + free(table->dives[i]); + table->nr = 0; +} + /* This function defines the sort ordering of dives. The core * and the UI models should use the same sort function, which * should be stable. This is not crucial at the moment, as the |