diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-05-20 23:37:36 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-05-21 16:51:47 -0700 |
commit | 8e629ff434d89810db5682216773576e5a345702 (patch) | |
tree | a5aa7de08d290850f8b53270a65fe9aa29156648 /sv.c | |
parent | 52fc5c56ccd9c6bab20246b4f80f558b71ad5d42 (diff) | |
download | perl-8e629ff434d89810db5682216773576e5a345702.tar.gz |
Don’t stringify GV in numeric cx outside warnings scope
The GV is only stringified for the sake of the warning message, so
there is no point in wasting CPU cycle if it will be unused.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1818,16 +1818,16 @@ Perl_looks_like_number(pTHX_ SV *const sv) STATIC bool S_glob_2number(pTHX_ GV * const gv) { - SV *const buffer = sv_newmortal(); - PERL_ARGS_ASSERT_GLOB_2NUMBER; - gv_efullname3(buffer, gv, "*"); - /* We know that all GVs stringify to something that is not-a-number, so no need to test that. */ if (ckWARN(WARN_NUMERIC)) + { + SV *const buffer = sv_newmortal(); + gv_efullname3(buffer, gv, "*"); not_a_number(buffer); + } /* We just want something true to return, so that S_sv_2iuv_common can tail call us and return true. */ return TRUE; |