[PULL REQUEST] A couple of small mods post the delmulti rework

Linus Torvalds torvalds at linux-foundation.org
Sat Sep 29 12:48:41 PDT 2012

On Sat, Sep 29, 2012 at 12:08 PM, Dirk Hohndel <dirk at hohndel.org> wrote:
> I actually added the tripflag logic there, thinking that we didn't need to maintain the dive->divetrip but now that I think about this some more I believe I was wrong.
> Are you working on a fix or should I add that to my todo list?

You claim to have fixed it, but what was it that fixed it?

Shouldn't we update the "dive->divetrip" when we merge dives? IOW,
something like this (whitespace-damaged) patch?


diff --git a/dive.c b/dive.c
index b1739ad80e68..092153d8d3ba 100644
--- a/dive.c
+++ b/dive.c
@@ -711,10 +711,13 @@ struct dive *try_to_merge(struct dive *a, struct dive *b)

        res->when = a->when;
        /* the larger tripflag is more relevant */
-       if(a->tripflag > b->tripflag)
+       if(a->tripflag > b->tripflag) {
                res->tripflag = a->tripflag;
-       else
+               res->divetrip = a->divetrip;
+       } else {
                res->tripflag = b->tripflag;
+               res->divetrip = b->divetrip;
+       }
        MERGE_NONZERO(res, a, b, latitude);
        MERGE_NONZERO(res, a, b, longitude);
        MERGE_TXT(res, a, b, location);

More information about the subsurface mailing list