aboutsummaryrefslogtreecommitdiffstats
path: root/ext/json/fbuffer
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-20 02:55:08 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-20 02:55:08 +0000
commit14cab32596d3e394cafea7a7698a81034b83c172 (patch)
tree672a0450700e77f4d0129f781ce24c1799a773fa /ext/json/fbuffer
parent9d740ddebeaa46f47c9b4529e8b36d72d97f9105 (diff)
downloadruby-14cab32596d3e394cafea7a7698a81034b83c172.tar.gz
* ext/json: merge JSON 1.8.1.
https://github.com/nurse/json/compare/002ac2771ce32776b32ccd2d06e5604de6c36dcd...e09ffc0d7da25d0393873936c118c188c78dbac3 * Remove Rubinius exception since transcoding should be working now. * Fix https://github.com/flori/json/issues/162 reported by Marc-Andre Lafortune <github_rocks@marc-andre.ca>. Thanks! * Applied patches by Yui NARUSE <naruse@airemix.jp> to suppress warning with -Wchar-subscripts and better validate UTF-8 strings. * Applied patch by ginriki@github to remove unnecessary if. * Add load/dump interface to JSON::GenericObject to make serialize :some_attribute, JSON::GenericObject work in Rails active models for convenient SomeModel#some_attribute.foo.bar access to serialised JSON data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/json/fbuffer')
-rw-r--r--ext/json/fbuffer/fbuffer.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/json/fbuffer/fbuffer.h b/ext/json/fbuffer/fbuffer.h
index 952ab30fa6..af74187566 100644
--- a/ext/json/fbuffer/fbuffer.h
+++ b/ext/json/fbuffer/fbuffer.h
@@ -67,7 +67,7 @@ static VALUE fbuffer_to_s(FBuffer *fb);
static FBuffer *fbuffer_alloc(unsigned long initial_length)
{
FBuffer *fb;
- if (initial_length == 0) initial_length = FBUFFER_INITIAL_LENGTH_DEFAULT;
+ if (initial_length <= 0) initial_length = FBUFFER_INITIAL_LENGTH_DEFAULT;
fb = ALLOC(FBuffer);
memset((void *) fb, 0, sizeof(FBuffer));
fb->initial_length = initial_length;
@@ -117,9 +117,9 @@ static void fbuffer_append_str(FBuffer *fb, VALUE str)
const char *newstr = StringValuePtr(str);
unsigned long len = RSTRING_LEN(str);
- fbuffer_append(fb, newstr, len);
-
RB_GC_GUARD(str);
+
+ fbuffer_append(fb, newstr, len);
}
#endif