Commit 4e47eba
scanners: avoid transient write when sentinel already NUL.
_scan_at patched the byte at ptr[c->len] with '\0' around every
scanner invocation so that the re2c scanners (built with
yyfill:enable = 0) could use it as a stopping sentinel. In the
common case the chunk is backed by a cmark_strbuf whose data[size]
is already '\0', so the write was an idempotent mutation of shared
backing storage. Skip it when the byte is already '\0' to preserve
const-correctness and reentrancy on that path; retain the patch
fallback for chunks that are not already NUL-terminated.
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 8c9dcdd commit 4e47eba
2 files changed
Lines changed: 28 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
19 | 30 | | |
20 | 31 | | |
21 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
18 | 29 | | |
19 | 30 | | |
20 | 31 | | |
| |||
0 commit comments