projects
/
rrdtool.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Do not trust cache tree pointers after releasing the cache lock.
[rrdtool.git]
/
src
/
rrd_nan_inf.c
diff --git
a/src/rrd_nan_inf.c
b/src/rrd_nan_inf.c
index
22886c4
..
2914d1a
100644
(file)
--- a/
src/rrd_nan_inf.c
+++ b/
src/rrd_nan_inf.c
@@
-1,15
+1,40
@@
-#include "rrd_nan_inf.h"
+int done_nan = 0;
+int done_inf = 0;
-#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+double dnan;
+double dinf;
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
#include <math.h>
#include <math.h>
+#include "rrd.h"
-double set_to_DNAN(void) { return (double)fmod(0.0,0.0); }
-double set_to_DINF(void) { return (double)fabs((double)log(0.0)); }
+#define NAN_FUNC (double)fmod(0.0,0.0)
+#define INF_FUNC (double)fabs((double)log(0.0))
#else
#else
+#include "rrd.h"
-double set_to_DNAN(void) { return (double)(0.0/0.0); }
-double set_to_DINF(void) { return (double)(1.0/0.0); }
+#define NAN_FUNC (double)(0.0/0.0)
+#define INF_FUNC (double)(1.0/0.0)
#endif
#endif
+
+double rrd_set_to_DNAN(
+ void)
+{
+ if (!done_nan) {
+ dnan = NAN_FUNC;
+ done_nan = 1;
+ }
+ return dnan;
+}
+
+double rrd_set_to_DINF(
+ void)
+{
+ if (!done_inf) {
+ dinf = INF_FUNC;
+ done_inf = 1;
+ }
+ return dinf;
+}