summaryrefslogtreecommitdiffhomepage
path: root/src/range.c
diff options
context:
space:
mode:
authorMasaki Muranaka <[email protected]>2012-06-22 16:46:37 +0900
committerMasaki Muranaka <[email protected]>2012-06-22 17:02:08 +0900
commit21f2e5364b5c6cda244001d779aa67d86a22e6e7 (patch)
tree43f633af01bc9583a176567667c2341be206f858 /src/range.c
parent8946ad2c029671c70c980df984d9d48ac47b1dde (diff)
downloadmruby-21f2e5364b5c6cda244001d779aa67d86a22e6e7.tar.gz
mruby-21f2e5364b5c6cda244001d779aa67d86a22e6e7.zip
Use mrb_str_new() instead of mrb_str_new2() as possible.
Diffstat (limited to 'src/range.c')
-rw-r--r--src/range.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/range.c b/src/range.c
index 826481e93..859bb277e 100644
--- a/src/range.c
+++ b/src/range.c
@@ -343,7 +343,12 @@ inspect_range(mrb_state *mrb, mrb_value range, mrb_value dummy, int recur)
struct RRange *r = mrb_range_ptr(range);
if (recur) {
- return mrb_str_new2(mrb, r->excl ? "(... ... ...)" : "(... .. ...)");
+ static const char s[2][14] = { "(... ... ...)", "(... .. ...)" };
+ static const int n[] = { 13, 12 };
+ int idx;
+
+ idx = (r->excl) ? 0 : 1;
+ return mrb_str_new(mrb, s[idx], n[idx]);
}
str = mrb_inspect(mrb, r->edges->beg);
str2 = mrb_inspect(mrb, r->edges->end);