pv->pvn for literals in pp_require and Perl_sv_derived_from_pvn
authorDaniel Dragan <bulk88@hotmail.com>
Mon, 12 Nov 2012 16:08:44 +0000 (11:08 -0500)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 12 Nov 2012 19:21:11 +0000 (11:21 -0800)
I found these 2 strlens while stepping through the interp while running a
script and both came from a pp_require. UNIVERSAL::can was not modified
since it is more rarely called than pp_require. A better more through
investigation of version obj comparison and upgrading will need to be done
in the future (new funcs needed for the derived/upg_version idiom, remove
the upg_version since it was changed to always be a ver obj, etc).

pp_ctl.c
universal.c

index 6849f88..22e1cea 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3601,7 +3601,7 @@ PP(pp_require)
     sv = POPs;
     if ( (SvNIOKp(sv) || SvVOK(sv)) && PL_op->op_type != OP_DOFILE) {
        sv = sv_2mortal(new_version(sv));
-       if (!sv_derived_from(PL_patchlevel, "version"))
+       if (!Perl_sv_derived_from_pvn(aTHX_ PL_patchlevel, STR_WITH_LEN("version"), 0))
            upg_version(PL_patchlevel, TRUE);
        if (cUNOP->op_first->op_type == OP_CONST && cUNOP->op_first->op_private & OPpCONST_NOVER) {
            if ( vcmp(sv,PL_patchlevel) <= 0 )
index be06aca..76b6281 100644 (file)
@@ -165,7 +165,7 @@ Perl_sv_derived_from_pvn(pTHX_ SV *sv, const char *const name, const STRLEN len,
     else {
         stash = gv_stashsv(sv, 0);
         if (!stash)
-            stash = gv_stashpv("UNIVERSAL", 0);
+            stash = gv_stashpvs("UNIVERSAL", 0);
     }
 
     return stash ? isa_lookup(stash, name, len, flags) : FALSE;