Commit graph

8 commits

Author SHA1 Message Date
Berthold Stoeger
7e33369dc8 Parser: add trip_table parameter to parsing functions
To allow parsing into arbitrary trip_tables, add the corresponding
parameter to the parsing functions and the parser state. Currently,
all callers pass the global trip_table so there should be no change
in functionality. These arguments will be replaced in subsequent commits.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-09 20:58:04 -08:00
Berthold Stoeger
724055f0af Dive site: replace dive->dive_site_uuid by dive_site
Replace the UUID reference of struct dive by a pointer to dive_site.
This commit is rather large in lines, but nevertheless quite simple
since most of the UUID->pointer work was done in previous commits.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-29 00:09:31 +00:00
Berthold Stoeger
d3a7c5448f Dive site: return pointer to dive_site in create_dive_site_*()
This changes more of the dive-site interface to return pointers
instead of UUIDs. Currently, most call sites directly extract
UUIDs afterwards. Ultimately, the UUIDs will be generally replaced
by pointers, which will then simplify these callers.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-29 00:09:31 +00:00
Berthold Stoeger
954553b878 Parser: remove static variable location in import-cobalt.c
A static variable was used to collect two parts of the location
string. Instead, explicitly store these two parts in two different
strings and concetenate them. One fewer variable and the program
flow is thus hopefully more clear.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-23 08:06:28 +01:00
Berthold Stoeger
138f27f65d Parser: make parser (mostly) reentrant
Introduce a parser_state structure, which describes (most) of the
global parser state. Create such a structure in the entry routines
to the parser and pass it down to the individual functions. The
parser state is initialized and freed with the init_parser_state()
and free_parser_state() functions.

The main benefits are:
1) Isolation of parser state.
2) Keeping the global name space tidy.
3) Prevent memory leaks which could happen in truncated files by
   freeing all the parser state after parse.

A somewhat controversial point might be that the individual
parsing functions are split in those that need parser-state and
those that don't. This means that there are now two versions of
the MATCH macro, viz. one for the former and one for the latter.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-23 08:06:17 +01:00
jan Iversen
061be82e31 core: replace (void) with UNUSED(x) and include ssrf.h
Unused parameters in C are "silenced" by adding UNUSED(x)

Signed-off-by: Jan Iversen <jani@apache.org>
2018-05-24 08:34:14 -07:00
Dirk Hohndel
d577467f97 Core: introduce new subsurface-string header
First small step to shrinking dive.h.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-14 10:13:39 -07:00
Miika Turkia
c2342304db Move Cobalt DB import to its own file
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-11-29 01:22:17 +01:00