summaryrefslogtreecommitdiffstats
path: root/subsurface-core/dive.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-02-20 09:36:14 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-02-20 09:36:14 -0800
commit38ab11a6c0299fb55944bdb1438d9ac357682d4d (patch)
treedbcc5d6485ea45565a2d10acdd771230eb48414e /subsurface-core/dive.c
parent0b0e56edebc849818b7a76b1c4e809f357394e04 (diff)
downloadsubsurface-38ab11a6c0299fb55944bdb1438d9ac357682d4d.tar.gz
Add option to allocate the samples in fake_dc()
We (ab)use fake_dc() to create a pleasing profile for a manually added dive. Based on it's intended use, fake_dc() simply handed back a dc structure that pointed at staticly allocated samples - that's obviously (now that I think about it) going to blow up in my face if I edit a manually added dive more than once. So now we have an option for fake_dc() to actually allocate the samples - this way the rest of the code can treat these samples as we would treat samples created any other way. We can free them and replace them with a new set. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-core/dive.c')
-rw-r--r--subsurface-core/dive.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/subsurface-core/dive.c b/subsurface-core/dive.c
index fd0d25989..85ad3f597 100644
--- a/subsurface-core/dive.c
+++ b/subsurface-core/dive.c
@@ -762,7 +762,7 @@ void per_cylinder_mean_depth(struct dive *dive, struct divecomputer *dc, int *me
return;
}
if (!dc->samples)
- dc = fake_dc(dc);
+ dc = fake_dc(dc, false);
for (i = 0; i < dc->samples; i++) {
struct sample *sample = dc->sample + i;
int time = sample->time.seconds;