This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
ext/mro: use memEQs() for constant string checks
authorYves Orton <demerphq@gmail.com>
Wed, 19 Oct 2016 08:52:28 +0000 (10:52 +0200)
committerYves Orton <demerphq@gmail.com>
Wed, 19 Oct 2016 11:28:00 +0000 (13:28 +0200)
ext/mro/mro.pm
ext/mro/mro.xs

index 0946fb6..5df944c 100644 (file)
@@ -12,7 +12,7 @@ use warnings;
 
 # mro.pm versions < 1.00 reserved for MRO::Compat
 #  for partial back-compat to 5.[68].x
-our $VERSION = '1.18';
+our $VERSION = '1.19';
 
 sub import {
     mro::set_mro(scalar(caller), $_[1]) if $_[1];
index 6d891ae..f51d54a 100644 (file)
@@ -431,8 +431,8 @@ mro_is_universal(...)
     he = hv_fetch_ent(PL_isarev, classname, 0, 0);
     isarev = he ? MUTABLE_HV(HeVAL(he)) : NULL;
 
-    if((classname_len == 9 && strEQ(classname_pv, "UNIVERSAL"))
-        || (isarev && hv_exists(isarev, "UNIVERSAL", 9)))
+    if((memEQs(classname_pv, classname_len, "UNIVERSAL"))
+        || (isarev && hv_existss(isarev, "UNIVERSAL")))
         XSRETURN_YES;
     else
         XSRETURN_NO;
@@ -566,7 +566,7 @@ mro__nextcan(...)
 
             subname++;
             subname_len = fq_subname_len - (subname - fq_subname);
-            if(subname_len == 8 && strEQ(subname, "__ANON__")) {
+            if(memEQs(subname, subname_len, "__ANON__")) {
                 cxix = __dopoptosub_at(ccstack, cxix - 1);
                 continue;
             }