diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-10-22 07:41:39 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-10-22 07:41:39 +0100 |
commit | dcb21ed695e1607e7f38d24d60022fda943f55e2 (patch) | |
tree | 1fa33fb1ff2823b03863e83de062bf636253a9d9 /toke.c | |
parent | c678e61761316cef95aa1177d92c245639595161 (diff) | |
download | perl-dcb21ed695e1607e7f38d24d60022fda943f55e2.tar.gz |
S_tokeq()'s fast scan loop should terminate on \\ not \
As-was, it would drop out of the scanner into the backslashed-backslash
processing loop earlier than need be, and hence would be copying the octets
of strings (in place) as soon as any backslash had been seen. Now it defers
copying until copying is actually unavoidable.
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -2253,7 +2253,8 @@ S_tokeq(pTHX_ SV *sv) if (SvTYPE(sv) >= SVt_PVIV && SvIVX(sv) == -1) goto finish; send = s + len; - while (s < send && *s != '\\') + /* This is relying on the SV being "well formed" with a trailing '\0' */ + while (s < send && !(*s == '\\' && s[1] == '\\')) s++; if (s == send) goto finish; |