diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-12-04 14:52:45 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-12-05 21:31:42 -0800 |
commit | bcea25a760263ce058f5588c6ae62af6f09a211e (patch) | |
tree | aa53a93f8e38eb6c1083e3e5e46de49b1752b8c0 /pp.c | |
parent | 19b29141f68d34f2b832ff2cddd54122e3ed3c28 (diff) | |
download | perl-bcea25a760263ce058f5588c6ae62af6f09a211e.tar.gz |
Don’t use PMf_ONCE flag for split-to-array
Currently the PMf_ONCE flag has two purposes. It is used to indicate
that m?? must match only once. That’s what distinguishes m?? and m//
internally. The other use indicates that @x = split... modifies the
array in place.
Whenever the split op is modified to point straight to the array, the
PMf_ONCE flag is set. pp_split checks both whether there is an array
attached to the op (via a GV in the pad under threads, or a pointer
from the op to the GV under non-threaded builds) and whether the
flag is set.
This makes the flag redundant in the split case.
Removing its use here not only simplifies the code and removes redun-
dant bit-fiddling, but also makes this comment in toke.c, added by
ad639bfb6, come true:
/* This is the only point in the code that sets PMf_ONCE: */
(That was actually harmless, as it doesn’t hurt to have a stash refer-
ring to pmops that don’t use the PMf_USED flag, and the PMf_ONCE flag
is set for split way after that code is run. It is also unnecessary
for split, as that bookkeeping code in toke.c only applies to the m??
use of PMf_ONCE.)
This commit also removes a gimme != G_ARRAY check that thas been
redundant since a6d8037e26a.
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -5353,7 +5353,7 @@ PP(pp_split) #endif else ary = NULL; - if (ary && (gimme != G_ARRAY || (pm->op_pmflags & PMf_ONCE))) { + if (ary) { realarray = 1; PUTBACK; av_extend(ary,0); |