Skip to content

Commit

Permalink
activation: Simplify plist_strip_xml() by removing some unnecessary o…
Browse files Browse the repository at this point in the history
…perations
  • Loading branch information
zbalaton committed Jul 14, 2017
1 parent 260eec0 commit 260f751
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/activation.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,6 @@ static char* urlencode(const char* buf)

static int plist_strip_xml(char** xmlplist)
{
uint32_t size = 0;

if (!xmlplist || !*xmlplist)
return -1;

Expand All @@ -622,16 +620,15 @@ static int plist_strip_xml(char** xmlplist)
return -1;

start += strlen("<plist version=\"1.0\">\n");
size = stop - start;
uint32_t size = stop - start;
char* stripped = malloc(size + 1);
if (!stripped)
return -1;

memset(stripped, '\0', size + 1);
memcpy(stripped, start, size);
stripped[size] = '\0';
free(*xmlplist);
*xmlplist = stripped;
stripped = NULL;

return 0;
}
Expand Down

0 comments on commit 260f751

Please sign in to comment.