Skip to content

Commit 1347176

Browse files
committed
refactor: clean up field flag definitions and remove unused quote detection functions
1 parent bbfacb9 commit 1347176

2 files changed

Lines changed: 3 additions & 34 deletions

File tree

field_parser.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ type fieldInfo struct {
128128
}
129129

130130
const (
131-
fieldFlagNeedsUnescape = 1 << 0
132-
fieldFlagIsQuoted = 1 << 1
133-
fieldFlagContainsQuote = 1 << 2 // field contains quote character (for validation optimization)
131+
fieldFlagNeedsUnescape = 1 << 0
132+
fieldFlagIsQuoted = 1 << 1
133+
fieldFlagContainsQuote = 1 << 2 // field contains quote character (for validation optimization)
134134
)
135135

136136
// rawStart returns the raw start position (including opening quote if quoted).

validation.go

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -30,37 +30,6 @@ func (p validationPolicy) shouldUseMetadata(field fieldInfo) bool {
3030
return field.flags&fieldFlagIsQuoted != 0 && !p.trimLeadingSpace
3131
}
3232

33-
// =============================================================================
34-
// Chunk-Level Quote Detection - Fast path optimization
35-
// =============================================================================
36-
37-
// fieldMayContainQuote reports whether any chunk overlapped by the field contains a quote.
38-
// Returns true conservatively when chunk data is unavailable.
39-
func (r *Reader) fieldMayContainQuote(rawStart, rawEnd uint64) bool {
40-
if len(r.state.chunkHasQuote) == 0 {
41-
return true // Conservative: assume quotes when no chunk data
42-
}
43-
if rawEnd <= rawStart {
44-
return false // Empty range contains nothing
45-
}
46-
47-
startChunk := int(rawStart / simdChunkSize) //nolint:gosec // G115
48-
endChunk := int((rawEnd - 1) / simdChunkSize) //nolint:gosec // G115
49-
endChunk = min(endChunk, len(r.state.chunkHasQuote)-1)
50-
51-
return anyChunkHasQuote(r.state.chunkHasQuote, startChunk, endChunk)
52-
}
53-
54-
// anyChunkHasQuote checks if any chunk in the range [start, end] contains a quote.
55-
func anyChunkHasQuote(chunks []bool, start, end int) bool {
56-
for i := start; i <= end; i++ {
57-
if chunks[i] {
58-
return true
59-
}
60-
}
61-
return false
62-
}
63-
6433
// =============================================================================
6534
// Field Extraction - Mechanism for accessing raw field data
6635
// =============================================================================

0 commit comments

Comments
 (0)