summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-11-18 20:27:15 -0800
committerFather Chrysostomos <sprout@cpan.org>2011-11-18 20:27:15 -0800
commitd3cd8e110d9ca180ad6cfb8eccb46fb165e3e28c (patch)
treec02073c29762d757debf9610da8cc3a2b510f9d5
parent2836693588eb28b4707239cc6f6c72b3c54749ad (diff)
downloadperl-d3cd8e110d9ca180ad6cfb8eccb46fb165e3e28c.tar.gz
Don’t create an AV for unfiltered code
When there are no source filters, we don’t need to create an AV to hold them. The code for adding a filter already does a null check.
-rw-r--r--toke.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/toke.c b/toke.c
index 33d7b86fdb..8690877138 100644
--- a/toke.c
+++ b/toke.c
@@ -715,8 +715,12 @@ Perl_lex_start(pTHX_ SV *line, PerlIO *rsfp, U32 flags)
parser->rsfp = rsfp;
parser->rsfp_filters =
!(flags & LEX_START_SAME_FILTER) || !oparser
- ? newAV()
- : MUTABLE_AV(SvREFCNT_inc(oparser->rsfp_filters));
+ ? NULL
+ : MUTABLE_AV(SvREFCNT_inc(
+ oparser->rsfp_filters
+ ? oparser->rsfp_filters
+ : (oparser->rsfp_filters = newAV())
+ ));
Newx(parser->lex_brackstack, 120, char);
Newx(parser->lex_casestack, 12, char);