summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-05-20 23:37:36 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-05-21 16:51:47 -0700
commit8e629ff434d89810db5682216773576e5a345702 (patch)
treea5aa7de08d290850f8b53270a65fe9aa29156648 /sv.c
parent52fc5c56ccd9c6bab20246b4f80f558b71ad5d42 (diff)
downloadperl-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.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sv.c b/sv.c
index 3ac2fd8d3e..0c940cb434 100644
--- a/sv.c
+++ b/sv.c
@@ -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;