Cleanup: return cylinder from cylinder_start() in parser

Most callers of this function accessed the newly generated cylinder
immediately after calling this function. Thus, for convenience,
return the added cylinder. This avoids a number of verbose expressions.

On the flip side, cylinder_start() now has to be cast to
function returning void in a the "nesting" function table.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-08-04 18:59:14 +02:00 committed by Dirk Hohndel
parent 7c9f46acd2
commit 8df3705152
7 changed files with 15 additions and 20 deletions

View file

@ -287,9 +287,10 @@ void picture_end(struct parser_state *state)
state->cur_picture = NULL;
}
void cylinder_start(struct parser_state *state)
cylinder_t *cylinder_start(struct parser_state *state)
{
add_empty_cylinder(&state->cur_dive->cylinders);
return &state->cur_dive->cylinders.cylinders[state->cur_dive->cylinders.nr - 1];
}
void cylinder_end(struct parser_state *state)