summaryrefslogtreecommitdiffstats
path: root/core/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-10-17 20:15:23 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-10-23 18:17:02 -0700
commitd508a16aca91b521719d929cd59db381c44cd7ad (patch)
treeaf076eb66fcd4002a01a29a46f8b80d4d4129994 /core/parse-xml.c
parentb9b51ffd4ebd14e085bef69ee0daf6a1927cc960 (diff)
downloadsubsurface-d508a16aca91b521719d929cd59db381c44cd7ad.tar.gz
parser: replace params[] code by new xml_params struct
This fixes a load of memory holes, and makes the code (hopefully) more readable. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/parse-xml.c')
-rw-r--r--core/parse-xml.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/core/parse-xml.c b/core/parse-xml.c
index d3dda0c43..d5bbf7ae0 100644
--- a/core/parse-xml.c
+++ b/core/parse-xml.c
@@ -32,11 +32,12 @@
#include "picture.h"
#include "qthelper.h"
#include "tag.h"
+#include "xmlparams.h"
int quit, force_root;
int last_xml_version = -1;
-static xmlDoc *test_xslt_transforms(xmlDoc *doc, const char **params);
+static xmlDoc *test_xslt_transforms(xmlDoc *doc, const struct xml_params *params);
const struct units SI_units = SI_UNITS;
const struct units IMPERIAL_units = IMPERIAL_UNITS;
@@ -1721,7 +1722,7 @@ static const char *preprocess_divelog_de(const char *buffer)
int parse_xml_buffer(const char *url, const char *buffer, int size,
struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites,
- struct filter_preset_table *filter_presets, const char **params)
+ struct filter_preset_table *filter_presets, const struct xml_params *params)
{
UNUSED(size);
xmlDoc *doc;
@@ -2308,7 +2309,7 @@ static struct xslt_files {
{ NULL, }
};
-static xmlDoc *test_xslt_transforms(xmlDoc *doc, const char **params)
+static xmlDoc *test_xslt_transforms(xmlDoc *doc, const struct xml_params *params)
{
struct xslt_files *info = xslt_files;
xmlDoc *transformed;
@@ -2341,7 +2342,7 @@ static xmlDoc *test_xslt_transforms(xmlDoc *doc, const char **params)
report_error(translate("gettextFromC", "Can't open stylesheet %s"), info->file);
return doc;
}
- transformed = xsltApplyStylesheet(xslt, doc, params);
+ transformed = xsltApplyStylesheet(xslt, doc, xml_params_get(params));
xmlFreeDoc(doc);
xsltFreeStylesheet(xslt);