summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 396cbea)
raw | patch | inline | side by side (parent: 396cbea)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 12 Mar 2007 11:43:18 +0000 (12:43 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 12 Mar 2007 11:43:18 +0000 (12:43 +0100) |
src/collectd-nagios.c | patch | blob | history | |
src/rrdtool.c | patch | blob | history | |
src/unixsock.c | patch | blob | history |
diff --git a/src/collectd-nagios.c b/src/collectd-nagios.c
index 160412c5ed84b4131e8ad8dc159b0ea8da01ef43..b7c3ffaf267bd019baccd92fb622909af9a3d3a9 100644 (file)
--- a/src/collectd-nagios.c
+++ b/src/collectd-nagios.c
{
int ret = 0;
- if ((range->min != NAN) && (range->min > value))
+ if (!isnan (range->min) && (range->min > value))
ret = 1;
- if ((range->max != NAN) && (range->max < value))
+ if (!isnan (range->max) && (range->max < value))
ret = 1;
return (((ret - range->invert) == 0) ? 0 : 1);
for (i = 0; i < values_num; i++)
{
- if (values[i] == NAN)
+ if (isnan (values[i]))
num_warning++;
else if (match_range (&range_critical_g, values[i]) != 0)
num_critical++;
total_num = 0;
for (i = 0; i < values_num; i++)
{
- if (values[i] != NAN)
+ if (!isnan (values[i]))
{
total += values[i];
total_num++;
total_num = 0;
for (i = 0; i < values_num; i++)
{
- if (values[i] != NAN)
+ if (!isnan (values[i]))
{
total += values[i];
total_num++;
diff --git a/src/rrdtool.c b/src/rrdtool.c
index 80fc7671c32939d19ace90e93e3ab15538b3992d..f19f2693943f4400aa00b99439abd8a3929a9c3e 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
#include "utils_avltree.h"
#include "utils_debug.h"
-/*
- * This weird macro cascade forces the glibc to define `NAN'. I don't know
- * another way to solve this, so more intelligent solutions are welcome. -octo
- */
-#ifndef __USE_ISOC99
-# define DISABLE__USE_ISOC99 1
-# define __USE_ISOC99 1
-#endif
-#include <math.h>
-#ifdef DISABLE__USE_ISOC99
-# undef DISABLE__USE_ISOC99
-# undef __USE_ISOC99
-#endif
-
/*
* Private types
*/
break;
}
- if (d->min == NAN)
+ if (isnan (d->min))
{
strcpy (min, "U");
}
min[sizeof (min) - 1] = '\0';
}
- if (d->max == NAN)
+ if (isnan (d->max))
{
strcpy (max, "U");
}
diff --git a/src/unixsock.c b/src/unixsock.c
index b4af8b386a67e8b48e23f0bba02cef1d2275d7b7..0008b2242ccfa68862a58084d973c78bc43d1f03 100644 (file)
--- a/src/unixsock.c
+++ b/src/unixsock.c
vc->counter[i] = 0;
}
- if ((vc->gauge[i] == NAN)
- || ((ds->ds[i].min != NAN) && (vc->gauge[i] < ds->ds[i].min))
- || ((ds->ds[i].max != NAN) && (vc->gauge[i] > ds->ds[i].max)))
+ if (isnan (vc->gauge[i])
+ || (!isnan (ds->ds[i].min) && (vc->gauge[i] < ds->ds[i].min))
+ || (!isnan (ds->ds[i].max) && (vc->gauge[i] > ds->ds[i].max)))
vc->gauge[i] = NAN;
} /* for i = 0 .. ds->ds_num */
for (i = 0; i < vc->values_num; i++)
{
fprintf (fh, " %s=", vc->ds->ds[i].name);
- if (vc->gauge[i] == NAN)
+ if (isnan (vc->gauge[i]))
fprintf (fh, "NaN");
else
fprintf (fh, "%12e", vc->gauge[i]);