mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cleanup: pass gasmix by value
In a previous commit, the get_gasmix_* functions were changed to return by value. For consistency, also pass gasmix by value. Note that on common 64-bit platforms struct gasmix is the size of a pointer [2 * 32 bit vs. 64 bit] and therefore uses the same space on the stack. On 32-bit platforms, the stack use is probably doubled, but in return a dereference is avoided. Supporting arbitrary gas-mixes (H2, Ar, ...) will be such an invasive change that going back to pointers is probably the least of our worries. This commit is a step in const-ifying input parameters (passing by value is the ultimate way of signaling that the input parameter will not be changed [unless there are references to said parameter]). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
5c4569247a
commit
360f07e453
28 changed files with 214 additions and 215 deletions
|
@ -58,8 +58,8 @@ void setupPlan(struct diveplan *dp)
|
|||
free_dps(dp);
|
||||
|
||||
int droptime = M_OR_FT(79, 260) * 60 / M_OR_FT(23, 75);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean36, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(ean36, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(oxygen, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, droptime, M_OR_FT(79, 260), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 30 * 60 - droptime, M_OR_FT(79, 260), 0, 0, 1, OC);
|
||||
}
|
||||
|
@ -86,8 +86,8 @@ void setupPlanVpmb45m30mTx(struct diveplan *dp)
|
|||
free_dps(dp);
|
||||
|
||||
int droptime = M_OR_FT(45, 150) * 60 / M_OR_FT(23, 75);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(ean50, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(oxygen, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, droptime, M_OR_FT(45, 150), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 30 * 60 - droptime, M_OR_FT(45, 150), 0, 0, 1, OC);
|
||||
}
|
||||
|
@ -114,8 +114,8 @@ void setupPlanVpmb60m10mTx(struct diveplan *dp)
|
|||
free_dps(dp);
|
||||
|
||||
int droptime = M_OR_FT(60, 200) * 60 / M_OR_FT(23, 75);
|
||||
plan_add_segment(dp, 0, gas_mod(&tx50_15, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(tx50_15, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(oxygen, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 10 * 60 - droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ void setupPlanVpmb60m30minEan50(struct diveplan *dp)
|
|||
free_dps(dp);
|
||||
|
||||
int droptime = M_OR_FT(60, 200) * 60 / M_OR_FT(99, 330);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(ean50, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 30 * 60 - droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ void setupPlanVpmb60m30minTx(struct diveplan *dp)
|
|||
free_dps(dp);
|
||||
|
||||
int droptime = M_OR_FT(60, 200) * 60 / M_OR_FT(99, 330);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(ean50, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 30 * 60 - droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||
}
|
||||
|
@ -231,8 +231,8 @@ void setupPlanVpmb100m60min(struct diveplan *dp)
|
|||
free_dps(dp);
|
||||
|
||||
int droptime = M_OR_FT(100, 330) * 60 / M_OR_FT(99, 330);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(ean50, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(oxygen, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 60 * 60 - droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
|
||||
}
|
||||
|
@ -258,8 +258,8 @@ void setupPlanVpmb100m10min(struct diveplan *dp)
|
|||
free_dps(dp);
|
||||
|
||||
int droptime = M_OR_FT(100, 330) * 60 / M_OR_FT(99, 330);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(ean50, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(oxygen, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 10 * 60 - droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
|
||||
}
|
||||
|
@ -307,9 +307,9 @@ void setupPlanVpmb100mTo70m30min(struct diveplan *dp)
|
|||
free_dps(dp);
|
||||
|
||||
int droptime = M_OR_FT(100, 330) * 60 / M_OR_FT(18, 60);
|
||||
plan_add_segment(dp, 0, gas_mod(&tx21_35, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 3, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(tx21_35, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 1, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(ean50, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 2, 0, 1, OC);
|
||||
plan_add_segment(dp, 0, gas_mod(oxygen, po2, &displayed_dive, M_OR_FT(3, 10)).mm, 3, 0, 1, OC);
|
||||
plan_add_segment(dp, droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 20 * 60 - droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
|
||||
plan_add_segment(dp, 3 * 60, M_OR_FT(70, 230), 0, 0, 1, OC);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue