Skip to content

Instantly share code, notes, and snippets.

@takai
Created February 10, 2009 01:01
Show Gist options
  • Save takai/61133 to your computer and use it in GitHub Desktop.
Save takai/61133 to your computer and use it in GitHub Desktop.
Index: ext/json/ext/generator/generator.c
===================================================================
--- ext/json/ext/generator/generator.c (revision 272)
+++ ext/json/ext/generator/generator.c (working copy)
@@ -1,6 +1,6 @@
#include <string.h>
#include "ruby.h"
-#include "st.h"
+#include "ruby/st.h"
#include "unicode.h"
#include <math.h>
@@ -86,7 +86,7 @@
}
inline static VALUE mHash_json_transfrom(VALUE self, VALUE Vstate, VALUE Vdepth) {
- long depth, len = RHASH(self)->tbl->num_entries;
+ long depth, len = RHASH_TBL(self)->num_entries;
VALUE result;
GET_STATE(Vstate);
@@ -142,7 +142,7 @@
rb_scan_args(argc, argv, "02", &Vstate, &Vdepth);
depth = NIL_P(Vdepth) ? 0 : FIX2LONG(Vdepth);
if (NIL_P(Vstate)) {
- long len = RHASH(self)->tbl->num_entries;
+ long len = RHASH_TBL(self)->num_entries;
result = rb_str_buf_new(len);
rb_str_buf_cat2(result, "{");
rb_hash_foreach(self, hash_to_json_i, result);
@@ -283,7 +283,7 @@
{
JSON_Generator_State *state = NULL;
VALUE Vstate, rest, tmp;
- double value = RFLOAT(self)->value;
+ double value = RFLOAT(self)->float_value;
rb_scan_args(argc, argv, "01*", &Vstate, &rest);
if (!NIL_P(Vstate)) Data_Get_Struct(Vstate, JSON_Generator_State, state);
if (isinf(value)) {
@@ -488,7 +488,7 @@
state->object_nl = tmp;
}
tmp = ID2SYM(i_check_circular);
- if (st_lookup(RHASH(opts)->tbl, tmp, 0)) {
+ if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
tmp = rb_hash_aref(opts, ID2SYM(i_check_circular));
state->check_circular = RTEST(tmp);
} else {
@@ -496,7 +496,7 @@
}
tmp = ID2SYM(i_max_nesting);
state->max_nesting = 19;
- if (st_lookup(RHASH(opts)->tbl, tmp, 0)) {
+ if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
VALUE max_nesting = rb_hash_aref(opts, tmp);
if (RTEST(max_nesting)) {
Check_Type(max_nesting, T_FIXNUM);
Index: ext/json/ext/parser/parser.rl
===================================================================
--- ext/json/ext/parser/parser.rl (revision 272)
+++ ext/json/ext/parser/parser.rl (working copy)
@@ -1,6 +1,6 @@
#include "ruby.h"
-#include "re.h"
-#include "st.h"
+#include "ruby/re.h"
+#include "ruby/st.h"
#include "unicode.h"
#define EVIL 0x666
@@ -496,7 +496,7 @@
rb_raise(rb_eArgError, "opts needs to be like a hash");
} else {
VALUE tmp = ID2SYM(i_max_nesting);
- if (st_lookup(RHASH(opts)->tbl, tmp, 0)) {
+ if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
VALUE max_nesting = rb_hash_aref(opts, tmp);
if (RTEST(max_nesting)) {
Check_Type(max_nesting, T_FIXNUM);
@@ -508,14 +508,14 @@
json->max_nesting = 19;
}
tmp = ID2SYM(i_allow_nan);
- if (st_lookup(RHASH(opts)->tbl, tmp, 0)) {
+ if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
VALUE allow_nan = rb_hash_aref(opts, tmp);
json->allow_nan = RTEST(allow_nan) ? 1 : 0;
} else {
json->allow_nan = 0;
}
tmp = ID2SYM(i_create_additions);
- if (st_lookup(RHASH(opts)->tbl, tmp, 0)) {
+ if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
VALUE create_additions = rb_hash_aref(opts, tmp);
if (RTEST(create_additions)) {
json->create_id = rb_funcall(mJSON, i_create_id, 0);
Index: ext/json/ext/parser/parser.c
===================================================================
--- ext/json/ext/parser/parser.c (revision 272)
+++ ext/json/ext/parser/parser.c (working copy)
@@ -1,7 +1,7 @@
#line 1 "parser.rl"
#include "ruby.h"
-#include "re.h"
-#include "st.h"
+#include "ruby/re.h"
+#include "ruby/st.h"
#include "unicode.h"
#define EVIL 0x666
@@ -1477,7 +1477,7 @@
rb_raise(rb_eArgError, "opts needs to be like a hash");
} else {
VALUE tmp = ID2SYM(i_max_nesting);
- if (st_lookup(RHASH(opts)->tbl, tmp, 0)) {
+ if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
VALUE max_nesting = rb_hash_aref(opts, tmp);
if (RTEST(max_nesting)) {
Check_Type(max_nesting, T_FIXNUM);
@@ -1489,14 +1489,14 @@
json->max_nesting = 19;
}
tmp = ID2SYM(i_allow_nan);
- if (st_lookup(RHASH(opts)->tbl, tmp, 0)) {
+ if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
VALUE allow_nan = rb_hash_aref(opts, tmp);
json->allow_nan = RTEST(allow_nan) ? 1 : 0;
} else {
json->allow_nan = 0;
}
tmp = ID2SYM(i_create_additions);
- if (st_lookup(RHASH(opts)->tbl, tmp, 0)) {
+ if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
VALUE create_additions = rb_hash_aref(opts, tmp);
if (RTEST(create_additions)) {
json->create_id = rb_funcall(mJSON, i_create_id, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment