diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/profile.c | 11 | ||||
-rw-r--r-- | core/profile.h | 1 | ||||
-rw-r--r-- | core/save-profiledata.c | 2 |
3 files changed, 14 insertions, 0 deletions
diff --git a/core/profile.c b/core/profile.c index c1bcc40fa..ff9575700 100644 --- a/core/profile.c +++ b/core/profile.c @@ -1319,11 +1319,22 @@ static void debug_print_profiledata(struct plot_info *pi) #endif /* + * Initialize a plot_info structure to all-zeroes + */ +void init_plot_info(struct plot_info *pi) +{ + memset(pi, 0, sizeof(*pi)); +} + +/* * Create a plot-info with smoothing and ranged min/max * * This also makes sure that we have extra empty events on both * sides, so that you can do end-points without having to worry * about it. + * + * The old data will be freed. Before the first call, the plot + * info must be initialized with init_plot_info(). */ void create_plot_info_new(struct dive *dive, struct divecomputer *dc, struct plot_info *pi, bool fast, struct deco_state *planner_ds) { diff --git a/core/profile.h b/core/profile.h index 2c4a632d5..580fc8e68 100644 --- a/core/profile.h +++ b/core/profile.h @@ -80,6 +80,7 @@ struct ev_select { extern void compare_samples(struct plot_data *e1, struct plot_data *e2, char *buf, int bufsize, int sum); extern struct plot_info *analyze_plot_info(struct plot_info *pi); +extern void init_plot_info(struct plot_info *pi); extern void create_plot_info_new(struct dive *dive, struct divecomputer *dc, struct plot_info *pi, bool fast, struct deco_state *planner_ds); extern void calculate_deco_information(struct deco_state *ds, const struct deco_state *planner_de, const struct dive *dive, const struct divecomputer *dc, struct plot_info *pi, bool print_mode); extern struct plot_data *get_plot_details_new(struct plot_info *pi, int time, struct membuffer *); diff --git a/core/save-profiledata.c b/core/save-profiledata.c index b2279148e..7802f7cd3 100644 --- a/core/save-profiledata.c +++ b/core/save-profiledata.c @@ -199,6 +199,7 @@ static void save_profiles_buffer(struct membuffer *b, bool select_only) struct plot_info pi; struct deco_state *planner_deco_state = NULL; + init_plot_info(&pi); for_each_dive(i, dive) { if (select_only && !dive->selected) continue; @@ -220,6 +221,7 @@ void save_subtitles_buffer(struct membuffer *b, struct dive *dive, int offset, i struct plot_info pi; struct deco_state *planner_deco_state = NULL; + init_plot_info(&pi); create_plot_info_new(dive, &dive->dc, &pi, false, planner_deco_state); put_format(b, "[Script Info]\n"); |