This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
mro_core.c: use new SvPVCLEAR and constant string friendly macros
authorYves Orton <demerphq@gmail.com>
Wed, 19 Oct 2016 09:14:26 +0000 (11:14 +0200)
committerYves Orton <demerphq@gmail.com>
Wed, 19 Oct 2016 11:28:01 +0000 (13:28 +0200)
mro_core.c

index d4ca7f2..809bcdf 100644 (file)
@@ -346,7 +346,7 @@ S_mro_get_linear_isa_dfs(pTHX_ HV *stash, U32 level)
                    /* They have no stash.  So create ourselves an ->isa cache
                       as if we'd copied it from what theirs should be.  */
                    stored = MUTABLE_HV(sv_2mortal(MUTABLE_SV(newHV())));
                    /* They have no stash.  So create ourselves an ->isa cache
                       as if we'd copied it from what theirs should be.  */
                    stored = MUTABLE_HV(sv_2mortal(MUTABLE_SV(newHV())));
-                   (void) hv_store(stored, "UNIVERSAL", 9, &PL_sv_undef, 0);
+                   (void) hv_stores(stored, "UNIVERSAL", &PL_sv_undef);
                    av_push(retval,
                            newSVhek(HeKEY_hek(hv_store_ent(stored, sv,
                                                            &PL_sv_undef, 0))));
                    av_push(retval,
                            newSVhek(HeKEY_hek(hv_store_ent(stored, sv,
                                                            &PL_sv_undef, 0))));
@@ -356,7 +356,7 @@ S_mro_get_linear_isa_dfs(pTHX_ HV *stash, U32 level)
     } else {
        /* We have no parents.  */
        stored = MUTABLE_HV(sv_2mortal(MUTABLE_SV(newHV())));
     } else {
        /* We have no parents.  */
        stored = MUTABLE_HV(sv_2mortal(MUTABLE_SV(newHV())));
-       (void) hv_store(stored, "UNIVERSAL", 9, &PL_sv_undef, 0);
+       (void) hv_stores(stored, "UNIVERSAL", &PL_sv_undef);
     }
 
     (void) hv_store_ent(stored, our_name, &PL_sv_undef, 0);
     }
 
     (void) hv_store_ent(stored, our_name, &PL_sv_undef, 0);
@@ -451,7 +451,7 @@ Perl_mro_get_linear_isa(pTHX_ HV *stash)
                             HEK_LEN(canon_name), HEK_FLAGS(canon_name),
                             HV_FETCH_ISSTORE, &PL_sv_undef,
                             HEK_HASH(canon_name));
                             HEK_LEN(canon_name), HEK_FLAGS(canon_name),
                             HV_FETCH_ISSTORE, &PL_sv_undef,
                             HEK_HASH(canon_name));
-           (void) hv_store(isa_hash, "UNIVERSAL", 9, &PL_sv_undef, 0);
+           (void) hv_stores(isa_hash, "UNIVERSAL", &PL_sv_undef);
 
            SvREADONLY_on(isa_hash);
 
 
            SvREADONLY_on(isa_hash);
 
@@ -524,8 +524,8 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash)
     svp = hv_fetchhek(PL_isarev, stashhek, 0);
     isarev = svp ? MUTABLE_HV(*svp) : NULL;
 
     svp = hv_fetchhek(PL_isarev, stashhek, 0);
     isarev = svp ? MUTABLE_HV(*svp) : NULL;
 
-    if((stashname_len == 9 && strEQ(stashname, "UNIVERSAL"))
-        || (isarev && hv_exists(isarev, "UNIVERSAL", 9))) {
+    if((memEQs(stashname, stashname_len, "UNIVERSAL"))
+        || (isarev && hv_existss(isarev, "UNIVERSAL"))) {
         PL_sub_generation++;
         is_universal = TRUE;
     }
         PL_sub_generation++;
         is_universal = TRUE;
     }
@@ -1329,8 +1329,8 @@ Perl_mro_method_changed_in(pTHX_ HV *stash)
 
     /* If stash is UNIVERSAL, or one of UNIVERSAL's parents,
        invalidate all method caches globally */
 
     /* If stash is UNIVERSAL, or one of UNIVERSAL's parents,
        invalidate all method caches globally */
-    if((stashname_len == 9 && strEQ(stashname, "UNIVERSAL"))
-        || (isarev && hv_exists(isarev, "UNIVERSAL", 9))) {
+    if((memEQs(stashname, stashname_len, "UNIVERSAL"))
+        || (isarev && hv_existss(isarev, "UNIVERSAL"))) {
         PL_sub_generation++;
         return;
     }
         PL_sub_generation++;
         return;
     }