X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Ftarget_notification.c;h=7908a29b9bfdc0e3af00d852a8e93c48c156e7c7;hb=865a6c83250e3d4381596a0d937df31d563f97c6;hp=9ee1518a09e7791a89ee535a94a7b7da79ffa69b;hpb=9b626288aff81c68fe19210a58b4a32eeefde9d3;p=collectd.git diff --git a/src/target_notification.c b/src/target_notification.c index 9ee1518a..7908a29b 100644 --- a/src/target_notification.c +++ b/src/target_notification.c @@ -19,44 +19,6 @@ * Florian Forster **/ -/* - * First tell the compiler to stick to the C99 and POSIX standards as close as - * possible. - */ -#ifndef __STRICT_ANSI__ /* {{{ */ -# define __STRICT_ANSI__ -#endif - -#ifndef _ISOC99_SOURCE -# define _ISOC99_SOURCE -#endif - -#ifdef _POSIX_C_SOURCE -# undef _POSIX_C_SOURCE -#endif -#define _POSIX_C_SOURCE 200112L - -#if 0 -/* Single UNIX needed for strdup. */ -#ifdef _XOPEN_SOURCE -# undef _XOPEN_SOURCE -#endif -#define _XOPEN_SOURCE 500 -#endif - -#ifndef _REENTRANT -# define _REENTRANT -#endif - -#ifndef _THREAD_SAFE -# define _THREAD_SAFE -#endif - -#ifdef _GNU_SOURCE -# undef _GNU_SOURCE -#endif -/* }}} */ - #include "collectd.h" #include "common.h" #include "filter_chain.h" @@ -214,7 +176,7 @@ static int tn_create (const oconfig_item_t *ci, void **user_data) /* {{{ */ if (status != 0) { - tn_destroy ((void *) data); + tn_destroy ((void *) &data); return (status); } @@ -247,7 +209,7 @@ static int tn_invoke (const data_set_t *ds, value_list_t *vl, /* {{{ */ /* Initialize the structure. */ memset (&n, 0, sizeof (n)); n.severity = data->severity; - n.time = time (NULL); + n.time = cdtime (); sstrncpy (n.message, data->message, sizeof (n.message)); sstrncpy (n.host, vl->host, sizeof (n.host)); sstrncpy (n.plugin, vl->plugin, sizeof (n.plugin)); @@ -289,12 +251,12 @@ static int tn_invoke (const data_set_t *ds, value_list_t *vl, /* {{{ */ /* If this is a gauge value, use the current value. */ if (ds->ds[i].type == DS_TYPE_GAUGE) ssnprintf (value_str, sizeof (value_str), - "%g", (double) vl->values[i].gauge); + GAUGE_FORMAT, (double) vl->values[i].gauge); /* If it's a counter, try to use the current rate. This may fail, if the * value has been renamed. */ else if (rates != NULL) ssnprintf (value_str, sizeof (value_str), - "%g", (double) rates[i]); + GAUGE_FORMAT, (double) rates[i]); /* Since we don't know any better, use the string `unknown'. */ else sstrncpy (value_str, "unknown", sizeof (value_str));