[PATCH 2/2] Move events and samples into a 'struct divecomputer'

Dirk Hohndel dirk at hohndel.org
Fri Nov 23 19:41:58 PST 2012


Linus Torvalds <torvalds at linux-foundation.org> writes:
>
> The patch is pretty big, because there's a *lot* of code that accesses the 
> samples, and now we have to change it to use "dc->sample" instead of 
> "dive->sample", and pass in the dive computer pointer rather than the 
> dive.
>
> We actually currently only have one (fixed) dive computer per dive, so the 
> conversion *could* have been a purely mechanical "dive->sample" to 
> "dive->dc.sample" conversion, but that would have been largely pointless 
> for future work.
>
> So instead, I try to actually pass in the dive computer pointer 
> explicitly, so that once we start supporting saving data for multiple 
> independent dive computers in the same dive (without mixing them up), we 
> can do so with hopefully not oo many big changes.
>
> However, there are still various pieces of code that knows that there is 
> exactly one dive computer, so there are several cases where we do do that 
> direct "&dive->dc" thing. But at least the *bulk* of the code now treats 
> dive computer data as being separate from the dive.

I really like these two patches and I like the direction they are taking
us. I wonder if it wouldn't have been better to just assume that there
are (let's say) a maximum of five dive computers and have the structures
set up for that - because we'll have another pretty big change coming
when we switch to that... but I pushed it as is as it certainly makes a
lot of sense the way it's implemented now.

Thanks

/D


More information about the subsurface mailing list