summaryrefslogtreecommitdiffstats
path: root/parse-xml.c
diff options
context:
space:
mode:
Diffstat (limited to 'parse-xml.c')
-rw-r--r--parse-xml.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/parse-xml.c b/parse-xml.c
index 9b223980d..a822395a7 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -67,17 +67,9 @@ void clear_table(struct dive_table *table)
void record_dive_to_table(struct dive *dive, struct dive_table *table)
{
assert(table != NULL);
- int nr = table->nr, allocated = table->allocated;
- struct dive **dives = table->dives;
+ struct dive **dives = grow_dive_table(table);
+ int nr = table->nr;
- if (nr >= allocated) {
- allocated = (nr + 32) * 3 / 2;
- dives = realloc(dives, allocated * sizeof(struct dive *));
- if (!dives)
- exit(1);
- table->dives = dives;
- table->allocated = allocated;
- }
dives[nr] = fixup_dive(dive);
table->nr = nr + 1;
}