core: remove utf8_string() function

That was used to parse C-style strings. It was fully replaced
the the std::string version utf8_string_std().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-05-31 17:23:29 +02:00 committed by bstoeger
parent 3ee41328f9
commit 1cebafb08f
2 changed files with 1 additions and 22 deletions

View file

@ -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))

View file

@ -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);