Commit 96c24b0a authored by cubicdaiya's avatar cubicdaiya

small-optimization2 for mrb_time_zone

mrb_str_new_static is more efficient than mrb_str_new in this case.
parent 985e4892
......@@ -406,7 +406,7 @@ mrb_time_zone(mrb_state *mrb, mrb_value self)
tm = DATA_GET_PTR(mrb, self, &mrb_time_type, struct mrb_time);
if (tm->timezone <= MRB_TIMEZONE_NONE) return mrb_nil_value();
if (tm->timezone >= MRB_TIMEZONE_LAST) return mrb_nil_value();
return mrb_str_new(mrb,
return mrb_str_new_static(mrb,
timezone_names[tm->timezone].name,
timezone_names[tm->timezone].len);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment