summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-time
diff options
context:
space:
mode:
authorcubicdaiya <[email protected]>2014-02-25 15:24:02 +0900
committercubicdaiya <[email protected]>2014-02-25 15:24:02 +0900
commit96c24b0a37d55dad37a80f408c466dfb2285faaf (patch)
tree7552539a82e87368113cbda737f2699227959803 /mrbgems/mruby-time
parent985e4892cfcad52168af55b3b2ebc2c7e6a3b414 (diff)
downloadmruby-96c24b0a37d55dad37a80f408c466dfb2285faaf.tar.gz
mruby-96c24b0a37d55dad37a80f408c466dfb2285faaf.zip
small-optimization2 for mrb_time_zone
mrb_str_new_static is more efficient than mrb_str_new in this case.
Diffstat (limited to 'mrbgems/mruby-time')
-rw-r--r--mrbgems/mruby-time/src/time.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mrbgems/mruby-time/src/time.c b/mrbgems/mruby-time/src/time.c
index 7f513624f..a13af790b 100644
--- a/mrbgems/mruby-time/src/time.c
+++ b/mrbgems/mruby-time/src/time.c
@@ -406,9 +406,9 @@ 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,
- timezone_names[tm->timezone].name,
- timezone_names[tm->timezone].len);
+ return mrb_str_new_static(mrb,
+ timezone_names[tm->timezone].name,
+ timezone_names[tm->timezone].len);
}
/* 15.2.19.7.4 */