summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorKarl <khw@karl.(none)>2009-01-18 15:34:58 -0700
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-01-19 09:29:27 +0100
commit7bf7986364dc86acb86c5d83e7512b8dbdcb0165 (patch)
treef876493112f7120d15555d6cd0ea79116b54843c /toke.c
parent642d3d283bbbcadf2460de3a8aac4b1943137ece (diff)
downloadperl-7bf7986364dc86acb86c5d83e7512b8dbdcb0165.tar.gz
Combine sv_utf8_upgrade with a following grow
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/toke.c b/toke.c
index 258c927dbb..951c1ca84c 100644
--- a/toke.c
+++ b/toke.c
@@ -2306,9 +2306,10 @@ S_scan_const(pTHX_ char *start)
SvCUR_set(sv, d - SvPVX_const(sv));
SvPOK_on(sv);
*d = '\0';
- sv_utf8_upgrade(sv);
/* See Note on sizing above. */
- SvGROW(sv, SvCUR(sv) + UNISKIP(uv) + (STRLEN)(send - s) + 1);
+ sv_utf8_upgrade_flags_grow(sv,
+ SV_GMAGIC|SV_FORCE_UTF8_UPGRADE,
+ UNISKIP(uv) + (STRLEN)(send - s) + 1);
d = SvPVX(sv) + SvCUR(sv);
has_utf8 = TRUE;
}
@@ -2396,9 +2397,10 @@ S_scan_const(pTHX_ char *start)
SvCUR_set(sv, d - SvPVX_const(sv));
SvPOK_on(sv);
*d = '\0';
- sv_utf8_upgrade(sv);
/* See Note on sizing above. */
- SvGROW(sv, SvCUR(sv) + len + (STRLEN)(send - s) + 1);
+ sv_utf8_upgrade_flags_grow(sv,
+ SV_GMAGIC|SV_FORCE_UTF8_UPGRADE,
+ len + (STRLEN)(send - s) + 1);
d = SvPVX(sv) + SvCUR(sv);
has_utf8 = TRUE;
} else if (len > (STRLEN)(e - s + 4)) { /* I _guess_ 4 is \N{} --jhi */
@@ -2490,10 +2492,10 @@ S_scan_const(pTHX_ char *start)
SvCUR_set(sv, d - SvPVX_const(sv));
SvPOK_on(sv);
*d = '\0';
- sv_utf8_upgrade(sv);
-
/* See Note on sizing above. */
- SvGROW(sv, SvCUR(sv) + need + (STRLEN)(send - s) + 1);
+ sv_utf8_upgrade_flags_grow(sv,
+ SV_GMAGIC|SV_FORCE_UTF8_UPGRADE,
+ need + (STRLEN)(send - s) + 1);
d = SvPVX(sv) + SvCUR(sv);
has_utf8 = TRUE;
} else if (need > len) {