core: turn string data in struct divecomputer into std::string

Simplifies memory management.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-05-18 17:03:19 +02:00 committed by bstoeger
parent cc39f709ce
commit b9a2eff3c9
28 changed files with 114 additions and 147 deletions

View file

@ -178,9 +178,9 @@ void dc_settings_start(struct parser_state *state)
void dc_settings_end(struct parser_state *state)
{
create_device_node(state->log->devices.get(),
state->cur_settings.dc.model.c_str(),
state->cur_settings.dc.serial_nr.c_str(),
state->cur_settings.dc.nickname.c_str());
state->cur_settings.dc.model,
state->cur_settings.dc.serial_nr,
state->cur_settings.dc.nickname);
reset_dc_settings(state);
}
@ -392,7 +392,7 @@ void divecomputer_start(struct parser_state *state)
dc = dc->next;
/* Did we already fill that in? */
if (dc->samples || dc->model || dc->when) {
if (dc->samples || !dc->model.empty() || dc->when) {
struct divecomputer *newdc = new divecomputer;
if (newdc) {
dc->next = newdc;