Skip to content

Commit 74310e8

Browse files
committed
Check for rb_interned_str
1 parent 84d7c8a commit 74310e8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

ext/rapidjson/extconf.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@
1414
$LDFLAGS += " -fsanitize=address"
1515
end
1616

17+
have_func("rb_interned_str", "ruby.h")
18+
1719
create_makefile("rapidjson/rapidjson")

ext/rapidjson/parser.hh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ struct RubyObjectHandler : public BaseReaderHandler<UTF8<>, RubyObjectHandler> {
4343
}
4444

4545
bool Key(const char* str, SizeType length, bool copy) {
46-
// FIXME: check for availability of rb_interned_str
46+
#ifdef HAVE_RB_INTERNED_STR
4747
VALUE val = rb_interned_str(str, length);
48+
#else
49+
VALUE val = rb_str_new(str, length);
50+
#endif
4851
return PutKey(val);
4952
}
5053

0 commit comments

Comments
 (0)