mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
string.c: remove unnecessary size check before string initialization.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user