summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-09-19 23:02:50 -0500
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-09-19 23:05:17 -0500
commit46c23c53a12485e3e59e8d52bf9ba6943bdfc200 (patch)
tree4292ce1dcf5ad7f908572dd20138db558a465dba /dive.c
parent169d9e9c015efa779ec67abdfb27ca6c462c3d63 (diff)
parent6881f527390ed7e386fee60176c9b8bba9bfb316 (diff)
downloadsubsurface-46c23c53a12485e3e59e8d52bf9ba6943bdfc200.tar.gz
Merge branch 'addDive'
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/dive.c b/dive.c
index f9f78d6bb..66d282d10 100644
--- a/dive.c
+++ b/dive.c
@@ -161,6 +161,19 @@ struct dive *alloc_dive(void)
return dive;
}
+void copy_samples(struct dive* s, struct dive* d)
+{
+ /* instead of carefully copying them one by one and calling add_sample
+ * over and over again, let's just copy the whole blob */
+ if (!s || !d)
+ return;
+ int nr = s->dc.samples;
+ d->dc.samples = nr;
+ d->dc.sample = malloc(nr * sizeof(struct sample));
+ if (d->dc.sample)
+ memcpy(d->dc.sample, s->dc.sample, nr * sizeof(struct sample));
+}
+
struct sample *prepare_sample(struct divecomputer *dc)
{
if (dc) {