summaryrefslogtreecommitdiff
path: root/ext/json/parser/parser.h
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2024-10-17 19:36:48 +0200
committerHiroshi SHIBATA <[email protected]>2024-10-18 11:28:12 +0900
commitc4d4c6b84683f0b5f9a84f29060a40823f3f5fe2 (patch)
treead980876350999f995d283b335196fd0d1204207 /ext/json/parser/parser.h
parent5152f81fffca7a5f65ed874603a9761771721029 (diff)
[ruby/json] Speedup Parser initialization
Extracted from: https://github.com/ruby/json/pull/512 Use `rb_hash_lookup2` to check for hash key existence instead of going through `rb_funcall`. https://github.com/ruby/json/commit/43835a0d13 Co-Authored-By: lukeg <[email protected]>
Diffstat (limited to 'ext/json/parser/parser.h')
-rw-r--r--ext/json/parser/parser.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/json/parser/parser.h b/ext/json/parser/parser.h
index e11bddf7c2..9c7f0e7d21 100644
--- a/ext/json/parser/parser.h
+++ b/ext/json/parser/parser.h
@@ -7,7 +7,7 @@
# define MAYBE_UNUSED(x) x
#endif
-#define option_given_p(opts, key) RTEST(rb_funcall(opts, i_key_p, 1, key))
+#define option_given_p(opts, key) (rb_hash_lookup2(opts, key, Qundef) != Qundef)
typedef struct JSON_ParserStruct {
VALUE Vsource;