Avoid rb_check_string_type in month_arg
This will usually receive a fixnum so we should check that first instead of the more expensive rb_check_string_type check.
This commit is contained in:
parent
c2e45422f7
commit
5f3189474c
Notes:
git
2020-01-14 06:58:59 +09:00
4
time.c
4
time.c
@ -2923,6 +2923,10 @@ month_arg(VALUE arg)
|
|||||||
{
|
{
|
||||||
int i, mon;
|
int i, mon;
|
||||||
|
|
||||||
|
if (FIXNUM_P(arg)) {
|
||||||
|
return obj2ubits(arg, 4);
|
||||||
|
}
|
||||||
|
|
||||||
VALUE s = rb_check_string_type(arg);
|
VALUE s = rb_check_string_type(arg);
|
||||||
if (!NIL_P(s) && RSTRING_LEN(s) > 0) {
|
if (!NIL_P(s) && RSTRING_LEN(s) > 0) {
|
||||||
mon = 0;
|
mon = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user