summaryrefslogtreecommitdiffstats
path: root/core/gaspressures.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-07-06 12:35:33 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-11-09 19:19:04 +0100
commitfe6d3c8c3803378fa9369dd6dfb5ec2fa5a0086f (patch)
tree7e00ddc114dd736eee8fd8267c4d7b915c089de7 /core/gaspressures.c
parent459f9acc67df74df206c313389e43d1bf5b80086 (diff)
downloadsubsurface-fe6d3c8c3803378fa9369dd6dfb5ec2fa5a0086f.tar.gz
Profile: switch pressure-accessing functions to indexes
Continue with replacing pointers to struct plot_data entries by indexes. Thus the pressure data can be kept in its own array and can by dynamically sized. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/gaspressures.c')
-rw-r--r--core/gaspressures.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/core/gaspressures.c b/core/gaspressures.c
index bb55ecb88..880c4dbdb 100644
--- a/core/gaspressures.c
+++ b/core/gaspressures.c
@@ -350,10 +350,8 @@ static inline int calc_pressure_time(struct dive *dive, struct plot_data *a, str
static void debug_print_pressures(struct plot_info *pi)
{
int i;
- for (i = 0; i < pi->nr; i++) {
- struct plot_data *entry = pi->entry + i;
- printf("%5d |%9d | %9d |\n", i, get_plot_sensor_pressure(entry), get_plot_interpolated_pressure(entry));
- }
+ for (i = 0; i < pi->nr; i++)
+ printf("%5d |%9d | %9d |\n", i, get_plot_sensor_pressure(pi, i), get_plot_interpolated_pressure(pi, i));
}
#endif
@@ -386,8 +384,7 @@ void populate_pressure_information(struct dive *dive, struct divecomputer *dc, s
/* Get a rough range of where we have any pressures at all */
first = last = -1;
for (int i = 0; i < pi->nr; i++) {
- struct plot_data *entry = pi->entry + i;
- int pressure = get_plot_sensor_pressure(entry, sensor);
+ int pressure = get_plot_sensor_pressure(pi, i, sensor);
if (!pressure)
continue;
@@ -416,7 +413,7 @@ void populate_pressure_information(struct dive *dive, struct divecomputer *dc, s
for (int i = first; i <= last; i++) {
struct plot_data *entry = pi->entry + i;
- int pressure = get_plot_sensor_pressure(entry, sensor);
+ int pressure = get_plot_sensor_pressure(pi, i, sensor);
int time = entry->sec;
while (ev && ev->time.seconds <= time) { // Find 1st gaschange event after