This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Argument op to report_evil_fh() is always PL_op->op_type, so need not be passed
authorNicholas Clark <nick@ccl4.org>
Tue, 28 Dec 2010 09:09:44 +0000 (09:09 +0000)
committerNicholas Clark <nick@ccl4.org>
Tue, 28 Dec 2010 10:03:48 +0000 (10:03 +0000)
doio.c
embed.fnc
embed.h
pp_hot.c
pp_sys.c
proto.h
util.c

diff --git a/doio.c b/doio.c
index ba737c5..0518bae 100644 (file)
--- a/doio.c
+++ b/doio.c
@@ -930,7 +930,7 @@ Perl_do_close(pTHX_ GV *gv, bool not_implicit)
     if (!io) {         /* never opened */
        if (not_implicit) {
            if (ckWARN(WARN_UNOPENED)) /* no check for closed here */
-               report_evil_fh(gv, PL_op->op_type);
+               report_evil_fh(gv);
            SETERRNO(EBADF,SS_IVCHAN);
        }
        return FALSE;
@@ -1048,7 +1048,7 @@ Perl_do_tell(pTHX_ GV *gv)
        return PerlIO_tell(fp);
     }
     if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
-       report_evil_fh(gv, PL_op->op_type);
+       report_evil_fh(gv);
     SETERRNO(EBADF,RMS_IFI);
     return (Off_t)-1;
 }
@@ -1068,7 +1068,7 @@ Perl_do_seek(pTHX_ GV *gv, Off_t pos, int whence)
        return PerlIO_seek(fp, pos, whence) >= 0;
     }
     if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
-       report_evil_fh(gv, PL_op->op_type);
+       report_evil_fh(gv);
     SETERRNO(EBADF,RMS_IFI);
     return FALSE;
 }
@@ -1085,7 +1085,7 @@ Perl_do_sysseek(pTHX_ GV *gv, Off_t pos, int whence)
     if (gv && (io = GvIO(gv)) && (fp = IoIFP(io)))
        return PerlLIO_lseek(PerlIO_fileno(fp), pos, whence);
     if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
-       report_evil_fh(gv, PL_op->op_type);
+       report_evil_fh(gv);
     SETERRNO(EBADF,RMS_IFI);
     return (Off_t)-1;
 }
@@ -1285,12 +1285,12 @@ Perl_my_stat_flags(pTHX_ const U32 flags)
                 return (PL_laststatval = PerlLIO_fstat(my_dirfd(IoDIRP(io)), &PL_statcache));
             } else {
                 if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
-                    report_evil_fh(gv, PL_op->op_type);
+                    report_evil_fh(gv);
                 return (PL_laststatval = -1);
             }
        } else {
             if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
-                report_evil_fh(gv, PL_op->op_type);
+                report_evil_fh(gv);
             return (PL_laststatval = -1);
         }
     }
index 3aad10f..ab95766 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -1343,7 +1343,7 @@ Ap        |U32    |seed
 : Only used in perl.c
 pR     |UV     |get_hash_seed
 : Used in doio.c, pp_hot.c, pp_sys.c
-p      |void   |report_evil_fh |NULLOK const GV *gv|I32 op
+p      |void   |report_evil_fh |NULLOK const GV *gv
 : Used in doio.c, pp_hot.c, pp_sys.c
 p      |void   |report_wrongway_fh|NULLOK const GV *gv|const char have
 : Used in mg.c, pp.c, pp_hot.c, regcomp.c
diff --git a/embed.h b/embed.h
index 749f928..083588e 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define refcounted_he_new_pv(a,b,c,d,e)        Perl_refcounted_he_new_pv(aTHX_ a,b,c,d,e)
 #define refcounted_he_new_pvn(a,b,c,d,e,f)     Perl_refcounted_he_new_pvn(aTHX_ a,b,c,d,e,f)
 #define refcounted_he_new_sv(a,b,c,d,e)        Perl_refcounted_he_new_sv(aTHX_ a,b,c,d,e)
-#define report_evil_fh(a,b)    Perl_report_evil_fh(aTHX_ a,b)
+#define report_evil_fh(a)      Perl_report_evil_fh(aTHX_ a)
 #define report_wrongway_fh(a,b)        Perl_report_wrongway_fh(aTHX_ a,b)
 #define rpeep(a)               Perl_rpeep(aTHX_ a)
 #define rsignal_restore(a,b)   Perl_rsignal_restore(aTHX_ a,b)
index 6c166f6..9e8b2dc 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -751,7 +751,7 @@ PP(pp_print)
            && (mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar)))
             goto had_magic;
        if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
-           report_evil_fh(gv, PL_op->op_type);
+           report_evil_fh(gv);
        SETERRNO(EBADF,RMS_IFI);
        goto just_say_no;
     }
@@ -760,7 +760,7 @@ PP(pp_print)
            if (IoIFP(io))
                report_wrongway_fh(gv, '<');
            else if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
-               report_evil_fh(gv, PL_op->op_type);
+               report_evil_fh(gv);
        }
        SETERRNO(EBADF,IoIFP(io)?RMS_FAC:RMS_IFI);
        goto just_say_no;
@@ -1637,7 +1637,7 @@ Perl_do_readline(pTHX)
                            "glob failed (can't start child: %s)",
                            Strerror(errno));
            else
-               report_evil_fh(PL_last_in_gv, PL_op->op_type);
+               report_evil_fh(PL_last_in_gv);
        }
        if (gimme == G_SCALAR) {
            /* undef TARG, and push that undefined value */
index c70c90d..8737169 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -700,7 +700,7 @@ PP(pp_fileno)
        /* Can't do this because people seem to do things like
           defined(fileno($foo)) to check whether $foo is a valid fh.
          if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
-             report_evil_fh(gv, PL_op->op_type);
+             report_evil_fh(gv);
            */
        RETPUSHUNDEF;
     }
@@ -773,7 +773,7 @@ PP(pp_binmode)
 
     if (!(io = GvIO(gv)) || !(fp = IoIFP(io))) {
        if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
-           report_evil_fh(gv, PL_op->op_type);
+           report_evil_fh(gv);
        SETERRNO(EBADF,RMS_IFI);
         RETPUSHUNDEF;
     }
@@ -1261,7 +1261,7 @@ PP(pp_getc)
     if (!gv || do_eof(gv)) { /* make sure we have fp with something */
        if ((!io || (!IoIFP(io) && IoTYPE(io) != IoTYPE_WRONLY))
          && ckWARN2(WARN_UNOPENED,WARN_CLOSED))
-           report_evil_fh(gv, PL_op->op_type);
+           report_evil_fh(gv);
        SETERRNO(EBADF,RMS_IFI);
        RETPUSHUNDEF;
     }
@@ -1453,7 +1453,7 @@ PP(pp_leavewrite)
            if (IoIFP(io))
                report_wrongway_fh(gv, '<');
            else if (ckWARN(WARN_CLOSED))
-               report_evil_fh(gv, PL_op->op_type);
+               report_evil_fh(gv);
        }
        PUSHs(&PL_sv_no);
     }
@@ -1512,7 +1512,7 @@ PP(pp_prtf)
     sv = newSV(0);
     if (!(io = GvIO(gv))) {
        if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
-           report_evil_fh(gv, PL_op->op_type);
+           report_evil_fh(gv);
        SETERRNO(EBADF,RMS_IFI);
        goto just_say_no;
     }
@@ -1521,7 +1521,7 @@ PP(pp_prtf)
            if (IoIFP(io))
                report_wrongway_fh(gv, '<');
            else if (ckWARN(WARN_CLOSED))
-               report_evil_fh(gv, PL_op->op_type);
+               report_evil_fh(gv);
        }
        SETERRNO(EBADF,IoIFP(io)?RMS_FAC:RMS_IFI);
        goto just_say_no;
@@ -1621,7 +1621,7 @@ PP(pp_sysread)
     io = GvIO(gv);
     if (!io || !IoIFP(io)) {
        if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
-           report_evil_fh(gv, PL_op->op_type);
+           report_evil_fh(gv);
        SETERRNO(EBADF,RMS_IFI);
        goto say_undef;
     }
@@ -1868,7 +1868,7 @@ PP(pp_send)
            if (io && IoIFP(io))
                report_wrongway_fh(gv, '<');
            else
-               report_evil_fh(gv, PL_op->op_type);
+               report_evil_fh(gv);
        }
        SETERRNO(EBADF,RMS_IFI);
        goto say_undef;
@@ -2286,7 +2286,7 @@ PP(pp_ioctl)
 
     if (!io || !argsv || !IoIFP(io)) {
        if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
-           report_evil_fh(gv, PL_op->op_type);
+           report_evil_fh(gv);
        SETERRNO(EBADF,RMS_IFI);        /* well, sort of... */
        RETPUSHUNDEF;
     }
@@ -2371,7 +2371,7 @@ PP(pp_flock)
     }
     else {
        if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
-           report_evil_fh(gv, PL_op->op_type);
+           report_evil_fh(gv);
        value = 0;
        SETERRNO(EBADF,RMS_IFI);
     }
@@ -2397,7 +2397,7 @@ PP(pp_socket)
 
     if (!gv || !io) {
        if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
-           report_evil_fh(gv, PL_op->op_type);
+           report_evil_fh(gv);
        if (io && IoIFP(io))
            do_close(gv, FALSE);
        SETERRNO(EBADF,LIB_INVARG);
@@ -2450,9 +2450,9 @@ PP(pp_sockpair)
     if (!gv1 || !gv2 || !io1 || !io2) {
        if (ckWARN2(WARN_UNOPENED,WARN_CLOSED)) {
            if (!gv1 || !io1)
-               report_evil_fh(gv1, PL_op->op_type);
+               report_evil_fh(gv1);
            if (!gv2 || !io2)
-               report_evil_fh(gv2, PL_op->op_type);
+               report_evil_fh(gv2);
        }
     }
 
@@ -2516,7 +2516,7 @@ PP(pp_bind)
 
 nuts:
     if (ckWARN(WARN_CLOSED))
-       report_evil_fh(gv, PL_op->op_type);
+       report_evil_fh(gv);
     SETERRNO(EBADF,SS_IVCHAN);
     RETPUSHUNDEF;
 #else
@@ -2546,7 +2546,7 @@ PP(pp_connect)
 
 nuts:
     if (ckWARN(WARN_CLOSED))
-       report_evil_fh(gv, PL_op->op_type);
+       report_evil_fh(gv);
     SETERRNO(EBADF,SS_IVCHAN);
     RETPUSHUNDEF;
 #else
@@ -2572,7 +2572,7 @@ PP(pp_listen)
 
 nuts:
     if (ckWARN(WARN_CLOSED))
-       report_evil_fh(gv, PL_op->op_type);
+       report_evil_fh(gv);
     SETERRNO(EBADF,SS_IVCHAN);
     RETPUSHUNDEF;
 #else
@@ -2648,7 +2648,7 @@ PP(pp_accept)
 
 nuts:
     if (ckWARN(WARN_CLOSED))
-       report_evil_fh(ggv, PL_op->op_type);
+       report_evil_fh(ggv);
     SETERRNO(EBADF,SS_IVCHAN);
 
 badexit:
@@ -2675,7 +2675,7 @@ PP(pp_shutdown)
 
 nuts:
     if (ckWARN(WARN_CLOSED))
-       report_evil_fh(gv, PL_op->op_type);
+       report_evil_fh(gv);
     SETERRNO(EBADF,SS_IVCHAN);
     RETPUSHUNDEF;
 #else
@@ -2750,7 +2750,7 @@ PP(pp_ssockopt)
 
 nuts:
     if (ckWARN(WARN_CLOSED))
-       report_evil_fh(gv, optype);
+       report_evil_fh(gv);
     SETERRNO(EBADF,SS_IVCHAN);
 nuts2:
     RETPUSHUNDEF;
@@ -2814,7 +2814,7 @@ PP(pp_getpeername)
 
 nuts:
     if (ckWARN(WARN_CLOSED))
-       report_evil_fh(gv, optype);
+       report_evil_fh(gv);
     SETERRNO(EBADF,SS_IVCHAN);
 nuts2:
     RETPUSHUNDEF;
@@ -2870,7 +2870,7 @@ PP(pp_stat)
 
        if (PL_laststatval < 0) {
            if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
-               report_evil_fh(gv, PL_op->op_type);
+               report_evil_fh(gv);
            max = 0;
        }
     }
@@ -3444,7 +3444,7 @@ PP(pp_fttext)
        else {
            if (ckWARN2(WARN_UNOPENED,WARN_CLOSED)) {
                gv = cGVOP_gv;
-               report_evil_fh(gv, PL_op->op_type);
+               report_evil_fh(gv);
            }
            SETERRNO(EBADF,RMS_IFI);
            RETPUSHUNDEF;
@@ -3590,14 +3590,14 @@ PP(pp_chdir)
            }
            else {
                if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
-                   report_evil_fh(gv, PL_op->op_type);
+                   report_evil_fh(gv);
                SETERRNO(EBADF, RMS_IFI);
                PUSHi(0);
            }
         }
        else {
            if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
-               report_evil_fh(gv, PL_op->op_type);
+               report_evil_fh(gv);
            SETERRNO(EBADF,RMS_IFI);
            PUSHi(0);
        }
diff --git a/proto.h b/proto.h
index 08ef681..769d3bd 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -3479,7 +3479,7 @@ PERL_CALLCONV void        Perl_repeatcpy(char* to, const char* from, I32 len, I32 count
 #define PERL_ARGS_ASSERT_REPEATCPY     \
        assert(to); assert(from)
 
-PERL_CALLCONV void     Perl_report_evil_fh(pTHX_ const GV *gv, I32 op);
+PERL_CALLCONV void     Perl_report_evil_fh(pTHX_ const GV *gv);
 PERL_CALLCONV void     Perl_report_uninit(pTHX_ const SV *uninit_sv);
 PERL_CALLCONV void     Perl_report_wrongway_fh(pTHX_ const GV *gv, const char have);
 PERL_CALLCONV void     Perl_require_pv(pTHX_ const char* pv)
diff --git a/util.c b/util.c
index 54e658b..ac7dd57 100644 (file)
--- a/util.c
+++ b/util.c
@@ -3882,9 +3882,10 @@ Perl_report_wrongway_fh(pTHX_ const GV *gv, char have)
 }
 
 void
-Perl_report_evil_fh(pTHX_ const GV *gv, I32 op)
+Perl_report_evil_fh(pTHX_ const GV *gv)
 {
     const IO *io = gv ? GvIO(gv) : NULL;
+    const PERL_BITFIELD16 op = PL_op->op_type;
     const char *vile;
     I32 warn_type;
 
@@ -3906,7 +3907,6 @@ Perl_report_evil_fh(pTHX_ const GV *gv, I32 op)
            (const char *)
            (op == OP_READLINE   ? "readline"  :        /* "<HANDLE>" not nice */
             op == OP_LEAVEWRITE ? "write" :            /* "write exit" not nice */
-            op < 0              ? "" :              /* handle phoney cases */
             PL_op_desc[op]);
        const char * const type =
            (const char *)