summaryrefslogtreecommitdiffstats
path: root/core/libdivecomputer.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-03-13 22:12:23 +0100
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2018-04-11 14:01:51 +0300
commitf7b2355cedb75a8ed97644c05d57977f993cb08b (patch)
tree418456caa1f16a660002867f346ca3f89b88e8fe /core/libdivecomputer.c
parent44bcc5a30772237e7f0f47d618af345520fb5804 (diff)
downloadsubsurface-f7b2355cedb75a8ed97644c05d57977f993cb08b.tar.gz
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>
Diffstat (limited to 'core/libdivecomputer.c')
-rw-r--r--core/libdivecomputer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c
index be0bb01a5..a666ca667 100644
--- a/core/libdivecomputer.c
+++ b/core/libdivecomputer.c
@@ -618,9 +618,9 @@ static dc_status_t libdc_header_parser(dc_parser_t *parser, device_data_t *devda
}
// Parse the divetime.
- const char *date_string = get_dive_date_c_string(dive->when);
+ char *date_string = get_dive_date_c_string(dive->when);
dev_info(devdata, translate("gettextFromC", "Dive %d: %s"), import_dive_number, date_string);
- free((void *)date_string);
+ free(date_string);
unsigned int divetime = 0;
rc = dc_parser_get_field(parser, DC_FIELD_DIVETIME, 0, &divetime);
@@ -802,9 +802,9 @@ static int dive_cb(const unsigned char *data, unsigned int size,
/* If we already saw this dive, abort. */
if (!devdata->force_download && find_dive(&dive->dc)) {
- const char *date_string = get_dive_date_c_string(dive->when);
+ char *date_string = get_dive_date_c_string(dive->when);
dev_info(devdata, translate("gettextFromC", "Already downloaded dive at %s"), date_string);
- free((void *)date_string);
+ free(date_string);
goto error_exit;
}