From 260f751a42997e9d72a18fccf4b4ea70c55ea2a6 Mon Sep 17 00:00:00 2001 From: BALATON Zoltan Date: Thu, 13 Jul 2017 02:00:24 +0200 Subject: activation: Simplify plist_strip_xml() by removing some unnecessary operations --- src/activation.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/activation.c b/src/activation.c index 72e6ee7..0a56dc7 100644 --- a/src/activation.c +++ b/src/activation.c @@ -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; @@ -622,16 +620,15 @@ static int plist_strip_xml(char** xmlplist) return -1; start += strlen("\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; } -- cgit v1.1-32-gdbae