summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2000-07-29 00:55:39 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2000-07-29 00:55:39 +0000
commit350e0994728e1b6ea784b5d0c0537105d8b22af7 (patch)
tree16490fd3df3c900312760206835f2631e8cb016b /toke.c
parentc00525d4ffbf0b596802bf6bdd6a3df8f11e1ff3 (diff)
downloadperl-350e0994728e1b6ea784b5d0c0537105d8b22af7.tar.gz
Tune the comments and hopefully stop a memory leak.
p4raw-id: //depot/perl@6463
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/toke.c b/toke.c
index f3683677b6..130d5c4106 100644
--- a/toke.c
+++ b/toke.c
@@ -2521,7 +2521,7 @@ Perl_yylex(pTHX)
if (bof)
{
PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
- /* Shouldn't this wsallow_bom() be earlier, e.g.
+ /* Shouldn't this swallow_bom() be earlier, e.g.
* immediately after where bof is set? Currently you can't
* have e.g. a UTF16 sharpbang line. --Mike Guy */
s = swallow_bom((U8*)s);
@@ -7390,6 +7390,7 @@ STATIC char*
S_swallow_bom(pTHX_ U8 *s)
{
STRLEN slen;
+ U8 *olds = s;
slen = SvCUR(PL_linestr);
switch (*s) {
case 0xFF:
@@ -7404,8 +7405,10 @@ S_swallow_bom(pTHX_ U8 *s)
s += 2;
filter_add(utf16rev_textfilter, NULL);
New(898, news, (PL_bufend - (char*)s) * 3 / 2 + 1, U8);
+ /* See the notes on utf16_to_utf8() in utf8.c --Mike Guy */
PL_bufend = (char*)utf16_to_utf8((U16*)s, news,
PL_bufend - (char*)s);
+ Safefree(olds);
s = news;
#else
Perl_croak(aTHX_ "Unsupported script encoding");
@@ -7418,8 +7421,10 @@ S_swallow_bom(pTHX_ U8 *s)
U8 *news;
filter_add(utf16_textfilter, NULL);
New(898, news, (PL_bufend - (char*)s) * 3 / 2 + 1, U8);
+ /* See the notes on utf16_to_utf8() in utf8.c --Mike Guy */
PL_bufend = (char*)utf16_to_utf8((U16*)s, news,
PL_bufend - (char*)s);
+ Safefree(olds);
s = news;
#else
Perl_croak(aTHX_ "Unsupported script encoding");