Skip to content

Commit

Permalink
Fixed recent regression of recent minor charsUntil optimisation
Browse files Browse the repository at this point in the history
--HG--
extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%401245
  • Loading branch information
philiptaylor committed Dec 18, 2008
1 parent c6f0940 commit 22886b1
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/html5lib/inputstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,15 +343,20 @@ def charsUntil(self, characters, opposite = False):
# Find the longest matching prefix
m = chars.match(self.chunk, self.chunkOffset)
if m is None:
end = self.chunkOffset
# If nothing matched, and it wasn't because we ran out of chunk,
# then stop
if self.chunkOffset != self.chunkSize:
break
else:
end = m.end()
# If not everything matched, return everything up to the part that didn't match
if end != self.chunkSize:
rv.append(self.chunk[self.chunkOffset:end])
self.chunkOffset = end
break
# If the whole chunk matched, use it all and read the next chunk
# If not the whole chunk matched, return everything
# up to the part that didn't match
if end != self.chunkSize:
rv.append(self.chunk[self.chunkOffset:end])
self.chunkOffset = end
break
# If the whole remainder of the chunk matched,
# use it all and read the next chunk
rv.append(self.chunk[self.chunkOffset:])
if not self.readChunk():
# Reached EOF
Expand Down

0 comments on commit 22886b1

Please sign in to comment.