aboutsummaryrefslogtreecommitdiffstats
path: root/ext/json/fbuffer/fbuffer.h
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-07 16:00:49 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-07 16:00:49 +0000
commit5a00be2bf75939fd3bb05dabbdf46244eaa6bb43 (patch)
tree7a4e8c43342493d270ea16116506295751621c85 /ext/json/fbuffer/fbuffer.h
parent5f7be3150f0bffb6a958770c61270302123774c3 (diff)
downloadruby-5a00be2bf75939fd3bb05dabbdf46244eaa6bb43.tar.gz
* ext/json: Merge JSON 1.7.1.
https://github.com/flori/json/commit/e5b9a9465c1159fae533bca320d950b772bcb4ac git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/json/fbuffer/fbuffer.h')
-rw-r--r--ext/json/fbuffer/fbuffer.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/ext/json/fbuffer/fbuffer.h b/ext/json/fbuffer/fbuffer.h
index 47e0c07004..f7c2b034b7 100644
--- a/ext/json/fbuffer/fbuffer.h
+++ b/ext/json/fbuffer/fbuffer.h
@@ -35,10 +35,14 @@ static FBuffer *fbuffer_alloc(unsigned long initial_length);
static void fbuffer_free(FBuffer *fb);
static void fbuffer_clear(FBuffer *fb);
static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len);
+#ifdef JSON_GENERATOR
static void fbuffer_append_long(FBuffer *fb, long number);
+#endif
static void fbuffer_append_char(FBuffer *fb, char newchr);
+#ifdef JSON_GENERATOR
static FBuffer *fbuffer_dup(FBuffer *fb);
static VALUE fbuffer_to_s(FBuffer *fb);
+#endif
static FBuffer *fbuffer_alloc(unsigned long initial_length)
{
@@ -68,7 +72,6 @@ static void fbuffer_inc_capa(FBuffer *fb, unsigned long requested)
if (!fb->ptr) {
fb->ptr = ALLOC_N(char, fb->initial_length);
fb->capa = fb->initial_length;
- fb->len = 0;
}
for (required = fb->capa; requested > required - fb->len; required <<= 1);
@@ -88,15 +91,17 @@ static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len)
}
}
+#ifdef JSON_GENERATOR
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
static void fbuffer_append_char(FBuffer *fb, char newchr)
{
@@ -105,6 +110,7 @@ static void fbuffer_append_char(FBuffer *fb, char newchr)
fb->len++;
}
+#ifdef JSON_GENERATOR
static void freverse(char *start, char *end)
{
char c;
@@ -155,3 +161,4 @@ static VALUE fbuffer_to_s(FBuffer *fb)
return result;
}
#endif
+#endif