summaryrefslogtreecommitdiff
path: root/proto.h
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2010-10-26 13:14:12 -0600
committerFather Chrysostomos <sprout@cpan.org>2010-10-26 18:10:39 -0700
commit2c63ecadcb2533b7a53efa836736d86cb484d969 (patch)
tree1bd78a70454feca4da3d354ebf01a416d8d91663 /proto.h
parent021897e0cddffa1615b83551abd2136c5f0fbeee (diff)
downloadperl-2c63ecadcb2533b7a53efa836736d86cb484d969.tar.gz
ANYOF regnode often overallocates space
The ANYOF regnode is used for [bracketed character classes]. It is normally a struct regnode_charclass, but sometimes it is a struct regnode_charclass_class, which adds an extra 4 bytes at the end to store which of things like \d, \w, [:posix:] within the outer bracketed class are to be matched at run time, like [\d\s[:upper:]]. However these are currently only stored the if the match is to be locale based. I haven't looked in the history, but the comments seem to indicate that in the past those things were stored there all the time. But, the space is allocated even if nothing gets stored there. This patch only allocates the space if there is one of these classes occurring in a [bracketed class] and something is stored there, namely only if the regex is being compiled under 'use locale'. The previous code was not noting that these classes matched code points (in the 'stored' variable), but was relying on ANYOF_LARGE getting set which thus avoided it thinking it was a single character class that could be optimized to an EXACT node. Thus, this patch has to explicitly set 'stored' to > 1, as the function already does elsewhere for similar reasons.
Diffstat (limited to 'proto.h')
0 files changed, 0 insertions, 0 deletions