summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2009-11-18 21:49:24 +0000
committerH.Merijn Brand <h.m.brand@xs4all.nl>2009-11-19 10:42:43 +0100
commit580561a3a5dd3bfef87627781ac362004e3d87b5 (patch)
treeb5982eaa5a7422402af05fdb20c5108cd7e1ef35 /toke.c
parent8a71e97e936696283eb1a280cffaa37177ef24f1 (diff)
downloadperl-580561a3a5dd3bfef87627781ac362004e3d87b5.tar.gz
lexer API fixes
The attached patch contains these fixes for the lexer API work: * fix MinGW-revealed problem in BOM logic (replacing Jan's patch) * fix warnings from t/op/incfilter.t * probably fix g++ failure due to goto bypassing initialisation * perl5112delta update -zefram Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/toke.c b/toke.c
index a17dc4cde8..a4e9471381 100644
--- a/toke.c
+++ b/toke.c
@@ -1232,6 +1232,8 @@ Perl_lex_next_chunk(pTHX_ U32 flags)
} else if (filter_gets(linestr, old_bufend_pos)) {
got_some = 1;
} else {
+ if (!SvPOK(linestr)) /* can get undefined by filter_gets */
+ sv_setpvs(linestr, "");
eof:
/* End of real input. Close filehandle (unless it was STDIN),
* then add implicit termination.
@@ -3867,6 +3869,7 @@ Perl_yylex(pTHX)
register char *d;
STRLEN len;
bool bof = FALSE;
+ U32 fake_eof = 0;
/* orig_keyword, gvp, and gv are initialized here because
* jump to the label just_a_word_zero can bypass their
@@ -4314,7 +4317,8 @@ Perl_yylex(pTHX)
goto retry;
}
do {
- U32 fake_eof = 0;
+ fake_eof = 0;
+ bof = PL_rsfp ? TRUE : FALSE;
if (0) {
fake_eof:
fake_eof = LEX_FAKE_EOF;
@@ -4331,8 +4335,7 @@ Perl_yylex(pTHX)
s = PL_bufptr;
/* If it looks like the start of a BOM or raw UTF-16,
* check if it in fact is. */
- bof = PL_rsfp ? TRUE : FALSE;
- if (bof &&
+ if (bof && PL_rsfp &&
(*s == 0 ||
*(U8*)s == 0xEF ||
*(U8*)s >= 0xFE ||