mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
459f9acc67
commit
fe6d3c8c38
4 changed files with 33 additions and 37 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue