Cleanup: return cylinder from add_empty_cylinder()

As a convenience, return the cylinder from add_empty_cylinder()
to spare the caller from the nasty expression to fetch the
last cylinder.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-08-04 19:17:11 +02:00 committed by Dirk Hohndel
parent 8df3705152
commit c26e922802
4 changed files with 5 additions and 7 deletions

View file

@ -314,11 +314,12 @@ void copy_cylinder_types(const struct dive *s, struct dive *d)
add_cloned_cylinder(&d->cylinders, s->cylinders.cylinders[i]);
}
void add_empty_cylinder(struct cylinder_table *t)
cylinder_t *add_empty_cylinder(struct cylinder_table *t)
{
cylinder_t cyl = { 0 };
cyl.type.description = strdup("");
add_to_cylinder_table(t, t->nr, cyl);
return &t->cylinders[t->nr - 1];
}
/* access to cylinders is controlled by two functions: