ext/oj/object.c in oj-3.13.15 vs ext/oj/object.c in oj-3.13.16
- old
+ new
@@ -443,11 +443,11 @@
__LINE__,
"can not add attributes to a %s",
rb_class2name(rb_obj_class(parent->val)));
return;
}
- if (Yes == pi->options.trace) {
+ if (RB_UNLIKELY(Yes == pi->options.trace)) {
oj_trace_parse_call("set_string", pi, __FILE__, __LINE__, rval);
}
}
static void hash_set_num(ParseInfo pi, Val kval, NumInfo ni) {
@@ -514,11 +514,11 @@
__LINE__,
"can not add attributes to a %s",
rb_class2name(rb_obj_class(parent->val)));
return;
}
- if (Yes == pi->options.trace) {
+ if (RB_UNLIKELY(Yes == pi->options.trace)) {
oj_trace_parse_call("add_number", pi, __FILE__, __LINE__, rval);
}
}
static void hash_set_value(ParseInfo pi, Val kval, VALUE value) {
@@ -600,17 +600,17 @@
__LINE__,
"can not add attributes to a %s",
rb_class2name(rb_obj_class(parent->val)));
return;
}
- if (Yes == pi->options.trace) {
+ if (RB_UNLIKELY(Yes == pi->options.trace)) {
oj_trace_parse_call("add_value", pi, __FILE__, __LINE__, value);
}
}
static VALUE start_hash(ParseInfo pi) {
- if (Yes == pi->options.trace) {
+ if (RB_UNLIKELY(Yes == pi->options.trace)) {
oj_trace_parse_in("start_hash", pi, __FILE__, __LINE__);
}
return Qnil;
}
@@ -624,11 +624,11 @@
parent->val = rb_funcall2(oa->odd->create_obj, oa->odd->create_op, oa->odd->attr_cnt, oa->args);
oj_odd_free(oa);
parent->odd_args = NULL;
}
- if (Yes == pi->options.trace) {
+ if (RB_UNLIKELY(Yes == pi->options.trace)) {
oj_trace_parse_hash_end(pi, __FILE__, __LINE__);
}
}
static void array_append_cstr(ParseInfo pi, const char *str, size_t len, const char *orig) {
@@ -652,33 +652,33 @@
}
}
}
rval = str_to_value(pi, str, len, orig);
rb_ary_push(stack_peek(&pi->stack)->val, rval);
- if (Yes == pi->options.trace) {
+ if (RB_UNLIKELY(Yes == pi->options.trace)) {
oj_trace_parse_call("append_string", pi, __FILE__, __LINE__, rval);
}
}
static void array_append_num(ParseInfo pi, NumInfo ni) {
volatile VALUE rval = oj_num_as_value(ni);
rb_ary_push(stack_peek(&pi->stack)->val, rval);
- if (Yes == pi->options.trace) {
+ if (RB_UNLIKELY(Yes == pi->options.trace)) {
oj_trace_parse_call("append_number", pi, __FILE__, __LINE__, rval);
}
}
static void add_cstr(ParseInfo pi, const char *str, size_t len, const char *orig) {
pi->stack.head->val = str_to_value(pi, str, len, orig);
- if (Yes == pi->options.trace) {
+ if (RB_UNLIKELY(Yes == pi->options.trace)) {
oj_trace_parse_call("add_string", pi, __FILE__, __LINE__, pi->stack.head->val);
}
}
static void add_num(ParseInfo pi, NumInfo ni) {
pi->stack.head->val = oj_num_as_value(ni);
- if (Yes == pi->options.trace) {
+ if (RB_UNLIKELY(Yes == pi->options.trace)) {
oj_trace_parse_call("add_num", pi, __FILE__, __LINE__, pi->stack.head->val);
}
}
void oj_set_object_callbacks(ParseInfo pi) {