diff options
author | John Hawthorn <john@hawthorn.email> | 2020-01-02 11:48:03 -0800 |
---|---|---|
committer | Aaron Patterson <tenderlove@github.com> | 2020-01-13 13:58:23 -0800 |
commit | 5f3189474c3ee3e11b6588acfbb026e119522092 (patch) | |
tree | 9547c3c2682e4d9087fccebe4c7758f9ba9dcd7f | |
parent | c2e45422f7abc9836d3b68bb94e527b3aad9bfd7 (diff) | |
download | ruby-5f3189474c3ee3e11b6588acfbb026e119522092.tar.gz |
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.
-rw-r--r-- | time.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -2923,6 +2923,10 @@ month_arg(VALUE arg) { int i, mon; + if (FIXNUM_P(arg)) { + return obj2ubits(arg, 4); + } + VALUE s = rb_check_string_type(arg); if (!NIL_P(s) && RSTRING_LEN(s) > 0) { mon = 0; |