summaryrefslogtreecommitdiffstats
path: root/core/dive.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-08-04 19:17:11 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-11-09 19:19:04 +0100
commitc26e922802826dc9e2f044312cc33d5a037f6a10 (patch)
treea1fc9c98acd90261b1d3bca46932d438d7fd7f7e /core/dive.c
parent8df3705152aa32d8551b5fb7db08e0c8e442b480 (diff)
downloadsubsurface-c26e922802826dc9e2f044312cc33d5a037f6a10.tar.gz
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>
Diffstat (limited to 'core/dive.c')
-rw-r--r--core/dive.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/core/dive.c b/core/dive.c
index 0b68819fa..24fa8780d 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -2126,9 +2126,7 @@ static int match_cylinder(const cylinder_t *cyl, const struct dive *dive, const
*/
static void merge_one_cylinder(struct cylinder_table *t, const cylinder_t *a, const cylinder_t *b)
{
- cylinder_t *res;
- add_empty_cylinder(t);
- res = t->cylinders + (t->nr - 1);
+ cylinder_t *res = add_empty_cylinder(t);
res->type.size.mliter = a->type.size.mliter ?
a->type.size.mliter : b->type.size.mliter;
res->type.workingpressure.mbar = a->type.workingpressure.mbar ?