X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fbind.c;h=d46d4967caf1d9f5be590b5d383abe477daacc8d;hb=3fae5596643f1e361eb18c3d65448f8bc02fdd80;hp=b9731eeee0d89522cd3375239f07e0a4c1c50a96;hpb=b758f3b7146f1497d93e1df64cbc0c14ae164768;p=collectd.git diff --git a/src/bind.c b/src/bind.c index b9731eee..d46d4967 100644 --- a/src/bind.c +++ b/src/bind.c @@ -54,7 +54,7 @@ # define BIND_DEFAULT_URL "http://localhost:8053/" #endif -/* +/* * Some types used for the callback functions. `translation_table_ptr_t' and * `list_info_ptr_t' are passed to the callbacks in the `void *user_data' * pointer. @@ -277,14 +277,14 @@ static size_t bind_curl_callback (void *buf, size_t size, /* {{{ */ { size_t len = size * nmemb; - if (len <= 0) + if (len == 0) return (len); if ((bind_buffer_fill + len) >= bind_buffer_size) { char *temp; - temp = realloc(bind_buffer, bind_buffer_fill + len + 1); + temp = realloc (bind_buffer, bind_buffer_fill + len + 1); if (temp == NULL) { ERROR ("bind plugin: realloc failed."); @@ -417,7 +417,7 @@ static int bind_xml_read_timestamp (const char *xpath_expression, /* {{{ */ xmlNode *node; char *str_ptr; char *tmp; - struct tm tm; + struct tm tm = { 0 }; xpathObj = xmlXPathEvalExpression (BAD_CAST xpath_expression, xpathCtx); if (xpathObj == NULL) @@ -458,7 +458,6 @@ static int bind_xml_read_timestamp (const char *xpath_expression, /* {{{ */ return (-1); } - memset (&tm, 0, sizeof(tm)); tmp = strptime (str_ptr, "%Y-%m-%dT%T", &tm); xmlFree(str_ptr); if (tmp == NULL) @@ -474,7 +473,7 @@ static int bind_xml_read_timestamp (const char *xpath_expression, /* {{{ */ return (0); } /* }}} int bind_xml_read_timestamp */ -/* +/* * bind_parse_generic_name_value * * Reads statistics in the form: @@ -559,7 +558,7 @@ static int bind_parse_generic_name_value (const char *xpath_expression, /* {{{ * return (0); } /* }}} int bind_parse_generic_name_value */ -/* +/* * bind_parse_generic_value_list * * Reads statistics in the form: @@ -774,7 +773,7 @@ static int bind_xml_stats_handle_zone (int version, xmlDoc *doc, /* {{{ */ { /* Parse the tag {{{ */ char plugin_instance[DATA_MAX_NAME_LEN]; translation_table_ptr_t table_ptr = - { + { nsstats_translation_table, nsstats_translation_table_length, plugin_instance @@ -955,7 +954,7 @@ static int bind_xml_stats_handle_view (int version, xmlDoc *doc, /* {{{ */ { char plugin_instance[DATA_MAX_NAME_LEN]; translation_table_ptr_t table_ptr = - { + { resstats_translation_table, resstats_translation_table_length, plugin_instance @@ -1613,7 +1612,7 @@ static int bind_config_add_view_zone (cb_view_t *view, /* {{{ */ return (-1); } - tmp = (char **) realloc (view->zones, + tmp = realloc (view->zones, sizeof (char *) * (view->zones_num + 1)); if (tmp == NULL) { @@ -1644,7 +1643,7 @@ static int bind_config_add_view (oconfig_item_t *ci) /* {{{ */ return (-1); } - tmp = (cb_view_t *) realloc (views, sizeof (*views) * (views_num + 1)); + tmp = realloc (views, sizeof (*views) * (views_num + 1)); if (tmp == NULL) { ERROR ("bind plugin: realloc failed.");