mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: default initialize units-type objects to 0
Makes the code much nicer to read. Default initialize cylinder_t to the empty cylinder. This produces lots of warnings, because most structure are now not PODs anymore and shouldn't be erased using memset(). These memset()s will be removed one-by-one and replaced by proper constructors. The whole ordeal made it necessary to add a constructor to struct event. To simplify things the whole optimization of the variable-size event names was removed. In upcoming commits this will be replaced by std::string anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
b82fdd1d20
commit
408b31b6ce
34 changed files with 128 additions and 148 deletions
|
@ -205,7 +205,7 @@ void add_cylinder(struct cylinder_table *t, int idx, cylinder_t cyl)
|
|||
* every single cylinder table there is an empty cylinder that can
|
||||
* be used by the planner as "surface air" cylinder. Fix this.
|
||||
*/
|
||||
add_to_cylinder_table(t, t->nr, empty_cylinder);
|
||||
add_to_cylinder_table(t, t->nr, cylinder_t());
|
||||
t->nr--;
|
||||
t->cylinders[t->nr].cylinder_use = NOT_USED;
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ void copy_cylinder_types(const struct dive *s, struct dive *d)
|
|||
|
||||
cylinder_t *add_empty_cylinder(struct cylinder_table *t)
|
||||
{
|
||||
cylinder_t cyl = empty_cylinder;
|
||||
cylinder_t cyl;
|
||||
cyl.type.description = strdup("");
|
||||
add_cylinder(t, t->nr, cyl);
|
||||
return &t->cylinders[t->nr - 1];
|
||||
|
@ -483,7 +483,7 @@ void fill_default_cylinder(const struct dive *dive, cylinder_t *cyl)
|
|||
|
||||
cylinder_t create_new_cylinder(const struct dive *d)
|
||||
{
|
||||
cylinder_t cyl = empty_cylinder;
|
||||
cylinder_t cyl;
|
||||
fill_default_cylinder(d, &cyl);
|
||||
cyl.start = cyl.type.workingpressure;
|
||||
cyl.cylinder_use = OC_GAS;
|
||||
|
@ -507,7 +507,6 @@ void add_default_cylinder(struct dive *d)
|
|||
if (!empty_string(prefs.default_cylinder)) {
|
||||
cyl = create_new_cylinder(d);
|
||||
} else {
|
||||
cyl = empty_cylinder;
|
||||
// roughly an AL80
|
||||
cyl.type.description = strdup(translate("gettextFromC", "unknown"));
|
||||
cyl.type.size.mliter = 11100;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue