From 14c37ba7337da108f23dd8cba98c2a9d52bd4099 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 15 Jun 2020 23:13:29 +0200 Subject: cleanup: remove indirection when passing arguments to parser functions For unknown reasons, the dive site and trip to be parsed into were passed as pointers to pointers. A simple pointer seems to be enough, since the object is not allocated by the function. Signed-off-by: Berthold Stoeger --- core/parse-xml.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'core') diff --git a/core/parse-xml.c b/core/parse-xml.c index 4aad15bb5..0d52eb733 100644 --- a/core/parse-xml.c +++ b/core/parse-xml.c @@ -1364,12 +1364,10 @@ static void try_to_fill_dive(struct dive *dive, const char *name, char *buf, str } /* We're in the top-level trip xml. Try to convert whatever value to a trip value */ -static void try_to_fill_trip(dive_trip_t **dive_trip_p, const char *name, char *buf, struct parser_state *state) +static void try_to_fill_trip(dive_trip_t *dive_trip, const char *name, char *buf, struct parser_state *state) { start_match("trip", name, buf); - dive_trip_t *dive_trip = *dive_trip_p; - if (MATCH("location", utf8_string, &dive_trip->location)) return; if (MATCH("notes", utf8_string, &dive_trip->notes)) @@ -1379,11 +1377,10 @@ static void try_to_fill_trip(dive_trip_t **dive_trip_p, const char *name, char * } /* We're processing a divesite entry - try to fill the components */ -static void try_to_fill_dive_site(struct dive_site **ds_p, const char *name, char *buf) +static void try_to_fill_dive_site(struct dive_site *ds, const char *name, char *buf) { start_match("divesite", name, buf); - struct dive_site *ds = *ds_p; if (ds->taxonomy.category == NULL) ds->taxonomy.category = alloc_taxonomy(); @@ -1426,7 +1423,7 @@ static bool entry(const char *name, char *buf, struct parser_state *state) return true; } if (state->cur_dive_site) { - try_to_fill_dive_site(&state->cur_dive_site, name, buf); + try_to_fill_dive_site(state->cur_dive_site, name, buf); return true; } if (!state->cur_event.deleted) { @@ -1446,7 +1443,7 @@ static bool entry(const char *name, char *buf, struct parser_state *state) return true; } if (state->cur_trip) { - try_to_fill_trip(&state->cur_trip, name, buf, state); + try_to_fill_trip(state->cur_trip, name, buf, state); return true; } return true; -- cgit v1.2.3-70-g09d2