summaryrefslogtreecommitdiff
path: root/overload.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2013-08-28 22:00:54 +0200
committerNicholas Clark <nick@ccl4.org>2013-09-02 16:04:02 +0200
commite91d825996027800803ecf00fccacdcb821d3295 (patch)
tree1f9f89122222a764a475b6098ac52bbdbaafc05d /overload.c
parente1c60bf347fcb74764d4f3baf79980d3252ccf0a (diff)
downloadperl-e91d825996027800803ecf00fccacdcb821d3295.tar.gz
Store the match vars in mg_len instead of calling atoi() on mg_ptr.
The match variables $1, $2 etc, along with many other special scalars, have magic type PERL_MAGIC_sv, with the variable's name stored in mg_ptr. The look up in mg.c involved calling atoi() on the string in mg_ptr to get the capture buffer as an integer, which is passed to the regex API. To avoid this repeated use of atoi() at runtime, change the storage in the MAGIC structure for $1, $2 etc and $&. Set mg_ptr to NULL, and store the capture buffer in mg_len. Other code which manipulates magic ignores mg_len if mg_ptr is NULL, so this representation does not require changes outside of the routines which set up, read and write these variables. (Perl_gv_fetchpvn_flags(), Perl_magic_get() and Perl_magic_set())
Diffstat (limited to 'overload.c')
0 files changed, 0 insertions, 0 deletions