#include "libcollectdclient/collectd/client.h"
#include "libcollectdclient/collectd/network.h"
-#include "libcollectdclient/collectd/network_buffer.h"
#define DEF_NUM_HOSTS 1000
#define DEF_NUM_PLUGINS 20
lcc_value_list_t *vl;
int host_num;
- vl = malloc (sizeof (*vl));
+ vl = calloc (1, sizeof (*vl));
if (vl == NULL)
{
- fprintf (stderr, "malloc failed.\n");
+ fprintf (stderr, "calloc failed.\n");
return (NULL);
}
- memset (vl, 0, sizeof (*vl));
vl->values = calloc (/* nmemb = */ 1, sizeof (*vl->values));
if (vl->values == NULL)
strncpy (vl->identifier.type,
(vl->values_types[0] == LCC_TYPE_GAUGE) ? "gauge" : "derive",
sizeof (vl->identifier.type));
+ vl->identifier.type[sizeof (vl->identifier.type) - 1] = 0;
snprintf (vl->identifier.type_instance, sizeof (vl->identifier.type_instance),
"ti%li", random ());
int main (int argc, char **argv) /* {{{ */
{
- int i;
double last_time;
int values_sent = 0;
else
{
lcc_server_t *srv;
-
+
srv = lcc_server_create (net, conf_destination, conf_service);
if (srv == NULL)
{
fprintf (stdout, "Creating %i values ... ", conf_num_values);
fflush (stdout);
- for (i = 0; i < conf_num_values; i++)
+ for (int i = 0; i < conf_num_values; i++)
{
lcc_value_list_t *vl;
lcc_network_destroy (net);
exit (EXIT_SUCCESS);
- return (0);
} /* }}} int main */
/* vim: set sw=2 sts=2 et fdm=marker : */