Skip to content

Commit 0bce099

Browse files
byrootluke-gru
andcommitted
Speedup Parser initialization
Extracted from: #512 Use `rb_hash_lookup2` to check for hash key existence instead of going through `rb_funcall`. Co-Authored-By: lukeg <luke.gru@gmail.com>
1 parent 8713aa4 commit 0bce099

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/json/ext/parser/parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# define MAYBE_UNUSED(x) x
88
#endif
99

10-
#define option_given_p(opts, key) RTEST(rb_funcall(opts, i_key_p, 1, key))
10+
#define option_given_p(opts, key) (!RB_UNDEF_P(rb_hash_lookup2(opts, key, Qundef)))
1111

1212
typedef struct JSON_ParserStruct {
1313
VALUE Vsource;

0 commit comments

Comments
 (0)