Cleanup: call calculate_max_limits_new() in create_plot_info_new()

All callers of create_plot_info_new() called calculate_max_limits_new()
a line before. Thus, simply call the latter in the former.

This allows us to automatically free the plot data in create_plot_info_new().
The old code overwrote the corresponding field with NULL.

As a side-effect, this removes a bogus static variable.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-07-06 15:34:31 +02:00 committed by Dirk Hohndel
parent 69be1e23f2
commit ae60fdf815
4 changed files with 12 additions and 17 deletions

View file

@ -202,7 +202,6 @@ static void save_profiles_buffer(struct membuffer *b, bool select_only)
for_each_dive(i, dive) {
if (select_only && !dive->selected)
continue;
pi = calculate_max_limits_new(dive, &dive->dc);
create_plot_info_new(dive, &dive->dc, &pi, false, planner_deco_state);
put_headers(b);
put_format(b, "\n");
@ -221,7 +220,6 @@ void save_subtitles_buffer(struct membuffer *b, struct dive *dive, int offset, i
struct plot_info pi;
struct deco_state *planner_deco_state = NULL;
pi = calculate_max_limits_new(dive, &dive->dc);
create_plot_info_new(dive, &dive->dc, &pi, false, planner_deco_state);
put_format(b, "[Script Info]\n");