diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-11-23 16:05:38 -1000 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2012-11-23 19:33:39 -0800 |
commit | a9786564c23fbf032f47096f543699c8c402785b (patch) | |
tree | 551231e54e017c9e83fd44da59edbe4c94dfa716 /uemis.c | |
parent | 10ce60e2120419282ff7694e8deda60e94832aa1 (diff) | |
download | subsurface-a9786564c23fbf032f47096f543699c8c402785b.tar.gz |
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>
Diffstat (limited to 'uemis.c')
-rw-r--r-- | uemis.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -185,8 +185,7 @@ void uemis_parse_divelog_binary(char *base64, void *datap) { uint8_t *data; struct sample *sample; uemis_sample_t *u_sample; - struct dive **divep = datap; - struct dive *dive = *divep; + struct dive *dive = datap; int template, gasoffset; in_deco = FALSE; @@ -236,8 +235,7 @@ void uemis_parse_divelog_binary(char *base64, void *datap) { * duration in the header is a) in minutes and b) up to 3 minutes short */ if (u_sample->dive_time > dive->duration.seconds + 180) break; - sample = prepare_sample(divep); - dive = *divep; /* prepare_sample might realloc the dive */ + sample = prepare_sample(dive); sample->time.seconds = u_sample->dive_time; sample->depth.mm = rel_mbar_to_depth(u_sample->water_pressure, dive); sample->temperature.mkelvin = (u_sample->dive_temperature * 100) + 273150; |