diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-01-19 16:28:53 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-01-19 16:28:53 +0000 |
commit | 8302aa5f951e85984899d73fafa6bef2f23deddd (patch) | |
tree | e2d91c7eaadad662053210ef286ded8d89601f26 /ext/json | |
parent | b809254c8ce37ac996a7e0b2a9f27387cf7ee704 (diff) |
merge revision(s) 44569:44572,44576:44579,44581,44590:44594,44607,44608,44614,44615:
iseq.c: linear search
* iseq.c (iseq_type_from_id): linear search instead of hash lookup for
small fixed number keys.
------------------------------------------------------------------------
r44570 | nobu | 2014-01-12 17:11:32 +0900 (Sun, 12 Jan 2014) | 4 lines
tcltklib.c: create_ip_exc format argument
* ext/tk/tcltklib.c (create_ip_exc): format argument must not be a
dynamic string, not to contain unescaped %.
------------------------------------------------------------------------
r44571 | nobu | 2014-01-12 17:11:34 +0900 (Sun, 12 Jan 2014) | 5 lines
stubs.c: library name strings
* ext/tk/stubs.c (ruby_open_tcl_dll, ruby_open_tk_dll): make library
names by string literal concatenation at compilation time, not by
sprintf() at runtime.
------------------------------------------------------------------------
r44572 | nobu | 2014-01-12 17:11:36 +0900 (Sun, 12 Jan 2014) | 1 line
ext: use rb_sprintf() and rb_vsprintf() with PRIsVALUE
* ext/bigdecimal/bigdecimal.c (CLASS_NAME): macro to wrap
depending on PRIsVALUE for 1.9. [Backport #9406]
* ext/bigdecimal/bigdecimal.c (DECIMAL_SIZE_OF_BITS): fallback
definition for 2.1 or older. [ruby-core:59750] [Backport #9406]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@44659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/json')
-rw-r--r-- | ext/json/fbuffer/fbuffer.h | 9 | ||||
-rw-r--r-- | ext/json/generator/generator.c | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/ext/json/fbuffer/fbuffer.h b/ext/json/fbuffer/fbuffer.h index af74187566..1e860eb790 100644 --- a/ext/json/fbuffer/fbuffer.h +++ b/ext/json/fbuffer/fbuffer.h @@ -25,6 +25,15 @@ #define RSTRING_LEN(string) RSTRING(string)->len #endif +#ifdef PRIsVALUE +# define RB_OBJ_CLASSNAME(obj) rb_obj_class(obj) +# define RB_OBJ_STRING(obj) (obj) +#else +# define PRIsVALUE "s" +# define RB_OBJ_CLASSNAME(obj) rb_obj_classname(obj) +# define RB_OBJ_STRING(obj) StringValueCStr(obj) +#endif + #ifdef HAVE_RUBY_ENCODING_H #include "ruby/encoding.h" #define FORCE_UTF8(obj) rb_enc_associate((obj), rb_utf8_encoding()) diff --git a/ext/json/generator/generator.c b/ext/json/generator/generator.c index ae4593c940..5df8de1ddf 100644 --- a/ext/json/generator/generator.c +++ b/ext/json/generator/generator.c @@ -804,10 +804,10 @@ static void generate_json_float(FBuffer *buffer, VALUE Vstate, JSON_Generator_St if (!allow_nan) { if (isinf(value)) { fbuffer_free(buffer); - rb_raise(eGeneratorError, "%u: %s not allowed in JSON", __LINE__, StringValueCStr(tmp)); + rb_raise(eGeneratorError, "%u: %"PRIsVALUE" not allowed in JSON", __LINE__, RB_OBJ_STRING(tmp)); } else if (isnan(value)) { fbuffer_free(buffer); - rb_raise(eGeneratorError, "%u: %s not allowed in JSON", __LINE__, StringValueCStr(tmp)); + rb_raise(eGeneratorError, "%u: %"PRIsVALUE" not allowed in JSON", __LINE__, RB_OBJ_STRING(tmp)); } } fbuffer_append_str(buffer, tmp); |