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
e171cdf1eb
commit
99f87cba4b
@ -407,28 +407,8 @@ void userid_stop(struct parser_state *state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy whitespace-trimmed string. Warning: the passed in string will be freed,
|
* Copy whitespace-trimmed string.
|
||||||
* therefore make sure to only pass in to NULL-initialized pointers or pointers
|
|
||||||
* to owned strings
|
|
||||||
*/
|
*/
|
||||||
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)
|
void utf8_string_std(const char *buffer, std::string *res)
|
||||||
{
|
{
|
||||||
while (isspace(*buffer))
|
while (isspace(*buffer))
|
||||||
|
|||||||
@ -140,7 +140,6 @@ int trimspace(char *buffer);
|
|||||||
void start_match(const char *type, const char *name, char *buffer);
|
void start_match(const char *type, const char *name, char *buffer);
|
||||||
void nonmatch(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);
|
int atoi_n(char *ptr, unsigned int len);
|
||||||
void utf8_string(const char *buffer, char **res);
|
|
||||||
|
|
||||||
void parse_xml_init();
|
void parse_xml_init();
|
||||||
int parse_xml_buffer(const char *url, const char *buf, int size, struct divelog *log, const struct xml_params *params);
|
int parse_xml_buffer(const char *url, const char *buf, int size, struct divelog *log, const struct xml_params *params);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user