This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Merge the implementations of {end,set}{gr,pw}ent with endhostent.
[perl5.git] / util.c
diff --git a/util.c b/util.c
index ff1e756..e9bd742 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1427,7 +1427,7 @@ Perl_write_to_stderr(pTHX_ SV* msv)
        PUSHs(SvTIED_obj(MUTABLE_SV(io), mg));
        PUSHs(msv);
        PUTBACK;
-       call_method("PRINT", G_SCALAR);
+       call_method("PRINT", G_SCALAR | G_DISCARD);
 
        POPSTACK;
        FREETMPS;
@@ -3882,12 +3882,14 @@ Perl_report_wrongway_fh(pTHX_ const GV *gv, char have)
 }
 
 void
-Perl_report_evil_fh(pTHX_ const GV *gv, const IO *io, 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;
 
-    if (gv && io && IoTYPE(io) == IoTYPE_CLOSED) {
+    if (io && IoTYPE(io) == IoTYPE_CLOSED) {
        vile = "closed";
        warn_type = WARN_CLOSED;
     }
@@ -3905,11 +3907,10 @@ Perl_report_evil_fh(pTHX_ const GV *gv, const IO *io, 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 *)
-           (OP_IS_SOCKET(op) || (gv && io && IoTYPE(io) == IoTYPE_SOCKET)
+           (OP_IS_SOCKET(op) || (io && IoTYPE(io) == IoTYPE_SOCKET)
             ? "socket" : "filehandle");
        if (name && *name) {
            Perl_warner(aTHX_ packWARN(warn_type),
@@ -3924,7 +3925,7 @@ Perl_report_evil_fh(pTHX_ const GV *gv, const IO *io, I32 op)
        else {
            Perl_warner(aTHX_ packWARN(warn_type),
                        "%s%s on %s %s", func, pars, vile, type);
-           if (gv && io && IoDIRP(io) && !(IoFLAGS(io) & IOf_FAKE_DIRP))
+           if (io && IoDIRP(io) && !(IoFLAGS(io) & IOf_FAKE_DIRP))
                Perl_warner(
                            aTHX_ packWARN(warn_type),
                            "\t(Are you trying to call %s%s on dirhandle?)\n",
@@ -4174,7 +4175,7 @@ Perl_mini_mktime(pTHX_ struct tm *ptm)
  * outside the scope for this routine.  Since we convert back based on the
  * same rules we used to build the yearday, you'll only get strange results
  * for input which needed normalising, or for the 'odd' century years which
- * were leap years in the Julian calander but not in the Gregorian one.
+ * were leap years in the Julian calendar but not in the Gregorian one.
  * I can live with that.
  *
  * This algorithm also fails to handle years before A.D. 1 gracefully, but
@@ -6177,7 +6178,7 @@ S_mem_log_common(enum mem_log_type mlt, const UV n,
     mem_log_common   (alty, num, tysz, tynm, sv, oal, nal, flnm, ln, fnnm)
 #else
 /* this is suboptimal, but bug compatible.  User is providing their
-   own implemenation, but is getting these functions anyway, and they
+   own implementation, but is getting these functions anyway, and they
    do nothing. But _NOIMPL users should be able to cope or fix */
 # define \
     mem_log_common_if(alty, num, tysz, tynm, u, oal, nal, flnm, ln, fnnm) \