mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
3ee41328f9
commit
1cebafb08f
2 changed files with 1 additions and 22 deletions
|
@ -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))
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue