mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
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:
parent
a0f5a74847
commit
0c8dbc2061
1 changed files with 3 additions and 7 deletions
10
parse-xml.c
10
parse-xml.c
|
@ -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 */
|
||||
|
|
Loading…
Add table
Reference in a new issue