diff --git a/core/parse.cpp b/core/parse.cpp index ec866b371..2baa37b8d 100644 --- a/core/parse.cpp +++ b/core/parse.cpp @@ -407,28 +407,8 @@ void userid_stop(struct parser_state *state) } /* - * Copy whitespace-trimmed string. Warning: the passed in string will be freed, - * therefore make sure to only pass in to NULL-initialized pointers or pointers - * to owned strings + * Copy whitespace-trimmed string. */ -void utf8_string(const char *buffer, char **res) -{ - free(*res); - while (isspace(*buffer)) - ++buffer; - if (!*buffer) { - *res = strdup(""); - return; - } - const char *end = buffer + strlen(buffer); - while (isspace(end[-1])) - --end; - size_t len = end - buffer; - *res = (char *)malloc(len + 1); - memcpy(*res, buffer, len); - (*res)[len] = '\0'; -} - void utf8_string_std(const char *buffer, std::string *res) { while (isspace(*buffer)) diff --git a/core/parse.h b/core/parse.h index 3b73525fb..1412b0714 100644 --- a/core/parse.h +++ b/core/parse.h @@ -140,7 +140,6 @@ int trimspace(char *buffer); void start_match(const char *type, const char *name, char *buffer); void nonmatch(const char *type, const char *name, char *buffer); int atoi_n(char *ptr, unsigned int len); -void utf8_string(const char *buffer, char **res); void parse_xml_init(); int parse_xml_buffer(const char *url, const char *buf, int size, struct divelog *log, const struct xml_params *params);