diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-09-20 12:30:58 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-09-20 12:30:58 -0700 |
commit | e8578ad9c9709778ec368a604bc7a53bf8757308 (patch) | |
tree | 3f375f924841f30d4ea9f12e9b05ce300ef6acf5 /parse-xml.c | |
parent | 574d4d4facb83ee5505a988f5dc5830602fc8048 (diff) | |
parent | a8e2fd10c7845496e42e6f5b2f4d133d3cf5640b (diff) | |
download | subsurface-e8578ad9c9709778ec368a604bc7a53bf8757308.tar.gz |
Merge branch 'divetrip-rewrite' of git://github.com/torvalds/subsurface
Merge the dive trip rewrite by Dirk Hohndel.
This just merges the dive trip changes with the timestamp handling
changes. There were multiple small data conflicts, along with some
newly added 'time_t' cases in the dive trip handling that needed to be
converted to 'timestamp_t' along the way.
* 'divetrip-rewrite' of git://github.com/torvalds/subsurface:
Convert FIND_TRIP into function
Partial rewrite of the dive trip code
Check if trip is NULL before calling DIVE_TRIP
Diffstat (limited to 'parse-xml.c')
-rw-r--r-- | parse-xml.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/parse-xml.c b/parse-xml.c index f83deb705..da150d27e 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -156,7 +156,8 @@ const struct units IMPERIAL_units = { /* * Dive info as it is being built up.. */ -static struct dive *cur_dive, *cur_trip = NULL; +static struct dive *cur_dive; +static dive_trip_t *cur_trip = NULL; static struct sample *cur_sample; static struct { int active; @@ -512,8 +513,10 @@ static void get_tripflag(char *buffer, void *_tf) *tf = TF_NONE; for (i = NO_TRIP; i < NUM_TRIPFLAGS; i++) - if(! strcmp(buffer, tripflag_names[i])) + if(! strcmp(buffer, tripflag_names[i])) { *tf = i; + break; + } } static void centibar(char *buffer, void *_pressure) @@ -1122,21 +1125,23 @@ static void try_to_fill_dive(struct dive **divep, const char *name, char *buf) } /* We're in the top-level trip xml. Try to convert whatever value to a trip value */ -static void try_to_fill_trip(struct dive **divep, const char *name, char *buf) +static void try_to_fill_trip(dive_trip_t **dive_trip_p, const char *name, char *buf) { int len = strlen(name); start_match("trip", name, buf); - struct dive *dive = *divep; + dive_trip_t *dive_trip = *dive_trip_p; - if (MATCH(".date", divedate, &dive->when)) + if (MATCH(".date", divedate, &dive_trip->when)) return; - if (MATCH(".time", divetime, &dive->when)) + if (MATCH(".time", divetime, &dive_trip->when)) { + dive_trip->when_from_file = dive_trip->when; return; - if (MATCH(".location", utf8_string, &dive->location)) + } + if (MATCH(".location", utf8_string, &dive_trip->location)) return; - if (MATCH(".notes", utf8_string, &dive->notes)) + if (MATCH(".notes", utf8_string, &dive_trip->notes)) return; nonmatch("trip", name, buf); @@ -1182,7 +1187,7 @@ static void trip_start(void) { if (cur_trip) return; - cur_trip = alloc_dive(); + cur_trip = calloc(sizeof(dive_trip_t),1); memset(&cur_tm, 0, sizeof(cur_tm)); } |