Cleanup: move parse_location() declaration into header file

The parse_location() function was used in three places. In two
of them, the declaration was in the translation unit. Instead,
move the declaration into a header file, to avoid duplication
and the possibility of inconsistencies.

The "units.h" header was chosen as this is where location_t
is defined.

Moreover, make the string argument to parse_location() "const
char *", so that it can be used on non-owned buffers.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-04-16 21:40:03 +02:00 committed by Dirk Hohndel
parent ae6f17af0c
commit 6586ba5579
4 changed files with 7 additions and 8 deletions

View file

@ -570,8 +570,6 @@ static void set_dc_serial(struct divecomputer *dc, const char *serial)
dc->deviceid = calculate_string_hash(serial);
}
extern void parse_location(char *, location_t *);
static void parse_string_field(device_data_t *devdata, struct dive *dive, dc_field_string_t *str)
{
// Our dive ID is the string hash of the "Dive ID" string