mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Core: dynamically allocate the result of get_gas_used()
get_gas_used() returns the volume of used gases. Currently, an array with MAX_CYLINDERS is passed in. If we want to make the number of cylinders dynamic, the function must use an arbitrarilly sized array. Therefore, return a dynamically allocated array and free it in the caller. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
f179ec033f
commit
11467fa326
5 changed files with 16 additions and 10 deletions
|
@ -53,8 +53,7 @@ void TabDiveInformation::updateProfile()
|
|||
ui->maximumDepthText->setText(get_depth_string(current_dive->maxdepth, true));
|
||||
ui->averageDepthText->setText(get_depth_string(current_dive->meandepth, true));
|
||||
|
||||
volume_t gases[MAX_CYLINDERS] = {};
|
||||
get_gas_used(current_dive, gases);
|
||||
volume_t *gases = get_gas_used(current_dive);
|
||||
QString volumes;
|
||||
int mean[MAX_CYLINDERS], duration[MAX_CYLINDERS];
|
||||
per_cylinder_mean_depth(current_dive, select_dc(current_dive), mean, duration);
|
||||
|
@ -76,6 +75,7 @@ void TabDiveInformation::updateProfile()
|
|||
SACs.append(get_volume_string(sac, true).append(tr("/min")));
|
||||
}
|
||||
}
|
||||
free(gases);
|
||||
ui->gasUsedText->setText(volumes);
|
||||
ui->oxygenHeliumText->setText(gaslist);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue