Cleanup: unconstify results of two functions

get_dive_date_c_string() and get_current_date() return copied strings.
Make this explicit by returning non-const pointers.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-03-13 22:12:23 +01:00 committed by Lubomir I. Ivanov
parent 44bcc5a307
commit f7b2355ced
5 changed files with 12 additions and 12 deletions

View file

@ -137,15 +137,15 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
dive->notes = strdup(buffer);
goto finished;
} else if (diveplan->surface_interval >= 48 * 60 *60) {
const char *current_date = get_current_date();
char *current_date = get_current_date();
len += snprintf(buffer + len, sz_buffer - len, "<div><b>%s (%s) %s %s</b><br>",
translate("gettextFromC", "Subsurface"),
subsurface_canonical_version(),
translate("gettextFromC", "dive plan</b> created on"),
current_date);
free((void *)current_date);
free(current_date);
} else {
const char *current_date = get_current_date();
char *current_date = get_current_date();
len += snprintf_loc(buffer + len, sz_buffer - len, "<div><b>%s (%s) %s %d:%02d) %s %s<br>",
translate("gettextFromC", "Subsurface"),
subsurface_canonical_version(),
@ -153,7 +153,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
FRACTION(diveplan->surface_interval / 60, 60),
translate("gettextFromC", "created on"),
current_date);
free((void *)current_date);
free(current_date);
}
if (prefs.display_variations && decoMode() != RECREATIONAL)