From d129085b59df6e84f0415c347e8425c13b5ca868 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Tue, 4 Jun 2019 21:25:42 +0200 Subject: Cleanup: use add_to_dive_table() in record_dive_to_table() This was reimplementing functionality that was already there. Simply call the already existing function. Thus, we don't have to export the grow_dive_table function. Signed-off-by: Berthold Stoeger --- core/divelist.c | 2 +- core/divelist.h | 1 - core/parse.c | 7 +------ 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/core/divelist.c b/core/divelist.c index af253fb4e..62e79ac59 100644 --- a/core/divelist.c +++ b/core/divelist.c @@ -775,7 +775,7 @@ int comp_dives(const struct dive *a, const struct dive *b) } /* Dive table functions */ -MAKE_GROW_TABLE(dive_table, struct dive *, dives) +static MAKE_GROW_TABLE(dive_table, struct dive *, dives) MAKE_GET_INSERTION_INDEX(dive_table, struct dive *, dives, dive_less_than) MAKE_ADD_TO(dive_table, struct dive *, dives) static MAKE_REMOVE_FROM(dive_table, dives) diff --git a/core/divelist.h b/core/divelist.h index f363cc336..75f096feb 100644 --- a/core/divelist.h +++ b/core/divelist.h @@ -31,7 +31,6 @@ extern void process_imported_dives(struct dive_table *import_table, struct trip_ struct trip_table *trips_to_add, struct dive_site_table *sites_to_add); extern char *get_dive_gas_string(const struct dive *dive); -extern struct dive **grow_dive_table(struct dive_table *table); extern int dive_table_get_insertion_index(struct dive_table *table, struct dive *dive); extern void add_to_dive_table(struct dive_table *table, int idx, struct dive *dive); extern void append_dive(struct dive *dive); diff --git a/core/parse.c b/core/parse.c index 8bd960179..0581ace00 100644 --- a/core/parse.c +++ b/core/parse.c @@ -78,12 +78,7 @@ int trimspace(char *buffer) */ void record_dive_to_table(struct dive *dive, struct dive_table *table) { - assert(table != NULL); - struct dive **dives = grow_dive_table(table); - int nr = table->nr; - - dives[nr] = fixup_dive(dive); - table->nr = nr + 1; + add_to_dive_table(table, table->nr, fixup_dive(dive)); } void record_dive(struct dive *dive) -- cgit v1.2.3-70-g09d2