Allocate dive samples separately from 'struct dive'

We used to avoid some extra allocations by just allocating the dive
samples as part of the 'struct dive' allocation itself, but that ends up
complicating things, and will make it impossible to have multiple
different sets of samples (for multiple dive computers).

So stop doing it. Just allocate the dive samples array separately.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Linus Torvalds 2012-11-23 16:05:38 -10:00 committed by Dirk Hohndel
parent 10ce60e212
commit a9786564c2
7 changed files with 45 additions and 66 deletions

View file

@ -1931,6 +1931,7 @@ void delete_single_dive(int idx)
dive_table.nr--;
if (dive->selected)
amount_selected--;
free(dive->sample);
free(dive);
}