X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fascent.c;h=a947bce942ee0e045fe3a77aeadb0802fa41a725;hb=3fae5596643f1e361eb18c3d65448f8bc02fdd80;hp=11175af5e6104afa7b39291fd77fd45441a0cb64;hpb=d5565943cd7ee338e5b750a027faff8115df4c72;p=collectd.git diff --git a/src/ascent.c b/src/ascent.c index 11175af5..a947bce9 100644 --- a/src/ascent.c +++ b/src/ascent.c @@ -32,7 +32,7 @@ #include #include -static char *races_list[] = /* {{{ */ +static const char *races_list[] = /* {{{ */ { NULL, "Human", /* 1 */ @@ -49,7 +49,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 +66,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 +154,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 +365,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) { @@ -594,8 +594,7 @@ static int ascent_init (void) /* {{{ */ if (timeout != NULL) curl_easy_setopt (curl, CURLOPT_TIMEOUT_MS, atol(timeout)); else - curl_easy_setopt (curl, CURLOPT_TIMEOUT_MS, - CDTIME_T_TO_MS(plugin_get_interval())); + curl_easy_setopt (curl, CURLOPT_TIMEOUT_MS, (long) CDTIME_T_TO_MS(plugin_get_interval())); #endif return (0);