diff options
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); |