From: Nicholas Clark Date: Sat, 2 Feb 2008 00:16:02 +0000 (+0000) Subject: In XS_re_regexp_pattern(), use newSVpvn_flags() to avoid calls to X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fb632ce3b9716ad53f50ed424ce0956dc2d24e5d;p=p5sagit%2Fp5-mst-13.2.git In XS_re_regexp_pattern(), use newSVpvn_flags() to avoid calls to sv_2mortal(). p4raw-id: //depot/perl@33181 --- diff --git a/universal.c b/universal.c index 7298559..6860cec 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);