**/
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
#include "configfile.h"
/* TODO: Remove this prototype */
static int apache_read_host (user_data_t *user_data);
-static void apache_free (apache_t *st)
+static void apache_free (void *arg)
{
+ apache_t *st = arg;
+
if (st == NULL)
return;
static int config_add (oconfig_item_t *ci)
{
apache_t *st;
- int i;
int status;
st = calloc (1, sizeof (*st));
}
assert (st->name != NULL);
- for (i = 0; i < ci->children_num; i++)
+ for (int i = 0; i < ci->children_num; i++)
{
oconfig_item_t *child = ci->children + i;
if (status == 0)
{
- user_data_t ud;
- char callback_name[3*DATA_MAX_NAME_LEN];
+ user_data_t ud = {
+ .data = st,
+ .free_func = apache_free
+ };
- memset (&ud, 0, sizeof (ud));
- ud.data = st;
- ud.free_func = (void *) apache_free;
+ char callback_name[3*DATA_MAX_NAME_LEN];
- memset (callback_name, 0, sizeof (callback_name));
ssnprintf (callback_name, sizeof (callback_name),
"apache/%s/%s",
(st->host != NULL) ? st->host : hostname_g,
static int config (oconfig_item_t *ci)
{
int status = 0;
- int i;
- for (i = 0; i < ci->children_num; i++)
+ for (int i = 0; i < ci->children_num; i++)
{
oconfig_item_t *child = ci->children + i;
long long response_start = 0LL;
long long response_end = 0LL;
- int i;
- for (i = 0; buf[i] != '\0'; i++)
+ for (int i = 0; buf[i] != '\0'; i++)
{
if (buf[i] == '.') open++;
else if (buf[i] == '_') waiting++;