summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-06-14 16:50:46 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2014-06-14 16:50:46 -0700
commit8f640b6d665926c6687d6138c8f6485b43c3a857 (patch)
tree1d5046f068b8bcbb19b839b61ba5d3b357302e5a /ext
parent4d056c20768cb8e5a8169ee5d6bf46fc82e19f19 (diff)
downloadffi-yajl-8f640b6d665926c6687d6138c8f6485b43c3a857.tar.gz
support yajl parser options
Diffstat (limited to 'ext')
-rw-r--r--ext/ffi_yajl/ext/parser/parser.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/ext/ffi_yajl/ext/parser/parser.c b/ext/ffi_yajl/ext/parser/parser.c
index 5100e2d..e2481cd 100644
--- a/ext/ffi_yajl/ext/parser/parser.c
+++ b/ext/ffi_yajl/ext/parser/parser.c
@@ -186,9 +186,21 @@ static VALUE mParser_do_yajl_parse(VALUE self, VALUE str, VALUE yajl_opts) {
hand = yajl_alloc(&callbacks, NULL, (void *)&ctx);
- if (rb_hash_aref(yajl_opts, ID2SYM(rb_intern("yajl_allow_comments")))) {
+ if (rb_hash_aref(yajl_opts, ID2SYM(rb_intern("yajl_allow_comments"))) == Qtrue) {
yajl_config(hand, yajl_allow_comments, 1);
}
+ if (rb_hash_aref(yajl_opts, ID2SYM(rb_intern("yajl_dont_validate_strings"))) == Qtrue) {
+ yajl_config(hand, yajl_dont_validate_strings, 1);
+ }
+ if (rb_hash_aref(yajl_opts, ID2SYM(rb_intern("yajl_allow_trailing_garbage"))) == Qtrue) {
+ yajl_config(hand, yajl_allow_trailing_garbage, 1);
+ }
+ if (rb_hash_aref(yajl_opts, ID2SYM(rb_intern("yajl_allow_multiple_values"))) == Qtrue) {
+ yajl_config(hand, yajl_allow_multiple_values, 1);
+ }
+ if (rb_hash_aref(yajl_opts, ID2SYM(rb_intern("yajl_allow_partial_values"))) == Qtrue) {
+ yajl_config(hand, yajl_allow_partial_values, 1);
+ }
if ((stat = yajl_parse(hand, (unsigned char *)RSTRING_PTR(str), RSTRING_LEN(str))) != yajl_status_ok) {
err = yajl_get_error(hand, 1, (unsigned char *)RSTRING_PTR(str), RSTRING_LEN(str));