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

@ -754,7 +754,7 @@ static void parse_dc_meandepth(char *line, struct git_parser_state *state)
{ state->active_dc->meandepth = get_depth(line); }
static void parse_dc_model(char *, struct git_parser_state *state)
{ state->active_dc->model = get_first_converted_string_c(state); }
{ state->active_dc->model = get_first_converted_string(state); }
static void parse_dc_numberofoxygensensors(char *line, struct git_parser_state *state)
{ state->active_dc->no_o2sensors = get_index(line); }
@ -1649,7 +1649,7 @@ static struct divecomputer *create_new_dc(struct dive *dive)
while (dc->next)
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;
dc->next = newdc;
dc = newdc;