ext/json/ext/generator/generator.c in json-1.1.2 vs ext/json/ext/generator/generator.c in json-1.1.3
- old
+ new
@@ -1,7 +1,5 @@
-/* vim: set cin et sw=4 ts=4: */
-
#include <string.h>
#include "ruby.h"
#include "st.h"
#include "unicode.h"
#include <math.h>
@@ -291,18 +289,18 @@
if (isinf(value)) {
if (!state || state->allow_nan) {
return rb_funcall(self, i_to_s, 0);
} else {
tmp = rb_funcall(self, i_to_s, 0);
- rb_raise(eGeneratorError, "%s not allowed in JSON", StringValueCStr(tmp));
+ rb_raise(eGeneratorError, "%u: %s not allowed in JSON", __LINE__, StringValueCStr(tmp));
}
} else if (isnan(value)) {
if (!state || state->allow_nan) {
return rb_funcall(self, i_to_s, 0);
} else {
tmp = rb_funcall(self, i_to_s, 0);
- rb_raise(eGeneratorError, "%s not allowed in JSON", StringValueCStr(tmp));
+ rb_raise(eGeneratorError, "%u: %s not allowed in JSON", __LINE__, StringValueCStr(tmp));
}
} else {
return rb_funcall(self, i_to_s, 0);
}
}
@@ -800,9 +798,10 @@
/*
*
*/
void Init_generator()
{
+ rb_require("json/common");
mJSON = rb_define_module("JSON");
mExt = rb_define_module_under(mJSON, "Ext");
mGenerator = rb_define_module_under(mExt, "Generator");
eGeneratorError = rb_path2class("JSON::GeneratorError");
eCircularDatastructure = rb_path2class("JSON::CircularDatastructure");