summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-08-11 14:38:08 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-08-12 01:53:26 -0700
commite0060e30a691e43bb2fb3e566faa3878a95f8af4 (patch)
tree658222b6be875dce5e98313dadf4e91d3782316c /sv.c
parent90b0dc0e2e44e9b8e3b9054e94bdb7d4eee1b763 (diff)
downloadperl-e0060e30a691e43bb2fb3e566faa3878a95f8af4.tar.gz
sv.c:sv_grow: accept read-only COWs
sv_grow has long been permitted on read-only scalars. This stopped being the case all the time when 9a0a85075 and 1620522e4 allowed read- nly copy-on-write scalars. Because sv_force_normal has multiple uses, sv_grow ended up croaking on *these* read-only scalars, but not others. This commit makes things consistent with the way they used to be.
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sv.c b/sv.c
index 593f942cab..de0831c2ae 100644
--- a/sv.c
+++ b/sv.c
@@ -1470,6 +1470,8 @@ Use the C<SvGROW> wrapper instead.
=cut
*/
+static void S_sv_uncow(pTHX_ SV * const sv, const U32 flags);
+
char *
Perl_sv_grow(pTHX_ SV *const sv, STRLEN newlen)
{
@@ -1502,7 +1504,7 @@ Perl_sv_grow(pTHX_ SV *const sv, STRLEN newlen)
}
else
{
- if (SvIsCOW(sv)) sv_force_normal(sv);
+ if (SvIsCOW(sv)) S_sv_uncow(aTHX_ sv, 0);
s = SvPVX_mutable(sv);
}
@@ -3256,8 +3258,6 @@ especially if it could return the position of the first one.
*/
-static void S_sv_uncow(pTHX_ SV * const sv, const U32 flags);
-
STRLEN
Perl_sv_utf8_upgrade_flags_grow(pTHX_ SV *const sv, const I32 flags, STRLEN extra)
{