string.c: remove unnecessary size check before string initialization.

This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-03-02 15:49:01 +09:00
parent a9bde42641
commit 1a9991f165
-6
View File
@@ -111,9 +111,6 @@ str_new_static(mrb_state *mrb, const char *p, mrb_int len)
if (RSTR_EMBEDDABLE_P(len)) {
return str_init_embed(mrb_obj_alloc_string(mrb), p, len);
}
if (len >= MRB_SSIZE_MAX) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "string size too big");
}
return str_init_nofree(mrb_obj_alloc_string(mrb), p, len);
}
@@ -123,9 +120,6 @@ str_new(mrb_state *mrb, const char *p, mrb_int len)
if (RSTR_EMBEDDABLE_P(len)) {
return str_init_embed(mrb_obj_alloc_string(mrb), p, len);
}
if (len >= MRB_SSIZE_MAX) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "string size too big");
}
if (p && mrb_ro_data_p(p)) {
return str_init_nofree(mrb_obj_alloc_string(mrb), p, len);
}