summaryrefslogtreecommitdiffstats
path: root/divelist.h
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2015-10-01 21:13:48 -0400
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-01 22:28:04 -0400
commitb5b7bdda81acd0ee8c14a081f8bfd38d9809cec8 (patch)
tree6918ffb14e88a9fd2c7aea4948568e39dc202753 /divelist.h
parentb80079c37f7bad67cf91d96ef7c79e87ac0801cb (diff)
downloadsubsurface-b5b7bdda81acd0ee8c14a081f8bfd38d9809cec8.tar.gz
Make add_single_dive() grow the divelist allocation if necessary
We only made sure the divelist allocation was big enough in "record_dive_to_table()", but add_single_dive() can add entries too. Now, in practice that never bit anybody, since (a) we allocate extra entries anyway, and it would be very unusual that the divelist table was exactly full (b) most "malloc()" implementations end up having their own slop on top of that (c) add_single_dive() was only used for merging dives, which actually ends up removing more divex than it adds (but it does add one first) but when I'm starting to split dives, this will be a bigger issue in practice. And it was wrong. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.h')
-rw-r--r--divelist.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/divelist.h b/divelist.h
index bc3fd1af1..5bae09cff 100644
--- a/divelist.h
+++ b/divelist.h
@@ -22,6 +22,7 @@ extern char *get_dive_gas_string(struct dive *dive);
extern dive_trip_t *find_trip_by_idx(int idx);
+struct dive **grow_dive_table(struct dive_table *table);
extern int trip_has_selected_dives(dive_trip_t *trip);
extern void get_dive_gas(struct dive *dive, int *o2_p, int *he_p, int *o2low_p);
extern int get_divenr(struct dive *dive);