Simplify code

Since trimspace() null terminates the string, we can simply use strdup()
here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-06-11 19:02:20 -07:00
parent a0f5a74847
commit 0c8dbc2061

View file

@ -505,15 +505,11 @@ int trimspace(char *buffer) {
static void utf8_string(char *buffer, void *_res)
{
char *res;
char **res = _res;
int size;
size = trimspace(buffer);
if(size) {
res = malloc(size + 1);
memcpy(res, buffer, size);
res[size] = 0;
*(char **)_res = res;
}
if(size)
*res = strdup(buffer);
}
/* Extract the dive computer type from the xml text buffer */