diff options
Diffstat (limited to 'ext/json/parser/parser.h')
-rw-r--r-- | ext/json/parser/parser.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ext/json/parser/parser.h b/ext/json/parser/parser.h index a344da058c..f2ce5a4c2f 100644 --- a/ext/json/parser/parser.h +++ b/ext/json/parser/parser.h @@ -9,18 +9,23 @@ #ifdef HAVE_RUBY_ENCODING_H #include "ruby/encoding.h" -#define FORCE_UTF8(obj) rb_enc_associate((obj), rb_utf8_encoding()) +#define FORCE_UTF8(obj) ((obj) = rb_enc_associate(rb_str_dup(obj), rb_utf8_encoding())) #else #define FORCE_UTF8(obj) #endif +#ifdef HAVE_RUBY_ST_H +#include "ruby/st.h" +#else +#include "st.h" +#endif #define option_given_p(opts, key) RTEST(rb_funcall(opts, i_key_p, 1, key)) /* unicode */ -typedef unsigned long UTF32; /* at least 32 bits */ -typedef unsigned short UTF16; /* at least 16 bits */ -typedef unsigned char UTF8; /* typically 8 bits */ +typedef unsigned long UTF32; /* at least 32 bits */ +typedef unsigned short UTF16; /* at least 16 bits */ +typedef unsigned char UTF8; /* typically 8 bits */ #define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD #define UNI_SUR_HIGH_START (UTF32)0xD800 @@ -41,6 +46,8 @@ typedef struct JSON_ParserStruct { int symbolize_names; VALUE object_class; VALUE array_class; + int create_additions; + VALUE match_string; } JSON_Parser; #define GET_PARSER \ |