diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-02-02 00:16:02 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-02-02 00:16:02 +0000 |
commit | fb632ce3b9716ad53f50ed424ce0956dc2d24e5d (patch) | |
tree | a3ab95d3a72df56ddc7d711a6c4d58f198780939 /universal.c | |
parent | 437d3b4e2ce32830fdc042ab67d7815e3555e931 (diff) | |
download | perl-fb632ce3b9716ad53f50ed424ce0956dc2d24e5d.tar.gz |
In XS_re_regexp_pattern(), use newSVpvn_flags() to avoid calls to
sv_2mortal().
p4raw-id: //depot/perl@33181
Diffstat (limited to 'universal.c')
-rw-r--r-- | universal.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/universal.c b/universal.c index 7298559b68..6860cec2ad 100644 --- a/universal.c +++ b/universal.c @@ -1238,13 +1238,12 @@ XS(XS_re_regexp_pattern) match_flags >>= 1; } - pattern = sv_2mortal(newSVpvn(RX_PRECOMP(re),RX_PRELEN(re))); - if (RX_UTF8(re)) - SvUTF8_on(pattern); + pattern = newSVpvn_flags(RX_PRECOMP(re),RX_PRELEN(re), + (RX_UTF8(re) ? SVf_UTF8 : 0) | SVs_TEMP); /* return the pattern and the modifiers */ XPUSHs(pattern); - XPUSHs(sv_2mortal(newSVpvn(reflags,left))); + XPUSHs(newSVpvn_flags(reflags, left, SVs_TEMP)); XSRETURN(2); } else { /* Scalar, so use the string that Perl would return */ @@ -1252,9 +1251,8 @@ XS(XS_re_regexp_pattern) #if PERL_VERSION >= 11 pattern = sv_2mortal(newSVsv((SV*)re)); #else - pattern = sv_2mortal(newSVpvn(RX_WRAPPED(re),RX_WRAPLEN(re))); - if (RX_UTF8(re)) - SvUTF8_on(pattern); + pattern = newSVpvn_flags(RX_WRAPPED(re), RX_WRAPLEN(re), + (RX_UTF8(re) ? SVf_UTF8 : 0) | SVs_TEMP); #endif XPUSHs(pattern); XSRETURN(1); |