This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
util.c:report_wrongway_fh: Don’t create an SV
authorFather Chrysostomos <sprout@cpan.org>
Fri, 25 May 2012 05:16:52 +0000 (22:16 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 7 Jun 2012 15:18:51 +0000 (08:18 -0700)
Now that sv_vcatpvfn supports HEKs directly, we don’t need to create a
temporary SV out of one.

util.c

diff --git a/util.c b/util.c
index acde398..c080dc0 100644 (file)
--- a/util.c
+++ b/util.c
@@ -3716,15 +3716,15 @@ void
 Perl_report_wrongway_fh(pTHX_ const GV *gv, const char have)
 {
     if (ckWARN(WARN_IO)) {
-        SV * const name
+        HEK * const name
            = gv && (isGV_with_GP(gv))
-                ? sv_2mortal(newSVhek(GvENAME_HEK((gv))))
+                ? GvENAME_HEK((gv))
                 : NULL;
        const char * const direction = have == '>' ? "out" : "in";
 
-       if (name && SvPOK(name) && *SvPV_nolen(name))
+       if (name && *HEK_KEY(name))
            Perl_warner(aTHX_ packWARN(WARN_IO),
-                       "Filehandle %"SVf" opened only for %sput",
+                       "Filehandle %"HEKf" opened only for %sput",
                        name, direction);
        else
            Perl_warner(aTHX_ packWARN(WARN_IO),