diff options
Diffstat (limited to 'ext/json/generator/generator.h')
-rw-r--r-- | ext/json/generator/generator.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/ext/json/generator/generator.h b/ext/json/generator/generator.h index 3ebd622554..98b7d833f3 100644 --- a/ext/json/generator/generator.h +++ b/ext/json/generator/generator.h @@ -49,8 +49,8 @@ static const UTF32 halfMask = 0x3FFUL; static unsigned char isLegalUTF8(const UTF8 *source, unsigned long length); static void unicode_escape(char *buf, UTF16 character); static void unicode_escape_to_buffer(FBuffer *buffer, char buf[6], UTF16 character); -static void convert_UTF8_to_JSON_ASCII(FBuffer *buffer, VALUE string, char escape_slash); -static void convert_UTF8_to_JSON(FBuffer *buffer, VALUE string, char escape_slash); +static void convert_UTF8_to_JSON_ASCII(FBuffer *buffer, VALUE string, char script_safe); +static void convert_UTF8_to_JSON(FBuffer *buffer, VALUE string, char script_safe); static char *fstrndup(const char *ptr, unsigned long len); /* ruby api and some helpers */ @@ -72,7 +72,8 @@ typedef struct JSON_Generator_StateStruct { long max_nesting; char allow_nan; char ascii_only; - char escape_slash; + char script_safe; + char strict; long depth; long buffer_initial_length; } JSON_Generator_State; @@ -151,8 +152,10 @@ static VALUE cState_allow_nan_p(VALUE self); static VALUE cState_ascii_only_p(VALUE self); static VALUE cState_depth(VALUE self); static VALUE cState_depth_set(VALUE self, VALUE depth); -static VALUE cState_escape_slash(VALUE self); -static VALUE cState_escape_slash_set(VALUE self, VALUE depth); +static VALUE cState_script_safe(VALUE self); +static VALUE cState_script_safe_set(VALUE self, VALUE depth); +static VALUE cState_strict(VALUE self); +static VALUE cState_strict_set(VALUE self, VALUE strict); static FBuffer *cState_prepare_buffer(VALUE self); #ifndef ZALLOC #define ZALLOC(type) ((type *)ruby_zalloc(sizeof(type))) @@ -163,12 +166,7 @@ static inline void *ruby_zalloc(size_t n) return p; } #endif -#ifdef TypedData_Make_Struct + static const rb_data_type_t JSON_Generator_State_type; -#define NEW_TYPEDDATA_WRAPPER 1 -#else -#define TypedData_Make_Struct(klass, type, ignore, json) Data_Make_Struct(klass, type, NULL, State_free, json) -#define TypedData_Get_Struct(self, JSON_Generator_State, ignore, json) Data_Get_Struct(self, JSON_Generator_State, json) -#endif #endif |