diff options
| author | 2024-06-10 13:48:15 -0500 | |
|---|---|---|
| committer | 2024-06-10 13:52:53 -0500 | |
| commit | 71f3570ab9259254b70a8a91b389ed698a33a264 (patch) | |
| tree | 44dd6944e087740d402edc9ae28daa5301e7d45f /src/FoldData.zig | |
| parent | build: use b.path everywhere (diff) | |
| download | zg-71f3570ab9259254b70a8a91b389ed698a33a264.tar.gz zg-71f3570ab9259254b70a8a91b389ed698a33a264.tar.xz zg-71f3570ab9259254b70a8a91b389ed698a33a264.zip | |
codepoint: prevent panic when last cp too short
If the last codepoint in a byte slice is incomplete (IE has a length of
3 but there are only 2 bytes remaining), the iterator will panic.
Instead of panicking, prefer to return a replacement character. This
strategy is similar to that in the block just above which returns a
replacement character if the first byte is not valid. In this latter
block, we also consume only one byte and allow the iterator to continue.
This allows for sections of text which may have a single byte incorrect
near the end of the slice.
Diffstat (limited to 'src/FoldData.zig')
0 files changed, 0 insertions, 0 deletions