summaryrefslogtreecommitdiffstats
path: root/dive.h
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-09-12 12:56:34 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-09-12 12:56:34 -0700
commitaa416e3c96dfa53db5ae277e72f6a03821c45cac (patch)
treed0adaa4ac077f64fa08e084348281c49821ff3fe /dive.h
parentd45db9fac7b3d2ea0426a96158432f54d938f5c7 (diff)
downloadsubsurface-aa416e3c96dfa53db5ae277e72f6a03821c45cac.tar.gz
Abstract out dive/sample allocation a bit
We're going to start to want to allocate dives and samples for the libdivecomputer import too, so let's clean things up a bit for that. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'dive.h')
-rw-r--r--dive.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/dive.h b/dive.h
index d96e0102d..ee57cf820 100644
--- a/dive.h
+++ b/dive.h
@@ -137,7 +137,7 @@ struct dive {
depth_t visibility;
temperature_t airtemp, watertemp;
cylinder_t cylinder[MAX_CYLINDERS];
- int samples;
+ int samples, alloc_samples;
struct sample sample[];
};
@@ -193,6 +193,12 @@ static inline unsigned int dive_size(int samples)
return sizeof(struct dive) + samples*sizeof(struct sample);
}
+extern struct dive *alloc_dive(void);
+extern void record_dive(struct dive *dive);
+
+extern struct sample *prepare_sample(struct dive **divep);
+extern void finish_sample(struct dive *dive, struct sample *sample);
+
extern struct dive *fixup_dive(struct dive *dive);
extern struct dive *try_to_merge(struct dive *a, struct dive *b);