Skip to content

Commit 34f77b1

Browse files
committed
Treat null-byte as contiguous in fallback scanner
1 parent dcde995 commit 34f77b1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/fallback/scanner.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ static really_inline const char *scan_contiguous(
6969
goto escaped;
7070

7171
while (start < end) {
72-
if (likely(classify[ (uint8_t)*start ] == CONTIGUOUS)) {
72+
// null-byte is considered contiguous by the indexer (for now)
73+
if (likely((classify[ (uint8_t)*start ] & ~CONTIGUOUS) == 0)) {
7374
if (unlikely(*start == '\\')) {
74-
start++;
75+
start++;
7576
escaped:
7677
if ((parser->file->state.is_escaped = (start == end)))
7778
break;
@@ -105,7 +106,8 @@ static really_inline void scan(
105106
const int32_t code = classify[(uint8_t)*start];
106107
if (code == BLANK) {
107108
start++;
108-
} else if (code == CONTIGUOUS) {
109+
} else if ((code & ~CONTIGUOUS) == 0) {
110+
// null-byte is considered contiguous by the indexer (for now)
109111
*parser->file->fields.tail++ = start;
110112
start = scan_contiguous(parser, start, end);
111113
} else if (code == LINE_FEED) {

0 commit comments

Comments
 (0)