diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-10-14 15:33:46 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-10-14 15:55:07 -0400 |
commit | 0b57b8d59f9e9eeb10f7d66bb4b83f78394f68e7 (patch) | |
tree | 71f07f6f97bf5230b8174884976e43d6e11e22d7 | |
parent | b01cba13c5dc81ed7367ae79b6af361e6abc0da1 (diff) | |
download | subsurface-0b57b8d59f9e9eeb10f7d66bb4b83f78394f68e7.tar.gz |
Cleanup: move clear_table() to divesite.c
There were two declaration of clear_table(), one in dive.h and one
in parse.h. The definition was in parse.c. Since the parser doesn't
even use the function, move the function and its declaration to
divelist.[ch] and remove the redundant declaration in dive.h.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r-- | core/dive.h | 2 | ||||
-rw-r--r-- | core/divelist.c | 12 | ||||
-rw-r--r-- | core/divelist.h | 1 | ||||
-rw-r--r-- | core/parse.c | 10 | ||||
-rw-r--r-- | core/parse.h | 1 |
5 files changed, 13 insertions, 13 deletions
diff --git a/core/dive.h b/core/dive.h index 4f453d722..ef69bc934 100644 --- a/core/dive.h +++ b/core/dive.h @@ -552,8 +552,6 @@ extern void copy_dive(const struct dive *s, struct dive *d); extern void selective_copy_dive(const struct dive *s, struct dive *d, struct dive_components what, bool clear); extern struct dive *clone_dive(struct dive *s); -extern void clear_table(struct dive_table *table); - extern void alloc_samples(struct divecomputer *dc, int num); extern void free_samples(struct divecomputer *dc); extern struct sample *prepare_sample(struct divecomputer *dc); 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 diff --git a/core/divelist.h b/core/divelist.h index a99394d5c..681934a0c 100644 --- a/core/divelist.h +++ b/core/divelist.h @@ -58,6 +58,7 @@ void reset_min_datafile_version(); void report_datafile_version(int version); int get_dive_id_closest_to(timestamp_t when); void clear_dive_file_data(); +void clear_table(struct dive_table *table); #ifdef DEBUG_TRIP extern void dump_selection(void); diff --git a/core/parse.c b/core/parse.c index a444dc441..054db156f 100644 --- a/core/parse.c +++ b/core/parse.c @@ -71,16 +71,6 @@ int trimspace(char *buffer) } /* - * 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; -} - -/* * Add a dive into the dive_table array */ void record_dive_to_table(struct dive *dive, struct dive_table *table) diff --git a/core/parse.h b/core/parse.h index 403988e10..b2c2cbb96 100644 --- a/core/parse.h +++ b/core/parse.h @@ -57,7 +57,6 @@ extern struct dive_table *target_table; extern int metric; int trimspace(char *buffer); -void clear_table(struct dive_table *table); void start_match(const char *type, const char *name, char *buffer); void nonmatch(const char *type, const char *name, char *buffer); void event_start(void); |