Commit d44035f2 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #2194 from suzukaze/refactor-string.c2

Refactor string.c
parents 1ce9060f 06e56a50
......@@ -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 */
......
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