aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'file.c')
-rw-r--r--file.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/file.c b/file.c
index 3ca5f93cb..cdad961e5 100644
--- a/file.c
+++ b/file.c
@@ -174,6 +174,7 @@ static int try_to_open_csv(const char *filename, struct memblock *mem, enum csv_
int i, time;
timestamp_t date;
struct dive *dive;
+ struct divecomputer *dc;
for (i = 0; i < 8; i++) {
header[i] = p;
@@ -190,6 +191,7 @@ static int try_to_open_csv(const char *filename, struct memblock *mem, enum csv_
dive = alloc_dive();
dive->when = date;
dive->number = atoi(header[1]);
+ dc = &dive->dc;
time = 0;
for (;;) {
@@ -204,13 +206,13 @@ static int try_to_open_csv(const char *filename, struct memblock *mem, enum csv_
if (errno)
break;
- sample = prepare_sample(&dive->dc);
+ sample = prepare_sample(dc);
sample->time.seconds = time;
add_sample_data(sample, type, val);
- finish_sample(&dive->dc);
+ finish_sample(dc);
time++;
- dive->dc.duration.seconds = time;
+ dc->duration.seconds = time;
if (*end != ',')
break;
p = end+1;