For the rare case of EMFILE during require, save object code space
Nicholas Clark [Fri, 23 Dec 2005 17:24:44 +0000 (17:24 +0000)]
by using newSVpvf
(Would it be worth using it for all require failures?)

p4raw-id: //depot/perl@26477

pp_ctl.c

index 9c8cb83..ad901cc 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3334,9 +3334,9 @@ PP(pp_require)
        if (PL_op->op_type == OP_REQUIRE) {
            const char *msgstr = name;
            if(errno == EMFILE) {
-               SV * const msg = sv_2mortal(newSVpv(msgstr,0));
-               sv_catpv(msg, ":  "); 
-               sv_catpv(msg, Strerror(errno));
+               SV * const msg
+                   = sv_2mortal(Perl_newSVpvf(aTHX_ "%s:   %s", msgstr,
+                                              Strerror(errno)));
                msgstr = SvPV_nolen_const(msg);
            } else {
                if (namesv) {                   /* did we lookup @INC? */