json_pure 1.6.1 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ .*.sw[pon]
2
+ coverage
3
+ pkg
4
+ .nfs.*
5
+ .idea
6
+ java/Json.iml
7
+ Gemfile.lock
8
+ .rvmrc
data/.travis.yml ADDED
@@ -0,0 +1,15 @@
1
+ # Passes arguments to bundle install (http://gembundler.com/man/bundle-install.1.html)
2
+ bundler_args: --binstubs
3
+
4
+ # Specify which ruby versions you wish to run your tests on, each version will be used
5
+ rvm:
6
+ - 1.8.7
7
+ - 1.9.2
8
+ - 1.9.3
9
+ - rbx
10
+ - rbx-2.0
11
+ - ree
12
+ - jruby
13
+ - ruby-head
14
+
15
+ script: "bundle exec rake"
data/CHANGES CHANGED
@@ -1,3 +1,13 @@
1
+ 2011-11-21 (1.6.2)
2
+ * Add support for OpenStruct and BigDecimal.
3
+ * Fix bug when parsing nil in quirks_mode.
4
+ * Make JSON.dump and JSON.load methods better cooperate with Rails' serialize
5
+ method. Just use: serialize :value, JSON
6
+ * Fix bug with time serialization concerning nanoseconds. Thanks for the
7
+ patch go to Josh Partlow (jpartlow@github).
8
+ * Improve parsing speed for JSON numbers (integers and floats) in a similar way to
9
+ what Evan Phoenix <evan@phx.io> suggested in:
10
+ https://github.com/flori/json/pull/103
1
11
  2011-09-18 (1.6.1)
2
12
  * Using -target 1.5 to force Java bits to compile with 1.5.
3
13
  2011-09-12 (1.6.0)
data/Gemfile CHANGED
@@ -5,3 +5,7 @@ source :rubygems
5
5
  gemspec :name => 'json'
6
6
  gemspec :name => 'json_pure'
7
7
  gemspec :name => 'json-java'
8
+
9
+ group :development do
10
+ gem 'simplecov', :platform => :mri_19
11
+ end
data/Rakefile CHANGED
@@ -22,14 +22,13 @@ MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system(c, '-v') }
22
22
  PKG_NAME = 'json'
23
23
  PKG_TITLE = 'JSON Implementation for Ruby'
24
24
  PKG_VERSION = File.read('VERSION').chomp
25
- PKG_FILES = FileList["**/*"].exclude(/CVS|pkg|tmp|coverage|Makefile|\.nfs\.|\.iml\Z/).exclude(/\.(so|bundle|o|class|#{CONFIG['DLEXT']})$/)
25
+ PKG_FILES = FileList[`git ls-files`.split(/\n/)]
26
26
 
27
27
  EXT_ROOT_DIR = 'ext/json/ext'
28
28
  EXT_PARSER_DIR = "#{EXT_ROOT_DIR}/parser"
29
29
  EXT_PARSER_DL = "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}"
30
30
  RAGEL_PATH = "#{EXT_PARSER_DIR}/parser.rl"
31
31
  EXT_PARSER_SRC = "#{EXT_PARSER_DIR}/parser.c"
32
- PKG_FILES << EXT_PARSER_SRC
33
32
  EXT_GENERATOR_DIR = "#{EXT_ROOT_DIR}/generator"
34
33
  EXT_GENERATOR_DL = "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}"
35
34
  EXT_GENERATOR_SRC = "#{EXT_GENERATOR_DIR}/generator.c"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.1
1
+ 1.6.2
File without changes
File without changes
@@ -199,7 +199,7 @@ if $0 == __FILE__
199
199
  system "#{RAKE_PATH} clean"
200
200
  system "#{RUBY_PATH} #$0 rails"
201
201
  system "#{RUBY_PATH} #$0 pure"
202
- system "#{RAKE_PATH} compile_ext"
202
+ system "#{RAKE_PATH} compile"
203
203
  system "#{RUBY_PATH} #$0 ext"
204
204
  system "#{RUBY_PATH} #$0 yajl"
205
205
  Bullshit.compare do
@@ -201,7 +201,7 @@ if $0 == __FILE__
201
201
  system "#{RAKE_PATH} clean"
202
202
  system "#{RUBY_PATH} #$0 rails"
203
203
  system "#{RUBY_PATH} #$0 pure"
204
- system "#{RAKE_PATH} compile_ext"
204
+ system "#{RAKE_PATH} compile"
205
205
  system "#{RUBY_PATH} #$0 ext"
206
206
  system "#{RUBY_PATH} #$0 yajl"
207
207
  Bullshit.compare do
@@ -233,7 +233,7 @@ if $0 == __FILE__
233
233
  system "#{RUBY_PATH} #$0 yaml"
234
234
  system "#{RUBY_PATH} #$0 rails"
235
235
  system "#{RUBY_PATH} #$0 pure"
236
- system "#{RAKE_PATH} compile_ext"
236
+ system "#{RAKE_PATH} compile"
237
237
  system "#{RUBY_PATH} #$0 ext"
238
238
  system "#{RUBY_PATH} #$0 yajl"
239
239
  Bullshit.compare do
@@ -241,7 +241,7 @@ if $0 == __FILE__
241
241
  system "#{RUBY_PATH} #$0 yaml"
242
242
  system "#{RUBY_PATH} #$0 rails"
243
243
  system "#{RUBY_PATH} #$0 pure"
244
- system "#{RAKE_PATH} compile_ext"
244
+ system "#{RAKE_PATH} compile"
245
245
  system "#{RUBY_PATH} #$0 ext"
246
246
  system "#{RUBY_PATH} #$0 yajl"
247
247
  Bullshit.compare do
data/diagrams/.keep ADDED
File without changes
@@ -0,0 +1,156 @@
1
+
2
+ #ifndef _FBUFFER_H_
3
+ #define _FBUFFER_H_
4
+
5
+ #include <assert.h>
6
+ #include "ruby.h"
7
+
8
+ #ifdef HAVE_RUBY_ENCODING_H
9
+ #include "ruby/encoding.h"
10
+ #define FORCE_UTF8(obj) rb_enc_associate((obj), rb_utf8_encoding())
11
+ #else
12
+ #define FORCE_UTF8(obj)
13
+ #endif
14
+
15
+ /* We don't need to guard objects for rbx, so let's do nothing at all. */
16
+ #ifndef RB_GC_GUARD
17
+ #define RB_GC_GUARD(object)
18
+ #endif
19
+
20
+ typedef struct FBufferStruct {
21
+ unsigned long initial_length;
22
+ char *ptr;
23
+ unsigned long len;
24
+ unsigned long capa;
25
+ } FBuffer;
26
+
27
+ #define FBUFFER_INITIAL_LENGTH_DEFAULT 1024
28
+
29
+ #define FBUFFER_PTR(fb) (fb->ptr)
30
+ #define FBUFFER_LEN(fb) (fb->len)
31
+ #define FBUFFER_CAPA(fb) (fb->capa)
32
+ #define FBUFFER_PAIR(fb) FBUFFER_PTR(fb), FBUFFER_LEN(fb)
33
+
34
+ static FBuffer *fbuffer_alloc(unsigned long initial_length);
35
+ static void fbuffer_free(FBuffer *fb);
36
+ static void fbuffer_clear(FBuffer *fb);
37
+ static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len);
38
+ static void fbuffer_append_long(FBuffer *fb, long number);
39
+ static void fbuffer_append_char(FBuffer *fb, char newchr);
40
+ static FBuffer *fbuffer_dup(FBuffer *fb);
41
+ static VALUE fbuffer_to_s(FBuffer *fb);
42
+
43
+ static FBuffer *fbuffer_alloc(unsigned long initial_length)
44
+ {
45
+ FBuffer *fb;
46
+ if (initial_length <= 0) initial_length = FBUFFER_INITIAL_LENGTH_DEFAULT;
47
+ fb = ALLOC(FBuffer);
48
+ memset((void *) fb, 0, sizeof(FBuffer));
49
+ fb->initial_length = initial_length;
50
+ return fb;
51
+ }
52
+
53
+ static void fbuffer_free(FBuffer *fb)
54
+ {
55
+ if (fb->ptr) ruby_xfree(fb->ptr);
56
+ ruby_xfree(fb);
57
+ }
58
+
59
+ static void fbuffer_clear(FBuffer *fb)
60
+ {
61
+ fb->len = 0;
62
+ }
63
+
64
+ static void fbuffer_inc_capa(FBuffer *fb, unsigned long requested)
65
+ {
66
+ unsigned long required;
67
+
68
+ if (!fb->ptr) {
69
+ fb->ptr = ALLOC_N(char, fb->initial_length);
70
+ fb->capa = fb->initial_length;
71
+ }
72
+
73
+ for (required = fb->capa; requested > required - fb->len; required <<= 1);
74
+
75
+ if (required > fb->capa) {
76
+ REALLOC_N(fb->ptr, char, required);
77
+ fb->capa = required;
78
+ }
79
+ }
80
+
81
+ static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len)
82
+ {
83
+ if (len > 0) {
84
+ fbuffer_inc_capa(fb, len);
85
+ MEMCPY(fb->ptr + fb->len, newstr, char, len);
86
+ fb->len += len;
87
+ }
88
+ }
89
+
90
+ static void fbuffer_append_str(FBuffer *fb, VALUE str)
91
+ {
92
+ const char *newstr = StringValuePtr(str);
93
+ unsigned long len = RSTRING_LEN(str);
94
+
95
+ RB_GC_GUARD(str);
96
+
97
+ fbuffer_append(fb, newstr, len);
98
+ }
99
+
100
+ static void fbuffer_append_char(FBuffer *fb, char newchr)
101
+ {
102
+ fbuffer_inc_capa(fb, 1);
103
+ *(fb->ptr + fb->len) = newchr;
104
+ fb->len++;
105
+ }
106
+
107
+ static void freverse(char *start, char *end)
108
+ {
109
+ char c;
110
+
111
+ while (end > start) {
112
+ c = *end, *end-- = *start, *start++ = c;
113
+ }
114
+ }
115
+
116
+ static long fltoa(long number, char *buf)
117
+ {
118
+ static char digits[] = "0123456789";
119
+ long sign = number;
120
+ char* tmp = buf;
121
+
122
+ if (sign < 0) number = -number;
123
+ do *tmp++ = digits[number % 10]; while (number /= 10);
124
+ if (sign < 0) *tmp++ = '-';
125
+ freverse(buf, tmp - 1);
126
+ return tmp - buf;
127
+ }
128
+
129
+ static void fbuffer_append_long(FBuffer *fb, long number)
130
+ {
131
+ char buf[20];
132
+ unsigned long len = fltoa(number, buf);
133
+ fbuffer_append(fb, buf, len);
134
+ }
135
+
136
+ static FBuffer *fbuffer_dup(FBuffer *fb)
137
+ {
138
+ unsigned long len = fb->len;
139
+ FBuffer *result;
140
+
141
+ assert(len > 0);
142
+ if (len > 0) {
143
+ result = fbuffer_alloc(len);
144
+ fbuffer_append(result, FBUFFER_PAIR(fb));
145
+ }
146
+ return result;
147
+ }
148
+
149
+ static VALUE fbuffer_to_s(FBuffer *fb)
150
+ {
151
+ VALUE result = rb_str_new(FBUFFER_PAIR(fb));
152
+ fbuffer_free(fb);
153
+ FORCE_UTF8(result);
154
+ return result;
155
+ }
156
+ #endif
@@ -1,5 +1,4 @@
1
1
  require 'mkmf'
2
- require 'rbconfig'
3
2
 
4
3
  unless $CFLAGS.gsub!(/ -O[\dsz]?/, ' -O3')
5
4
  $CFLAGS << ' -O3'
@@ -11,10 +10,4 @@ if CONFIG['CC'] =~ /gcc/
11
10
  #end
12
11
  end
13
12
 
14
- if RUBY_VERSION < "1.9"
15
- have_header("re.h")
16
- else
17
- have_header("ruby/re.h")
18
- have_header("ruby/encoding.h")
19
- end
20
13
  create_makefile 'json/ext/generator'
@@ -1,3 +1,4 @@
1
+ #include "../fbuffer/fbuffer.h"
1
2
  #include "generator.h"
2
3
 
3
4
  #ifdef HAVE_RUBY_ENCODING_H
@@ -14,7 +15,8 @@ static VALUE mJSON, mExt, mGenerator, cState, mGeneratorMethods, mObject,
14
15
  static ID i_to_s, i_to_json, i_new, i_indent, i_space, i_space_before,
15
16
  i_object_nl, i_array_nl, i_max_nesting, i_allow_nan, i_ascii_only,
16
17
  i_quirks_mode, i_pack, i_unpack, i_create_id, i_extend, i_key_p,
17
- i_aref, i_send, i_respond_to_p, i_match, i_keys, i_depth, i_dup;
18
+ i_aref, i_send, i_respond_to_p, i_match, i_keys, i_depth,
19
+ i_buffer_initial_length, i_dup;
18
20
 
19
21
  /*
20
22
  * Copyright 2001-2004 Unicode, Inc.
@@ -112,7 +114,7 @@ static void unicode_escape(char *buf, UTF16 character)
112
114
  }
113
115
 
114
116
  /* Escapes the UTF16 character and stores the result in the buffer buf, then
115
- * the buffer buf іs appended to the FBuffer buffer. */
117
+ * the buffer buf is appended to the FBuffer buffer. */
116
118
  static void unicode_escape_to_buffer(FBuffer *buffer, char buf[6], UTF16
117
119
  character)
118
120
  {
@@ -292,123 +294,6 @@ static char *fstrndup(const char *ptr, unsigned long len) {
292
294
  return result;
293
295
  }
294
296
 
295
- /* fbuffer implementation */
296
-
297
- static FBuffer *fbuffer_alloc()
298
- {
299
- FBuffer *fb = ALLOC(FBuffer);
300
- memset((void *) fb, 0, sizeof(FBuffer));
301
- fb->initial_length = FBUFFER_INITIAL_LENGTH;
302
- return fb;
303
- }
304
-
305
- static FBuffer *fbuffer_alloc_with_length(unsigned long initial_length)
306
- {
307
- FBuffer *fb;
308
- assert(initial_length > 0);
309
- fb = ALLOC(FBuffer);
310
- memset((void *) fb, 0, sizeof(FBuffer));
311
- fb->initial_length = initial_length;
312
- return fb;
313
- }
314
-
315
- static void fbuffer_free(FBuffer *fb)
316
- {
317
- if (fb->ptr) ruby_xfree(fb->ptr);
318
- ruby_xfree(fb);
319
- }
320
-
321
- static void fbuffer_clear(FBuffer *fb)
322
- {
323
- fb->len = 0;
324
- }
325
-
326
- static void fbuffer_inc_capa(FBuffer *fb, unsigned long requested)
327
- {
328
- unsigned long required;
329
-
330
- if (!fb->ptr) {
331
- fb->ptr = ALLOC_N(char, fb->initial_length);
332
- fb->capa = fb->initial_length;
333
- }
334
-
335
- for (required = fb->capa; requested > required - fb->len; required <<= 1);
336
-
337
- if (required > fb->capa) {
338
- REALLOC_N(fb->ptr, char, required);
339
- fb->capa = required;
340
- }
341
- }
342
-
343
- static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned long len)
344
- {
345
- if (len > 0) {
346
- fbuffer_inc_capa(fb, len);
347
- MEMCPY(fb->ptr + fb->len, newstr, char, len);
348
- fb->len += len;
349
- }
350
- }
351
-
352
- static void fbuffer_append_str(FBuffer *fb, VALUE str)
353
- {
354
- const char *newstr = StringValuePtr(str);
355
- unsigned long len = RSTRING_LEN(str);
356
-
357
- RB_GC_GUARD(str);
358
-
359
- fbuffer_append(fb, newstr, len);
360
- }
361
-
362
- static void fbuffer_append_char(FBuffer *fb, char newchr)
363
- {
364
- fbuffer_inc_capa(fb, 1);
365
- *(fb->ptr + fb->len) = newchr;
366
- fb->len++;
367
- }
368
-
369
- static void freverse(char *start, char *end)
370
- {
371
- char c;
372
-
373
- while (end > start) {
374
- c = *end, *end-- = *start, *start++ = c;
375
- }
376
- }
377
-
378
- static long fltoa(long number, char *buf)
379
- {
380
- static char digits[] = "0123456789";
381
- long sign = number;
382
- char* tmp = buf;
383
-
384
- if (sign < 0) number = -number;
385
- do *tmp++ = digits[number % 10]; while (number /= 10);
386
- if (sign < 0) *tmp++ = '-';
387
- freverse(buf, tmp - 1);
388
- return tmp - buf;
389
- }
390
-
391
- static void fbuffer_append_long(FBuffer *fb, long number)
392
- {
393
- char buf[20];
394
- unsigned long len = fltoa(number, buf);
395
- fbuffer_append(fb, buf, len);
396
- }
397
-
398
- static FBuffer *fbuffer_dup(FBuffer *fb)
399
- {
400
- unsigned long len = fb->len;
401
- FBuffer *result;
402
-
403
- if (len > 0) {
404
- result = fbuffer_alloc_with_length(len);
405
- fbuffer_append(result, FBUFFER_PAIR(fb));
406
- } else {
407
- result = fbuffer_alloc();
408
- }
409
- return result;
410
- }
411
-
412
297
  /*
413
298
  * Document-module: JSON::Ext::Generator
414
299
  *
@@ -694,6 +579,16 @@ static VALUE cState_configure(VALUE self, VALUE opts)
694
579
  state->depth = 0;
695
580
  }
696
581
  }
582
+ tmp = ID2SYM(i_buffer_initial_length);
583
+ if (option_given_p(opts, tmp)) {
584
+ VALUE buffer_initial_length = rb_hash_aref(opts, tmp);
585
+ if (RTEST(buffer_initial_length)) {
586
+ long initial_length;
587
+ Check_Type(buffer_initial_length, T_FIXNUM);
588
+ initial_length = FIX2LONG(buffer_initial_length);
589
+ if (initial_length > 0) state->buffer_initial_length = initial_length;
590
+ }
591
+ }
697
592
  tmp = rb_hash_aref(opts, ID2SYM(i_allow_nan));
698
593
  state->allow_nan = RTEST(tmp);
699
594
  tmp = rb_hash_aref(opts, ID2SYM(i_ascii_only));
@@ -723,6 +618,7 @@ static VALUE cState_to_h(VALUE self)
723
618
  rb_hash_aset(result, ID2SYM(i_quirks_mode), state->quirks_mode ? Qtrue : Qfalse);
724
619
  rb_hash_aset(result, ID2SYM(i_max_nesting), LONG2FIX(state->max_nesting));
725
620
  rb_hash_aset(result, ID2SYM(i_depth), LONG2FIX(state->depth));
621
+ rb_hash_aset(result, ID2SYM(i_buffer_initial_length), LONG2FIX(state->buffer_initial_length));
726
622
  return result;
727
623
  }
728
624
 
@@ -920,19 +816,20 @@ static void generate_json(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *s
920
816
 
921
817
  static FBuffer *cState_prepare_buffer(VALUE self)
922
818
  {
923
- FBuffer *buffer = fbuffer_alloc();
819
+ FBuffer *buffer;
924
820
  GET_STATE(self);
821
+ buffer = fbuffer_alloc(state->buffer_initial_length);
925
822
 
926
823
  if (state->object_delim) {
927
824
  fbuffer_clear(state->object_delim);
928
825
  } else {
929
- state->object_delim = fbuffer_alloc_with_length(16);
826
+ state->object_delim = fbuffer_alloc(16);
930
827
  }
931
828
  fbuffer_append_char(state->object_delim, ',');
932
829
  if (state->object_delim2) {
933
830
  fbuffer_clear(state->object_delim2);
934
831
  } else {
935
- state->object_delim2 = fbuffer_alloc_with_length(16);
832
+ state->object_delim2 = fbuffer_alloc(16);
936
833
  }
937
834
  fbuffer_append_char(state->object_delim2, ':');
938
835
  if (state->space) fbuffer_append(state->object_delim2, state->space, state->space_len);
@@ -940,21 +837,13 @@ static FBuffer *cState_prepare_buffer(VALUE self)
940
837
  if (state->array_delim) {
941
838
  fbuffer_clear(state->array_delim);
942
839
  } else {
943
- state->array_delim = fbuffer_alloc_with_length(16);
840
+ state->array_delim = fbuffer_alloc(16);
944
841
  }
945
842
  fbuffer_append_char(state->array_delim, ',');
946
843
  if (state->array_nl) fbuffer_append(state->array_delim, state->array_nl, state->array_nl_len);
947
844
  return buffer;
948
845
  }
949
846
 
950
- static VALUE fbuffer_to_s(FBuffer *fb)
951
- {
952
- VALUE result = rb_str_new(FBUFFER_PAIR(fb));
953
- fbuffer_free(fb);
954
- FORCE_UTF8(result);
955
- return result;
956
- }
957
-
958
847
  static VALUE cState_partial_generate(VALUE self, VALUE obj)
959
848
  {
960
849
  FBuffer *buffer = cState_prepare_buffer(self);
@@ -1003,12 +892,15 @@ static VALUE cState_generate(VALUE self, VALUE obj)
1003
892
  * encountered. This options defaults to false.
1004
893
  * * *quirks_mode*: Enables quirks_mode for parser, that is for example
1005
894
  * generating single JSON values instead of documents is possible.
895
+ * * *buffer_initial_length*: sets the initial length of the generator's
896
+ * internal buffer.
1006
897
  */
1007
898
  static VALUE cState_initialize(int argc, VALUE *argv, VALUE self)
1008
899
  {
1009
900
  VALUE opts;
1010
901
  GET_STATE(self);
1011
902
  state->max_nesting = 19;
903
+ state->buffer_initial_length = FBUFFER_INITIAL_LENGTH_DEFAULT;
1012
904
  rb_scan_args(argc, argv, "01", &opts);
1013
905
  if (!NIL_P(opts)) cState_configure(self, opts);
1014
906
  return self;
@@ -1349,7 +1241,37 @@ static VALUE cState_depth_set(VALUE self, VALUE depth)
1349
1241
  {
1350
1242
  GET_STATE(self);
1351
1243
  Check_Type(depth, T_FIXNUM);
1352
- return state->depth = FIX2LONG(depth);
1244
+ state->depth = FIX2LONG(depth);
1245
+ return Qnil;
1246
+ }
1247
+
1248
+ /*
1249
+ * call-seq: buffer_initial_length
1250
+ *
1251
+ * This integer returns the current inital length of the buffer.
1252
+ */
1253
+ static VALUE cState_buffer_initial_length(VALUE self)
1254
+ {
1255
+ GET_STATE(self);
1256
+ return LONG2FIX(state->buffer_initial_length);
1257
+ }
1258
+
1259
+ /*
1260
+ * call-seq: buffer_initial_length=(length)
1261
+ *
1262
+ * This sets the initial length of the buffer to +length+, if +length+ > 0,
1263
+ * otherwise its value isn't changed.
1264
+ */
1265
+ static VALUE cState_buffer_initial_length_set(VALUE self, VALUE buffer_initial_length)
1266
+ {
1267
+ long initial_length;
1268
+ GET_STATE(self);
1269
+ Check_Type(buffer_initial_length, T_FIXNUM);
1270
+ initial_length = FIX2LONG(buffer_initial_length);
1271
+ if (initial_length > 0) {
1272
+ state->buffer_initial_length = initial_length;
1273
+ }
1274
+ return Qnil;
1353
1275
  }
1354
1276
 
1355
1277
  /*
@@ -1391,6 +1313,8 @@ void Init_generator()
1391
1313
  rb_define_method(cState, "quirks_mode=", cState_quirks_mode_set, 1);
1392
1314
  rb_define_method(cState, "depth", cState_depth, 0);
1393
1315
  rb_define_method(cState, "depth=", cState_depth_set, 1);
1316
+ rb_define_method(cState, "buffer_initial_length", cState_buffer_initial_length, 0);
1317
+ rb_define_method(cState, "buffer_initial_length=", cState_buffer_initial_length_set, 1);
1394
1318
  rb_define_method(cState, "configure", cState_configure, 1);
1395
1319
  rb_define_alias(cState, "merge", "configure");
1396
1320
  rb_define_method(cState, "to_h", cState_to_h, 0);
@@ -1438,6 +1362,7 @@ void Init_generator()
1438
1362
  i_ascii_only = rb_intern("ascii_only");
1439
1363
  i_quirks_mode = rb_intern("quirks_mode");
1440
1364
  i_depth = rb_intern("depth");
1365
+ i_buffer_initial_length = rb_intern("buffer_initial_length");
1441
1366
  i_pack = rb_intern("pack");
1442
1367
  i_unpack = rb_intern("unpack");
1443
1368
  i_create_id = rb_intern("create_id");