summaryrefslogtreecommitdiffhomepage
path: root/src/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/string.c')
-rw-r--r--src/string.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/string.c b/src/string.c
index 3876bc569..d5a849cec 100644
--- a/src/string.c
+++ b/src/string.c
@@ -1230,8 +1230,6 @@ mrb_str_subseq(mrb_state *mrb, mrb_value str, mrb_int beg, mrb_int len)
mrb_value
mrb_str_substr(mrb_state *mrb, mrb_value str, mrb_int beg, mrb_int len)
{
- mrb_value str2;
-
if (len < 0) return mrb_nil_value();
if (!RSTRING_LEN(str)) {
len = 0;
@@ -1246,9 +1244,7 @@ mrb_str_substr(mrb_state *mrb, mrb_value str, mrb_int beg, mrb_int len)
if (len <= 0) {
len = 0;
}
- str2 = mrb_str_subseq(mrb, str, beg, len);
-
- return str2;
+ return mrb_str_subseq(mrb, str, beg, len);
}
mrb_int
@@ -1264,8 +1260,7 @@ mrb_str_hash(mrb_state *mrb, mrb_value str)
key = key*65599 + *p;
p++;
}
- key = key + (key>>5);
- return key;
+ return key + (key>>5);
}
/* 15.2.10.5.20 */