Merge pull request #1830 from rubenk/move-collectd-header
[collectd.git] / src / ascent.c
index d38e859..504decc 100644 (file)
@@ -25,6 +25,7 @@
  **/
 
 #include "collectd.h"
+
 #include "common.h"
 #include "plugin.h"
 #include "configfile.h"
@@ -154,14 +155,14 @@ static size_t ascent_curl_callback (void *buf, size_t size, size_t nmemb, /* {{{
 {
   size_t len = size * nmemb;
 
-  if (len <= 0)
+  if (len == 0)
     return (len);
 
   if ((ascent_buffer_fill + len) >= ascent_buffer_size)
   {
     char *temp;
 
-    temp = (char *) realloc (ascent_buffer,
+    temp = realloc (ascent_buffer,
         ascent_buffer_fill + len + 1);
     if (temp == NULL)
     {
@@ -365,9 +366,9 @@ static int ascent_xml_sessions_plr (xmlDoc *doc, xmlNode *node, /* {{{ */
 static int ascent_xml_sessions (xmlDoc *doc, xmlNode *node) /* {{{ */
 {
   xmlNode *child;
-  player_stats_t ps;
-
-  memset (&ps, 0, sizeof (ps));
+  player_stats_t ps = {
+    .level_sum = 0
+  };
 
   for (child = node->xmlChildrenNode; child != NULL; child = child->next)
   {