Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

trying to make 2.0.0 compile with CentOS

  • Loading branch information...
commit f1ea0111ab8fc1b7c028d48ce9545931d72ade93 1 parent 6b2d449
@ohler55 authored
View
10 ext/oj/load.c
@@ -39,10 +39,8 @@
#include <string.h>
#include <math.h>
-//Workaround:
-#ifndef INFINITY
-#define INFINITY (1.0/0.0)
-#endif
+// Workaround in case INFINITY is not defined in math.h or if the OS is CentOS
+#define OJ_INFINITY (1.0/0.0)
#include "oj.h"
@@ -753,9 +751,9 @@ read_num(ParseInfo pi) {
return num;
} else {
if (neg) {
- return rb_float_new(-INFINITY);
+ return rb_float_new(-OJ_INFINITY);
} else {
- return rb_float_new(INFINITY);
+ return rb_float_new(OJ_INFINITY);
}
}
}
View
10 ext/oj/saj.c
@@ -36,10 +36,8 @@
#include <string.h>
#include <math.h>
-/* Workaround: */
-#ifndef INFINITY
-#define INFINITY (1.0/0.0)
-#endif
+// Workaround in case INFINITY is not defined in math.h or if the OS is CentOS
+#define OJ_INFINITY (1.0/0.0)
#include "oj.h"
@@ -384,11 +382,11 @@ read_num(ParseInfo pi, const char *key) {
pi->s += 8;
if (neg) {
if (pi->has_add_value) {
- call_add_value(pi->handler, rb_float_new(-INFINITY), key);
+ call_add_value(pi->handler, rb_float_new(-OJ_INFINITY), key);
}
} else {
if (pi->has_add_value) {
- call_add_value(pi->handler, rb_float_new(INFINITY), key);
+ call_add_value(pi->handler, rb_float_new(OJ_INFINITY), key);
}
}
return;
View
2  lib/oj/version.rb
@@ -1,5 +1,5 @@
module Oj
# Current version of the module.
- VERSION = '2.0.8'
+ VERSION = '2.0.9a1'
end
View
4 test/test_saj.rb
@@ -178,9 +178,7 @@ def test_fixnum_bad
json = %{12345xyz}
Oj.saj_parse(handler, json)
assert_equal([[:add_value, 12345, nil],
- [:error, "invalid format, extra characters at line 1, column 6 [saj.c:716]", 1, 6]], handler.calls)
+ [:error, "invalid format, extra characters at line 1, column 6 [saj.c:714]", 1, 6]], handler.calls)
end
end
-
-
Please sign in to comment.
Something went wrong with that request. Please try again.