X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fascent.c;h=504decc4a91593bde0781bca4fac83837895b579;hb=f35f67df9ccfb80c001ed0befcce8bb90ebb2a07;hp=2ba3c772d5f9f8116f4100b6f3484756cfbb8ef7;hpb=eb2f3a4bdc78e1e2c4191b4e08d75d5eeea8be0e;p=collectd.git diff --git a/src/ascent.c b/src/ascent.c index 2ba3c772..504decc4 100644 --- a/src/ascent.c +++ b/src/ascent.c @@ -25,6 +25,7 @@ **/ #include "collectd.h" + #include "common.h" #include "plugin.h" #include "configfile.h" @@ -32,7 +33,7 @@ #include #include -static char *races_list[] = /* {{{ */ +static const char *races_list[] = /* {{{ */ { NULL, "Human", /* 1 */ @@ -49,7 +50,7 @@ static char *races_list[] = /* {{{ */ }; /* }}} */ #define RACES_LIST_LENGTH STATIC_ARRAY_SIZE (races_list) -static char *classes_list[] = /* {{{ */ +static const char *classes_list[] = /* {{{ */ { NULL, "Warrior", /* 1 */ @@ -66,7 +67,7 @@ static char *classes_list[] = /* {{{ */ }; /* }}} */ #define CLASSES_LIST_LENGTH STATIC_ARRAY_SIZE (classes_list) -static char *genders_list[] = /* {{{ */ +static const char *genders_list[] = /* {{{ */ { "Male", "Female" @@ -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) {