There are clearer ways of saying m/^[ab]$/ than strchr("ab", c)
Nicholas Clark [Fri, 3 Dec 2004 18:26:43 +0000 (18:26 +0000)]
They seem to produce slightly smaller object code too.

p4raw-id: //depot/perl@23604

gv.c

diff --git a/gv.c b/gv.c
index e20f278..5ea5141 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -740,7 +740,8 @@ Perl_gv_fetchpv(pTHX_ const char *nambeg, I32 add, I32 sv_type)
                    sv_type != SVt_PVGV &&
                    sv_type != SVt_PVFM &&
                    sv_type != SVt_PVIO &&
-                   !(len == 1 && sv_type == SVt_PV && strchr("ab",*name)) )
+                   !(len == 1 && sv_type == SVt_PV &&
+                     (*name == 'a' || *name == 'b')) )
                {
                    gvp = (GV**)hv_fetch(stash,name,len,0);
                    if (!gvp ||