diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-08-29 19:05:30 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-08-29 21:43:17 -0700 |
commit | 5a66ac7698afbe82e3d55549fd63590918d0a3d9 (patch) | |
tree | e1c0d594e9a4404b2fdc767438f5071744ca17ac /.gitignore | |
parent | 99d1cecf067daca5d7ed45effac659150e978504 (diff) | |
download | subsurface-5a66ac7698afbe82e3d55549fd63590918d0a3d9.tar.gz |
Make sure DC_FIELD_TANK starts from a clean slate for each cylinder
We used to clear the 'dc_tank_t' for each dive, but then only clear the
volume field in between each cylinder. That means that if the
libdivecomputer back-end does not touch a field, it might contain the
stale value from the previous tank information.
I'm not sure this is actually much of an issue, since I'd expect
back-ends do seem to initialize the fields fully (at least the EON Steel
back-end does). But it's inconsistent.
Also, the code was actually buggy because of the odd indentation: it
would only ask for new tank information up to 'ntanks' tanks, but
because of the final fixup that was done outside of the conditional, it
would actually update the cylinder begin/end pressure data *beyond*
'ntanks', and just re-use the last libdivecomputer data for the rest of
the cylinders.
Again, in practice, that probably never really happened, but it is a
real bug.
The fixed-up code actually looks better too, imho, and is one line
shorter because of the initialization now being done in one place rather
than two.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to '.gitignore')
0 files changed, 0 insertions, 0 deletions