profile: redo eventname handling

The eventname handling code was splattered all over the place.
Collect it in a single source file and use C++ idioms to avoid
nasty memory management. Provide a C-only interface, however.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2023-02-12 15:51:39 +01:00 committed by Dirk Hohndel
parent ab7b9329c0
commit 0d3c9954f4
10 changed files with 94 additions and 70 deletions

View file

@ -39,15 +39,6 @@ struct event {
char name[];
};
struct ev_select {
char *ev_name;
bool plot_ev;
};
/* collect all event names and whether we display them */
extern struct ev_select *ev_namelist;
extern int evn_used;
extern int event_is_gaschange(const struct event *ev);
extern bool event_is_divemodechange(const struct event *ev);
extern struct event *clone_event(const struct event *src_ev);
@ -55,8 +46,6 @@ extern void free_events(struct event *ev);
extern struct event *create_event(unsigned int time, int type, int flags, int value, const char *name);
extern struct event *clone_event_rename(const struct event *ev, const char *name);
extern bool same_event(const struct event *a, const struct event *b);
extern void remember_event(const char *eventname);
extern void clear_events(void);
/* Since C doesn't have parameter-based overloading, two versions of get_next_event. */
extern const struct event *get_next_event(const struct event *event, const char *name);