aboutsummaryrefslogtreecommitdiffstats
path: root/subsurface-core
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2016-02-21 15:09:46 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-02-21 16:32:45 -0800
commit1f7f3c4af59cea6a76a68bdfea95c3ae4f86a615 (patch)
tree0aaa9aae1f37c0bc0f0ad0aee1664b2a38a23974 /subsurface-core
parent5da94865334b1dd0fe5479deb131973d9740e2a2 (diff)
downloadsubsurface-1f7f3c4af59cea6a76a68bdfea95c3ae4f86a615.tar.gz
pressure interpolation: get rid of pointless and confusing code
In the function fill_missing_tank_pressures(), we only ever call get_pr_interpolate_data() if "pressure" is zero. So passing it in as an argument, and then testing whether it is zero or not, is just totally pointless, and only obfuscates things. This whole thing seems to be due to people editing the code over time, with the tests becoming superfluous as the code around it changed, and nobody looking at whether it actually made sense any more. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-core')
-rw-r--r--subsurface-core/gaspressures.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/subsurface-core/gaspressures.c b/subsurface-core/gaspressures.c
index 66ec7e3aa..43c0a11cf 100644
--- a/subsurface-core/gaspressures.c
+++ b/subsurface-core/gaspressures.c
@@ -171,7 +171,7 @@ void dump_pr_interpolate(int i, pr_interpolate_t interpolate_pr)
#endif
-static struct pr_interpolate_struct get_pr_interpolate_data(pr_track_t *segment, struct plot_info *pi, int cur, int pressure)
+static struct pr_interpolate_struct get_pr_interpolate_data(pr_track_t *segment, struct plot_info *pi, int cur)
{ // cur = index to pi->entry corresponding to t_end of segment;
struct pr_interpolate_struct interpolate;
int i;
@@ -194,19 +194,11 @@ static struct pr_interpolate_struct get_pr_interpolate_data(pr_track_t *segment,
if (entry->sec == segment->t_start) {
interpolate.acc_pressure_time = 0;
interpolate.pressure_time = 0;
- if (pressure)
- interpolate.start = pressure;
continue;
}
if (i < cur) {
- if (pressure) {
- interpolate.start = pressure;
- interpolate.acc_pressure_time = 0;
- interpolate.pressure_time = 0;
- } else {
- interpolate.acc_pressure_time += entry->pressure_time;
- interpolate.pressure_time += entry->pressure_time;
- }
+ interpolate.acc_pressure_time += entry->pressure_time;
+ interpolate.pressure_time += entry->pressure_time;
continue;
}
if (i == cur) {
@@ -215,10 +207,6 @@ static struct pr_interpolate_struct get_pr_interpolate_data(pr_track_t *segment,
continue;
}
interpolate.pressure_time += entry->pressure_time;
- if (pressure) {
- interpolate.end = pressure;
- break;
- }
}
return interpolate;
}
@@ -299,7 +287,7 @@ static void fill_missing_tank_pressures(struct dive *dive, struct plot_info *pi,
}
// If there is a valid segment but no tank pressure ..
- interpolate = get_pr_interpolate_data(segment, pi, i, pressure); // Set up an interpolation structure
+ interpolate = get_pr_interpolate_data(segment, pi, i); // Set up an interpolation structure
if(dive->cylinder[cyl].cylinder_use == OC_GAS) {
/* if this segment has pressure_time, then calculate a new interpolated pressure */