summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-09-22 18:01:01 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-09-22 18:01:01 -0700
commit50c2bb7c71b279237f05c1c0a530d494bad534c8 (patch)
tree99fc2d146a2c0fb36ea365501f04eb788a41dc0d /dive.c
parentd344d15a905576ca25a0585e6beb554388628bc6 (diff)
downloadsubsurface-50c2bb7c71b279237f05c1c0a530d494bad534c8.tar.gz
Properly merge dive buddies and divemaster information
When we merge dives, we didn't merge these fields properly. Do it. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/dive.c b/dive.c
index 41bbabd69..1de3759d1 100644
--- a/dive.c
+++ b/dive.c
@@ -198,6 +198,7 @@ struct dive *fixup_dive(struct dive *dive)
/* Don't pick a zero for MERGE_MIN() */
#define MERGE_MAX(res, a, b, n) res->n = MAX(a->n, b->n)
#define MERGE_MIN(res, a, b, n) res->n = (a->n)?(b->n)?MIN(a->n, b->n):(a->n):(b->n)
+#define MERGE_TXT(res, a, b, n) res->n = merge_text(a->n, b->n)
static struct dive *add_sample(struct sample *sample, int time, struct dive *dive)
{
@@ -334,8 +335,10 @@ struct dive *try_to_merge(struct dive *a, struct dive *b)
res = alloc_dive();
res->when = a->when;
- res->location = merge_text(a->location, b->location);
- res->notes = merge_text(a->notes, b->notes);
+ MERGE_TXT(res, a, b, location);
+ MERGE_TXT(res, a, b, notes);
+ MERGE_TXT(res, a, b, buddy);
+ MERGE_TXT(res, a, b, divemaster);
MERGE_MAX(res, a, b, number);
MERGE_MAX(res, a, b, maxdepth.mm);
res->meandepth.mm = 0;