diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-10-25 09:14:16 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-10-25 13:59:52 -0700 |
commit | 8212acc9925b28ecd546b01047c6a8fc574326ef (patch) | |
tree | f4ce765228f3bb2511a186373eb2b3394b647709 /core/profile.c | |
parent | d82a7b8b73c13451f469832d6402303ccf2ee3d3 (diff) | |
download | subsurface-8212acc9925b28ecd546b01047c6a8fc574326ef.tar.gz |
cleanup: break out event-related code into event.[c|h]
In an effort to reduce the size of dive.h and dive.c, break out
the event related functions. Moreover event-names were handled
by the profile-code, collect that also in the new source files.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/profile.c')
-rw-r--r-- | core/profile.c | 38 |
1 files changed, 2 insertions, 36 deletions
diff --git a/core/profile.c b/core/profile.c index 1cc73f158..0e7db76d2 100644 --- a/core/profile.c +++ b/core/profile.c @@ -9,9 +9,10 @@ #include <assert.h> #include "dive.h" -#include "subsurface-string.h" #include "display.h" #include "divelist.h" +#include "event.h" +#include "subsurface-string.h" #include "profile.h" #include "gaspressures.h" @@ -115,41 +116,6 @@ int get_maxdepth(const struct plot_info *pi) return md; } -/* collect all event names and whether we display them */ -struct ev_select *ev_namelist; -int evn_allocated; -int evn_used; - -void clear_events(void) -{ - for (int i = 0; i < evn_used; i++) - free(ev_namelist[i].ev_name); - evn_used = 0; -} - -void remember_event(const char *eventname) -{ - int i = 0, len; - - if (!eventname || (len = strlen(eventname)) == 0) - return; - while (i < evn_used) { - if (!strncmp(eventname, ev_namelist[i].ev_name, len)) - return; - i++; - } - if (evn_used == evn_allocated) { - evn_allocated += 10; - ev_namelist = realloc(ev_namelist, evn_allocated * sizeof(struct ev_select)); - if (!ev_namelist) - /* we are screwed, but let's just bail out */ - return; - } - ev_namelist[evn_used].ev_name = strdup(eventname); - ev_namelist[evn_used].plot_ev = true; - evn_used++; -} - /* UNUSED! */ static int get_local_sac(struct plot_info *pi, int idx1, int idx2, struct dive *dive) __attribute__((unused)); |