mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: turn struct dive string data into std::string
Much easier memory management! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
2b3d2f1020
commit
3cb04d230b
34 changed files with 208 additions and 313 deletions
|
@ -126,8 +126,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
|
|||
translate("gettextFromC", "Warning:"),
|
||||
translate("gettextFromC", "Decompression calculation aborted due to excessive time"));
|
||||
// TODO: avoid copy
|
||||
free(dive->notes);
|
||||
dive->notes = strdup(buf.c_str());
|
||||
dive->notes = buf;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -144,8 +143,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
|
|||
subsurface_canonical_version(),
|
||||
translate("gettextFromC", "dive plan</b> (overlapping dives detected)"));
|
||||
// TODO: avoid copy
|
||||
free(dive->notes);
|
||||
dive->notes = strdup(buf.c_str());
|
||||
dive->notes = buf;
|
||||
return;
|
||||
} else if (diveplan->surface_interval >= 48 * 60 *60) {
|
||||
buf += format_string_std("%s (%s) %s %s",
|
||||
|
@ -613,8 +611,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
|
|||
buf += "</div>\n";
|
||||
}
|
||||
// TODO: avoid copy
|
||||
free(dive->notes);
|
||||
dive->notes = strdup(buf.c_str());
|
||||
dive->notes = buf;
|
||||
#ifdef DEBUG_PLANNER_NOTES
|
||||
printf("<!DOCTYPE html>\n<html>\n\t<head><title>plannernotes</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head>\n\t<body>\n%s\t</body>\n</html>\n", dive->notes);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue