core: add device_table parameter to device table functions

Instead of accessing the global device table directly, add a parameter
to all device-table accessing functions. This makes all places in
the code that access the global device table grep-able, which is
necessary to include the device-table code in the undo system.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-10-10 21:41:36 +02:00 committed by Dirk Hohndel
parent 7b06349be5
commit 8549f24c91
9 changed files with 31 additions and 29 deletions

View file

@ -712,7 +712,7 @@ static void parse_dc_date(char *line, struct membuffer *str, struct git_parser_s
{ UNUSED(str); update_date(&state->active_dc->when, line); }
static void parse_dc_deviceid(char *line, struct membuffer *str, struct git_parser_state *state)
{ UNUSED(str); set_dc_deviceid(state->active_dc, get_hex(line)); }
{ UNUSED(str); set_dc_deviceid(state->active_dc, get_hex(line), &device_table); }
static void parse_dc_diveid(char *line, struct membuffer *str, struct git_parser_state *state)
{ UNUSED(str); state->active_dc->diveid = get_hex(line); }
@ -1000,7 +1000,7 @@ static void parse_settings_divecomputerid(char *line, struct membuffer *str, str
break;
line = parse_keyvalue_entry(parse_divecomputerid_keyvalue, &id, line, str);
}
create_device_node(id.model, id.deviceid, id.serial, id.firmware, id.nickname);
create_device_node(&device_table, id.model, id.deviceid, id.serial, id.firmware, id.nickname);
}
static void parse_picture_filename(char *line, struct membuffer *str, struct git_parser_state *state)