mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-05 10:14:05 +00:00
Only override the comma value on *_init if it is "invalid"
This commit is contained in:
@@ -91,7 +91,10 @@ DEFAULT_RECORD_BUFFER_CAPACITY :: 256
|
||||
|
||||
// reader_init initializes a new Reader from r
|
||||
reader_init :: proc(reader: ^Reader, r: io.Reader, buffer_allocator := context.allocator) {
|
||||
reader.comma = ','
|
||||
switch reader.comma {
|
||||
case '\x00', '\n', '\r', 0xfffd:
|
||||
reader.comma = ','
|
||||
}
|
||||
|
||||
context.allocator = buffer_allocator
|
||||
reserve(&reader.record_buffer, DEFAULT_RECORD_BUFFER_CAPACITY)
|
||||
|
||||
@@ -17,7 +17,10 @@ Writer :: struct {
|
||||
|
||||
// writer_init initializes a Writer that writes to w
|
||||
writer_init :: proc(writer: ^Writer, w: io.Writer) {
|
||||
writer.comma = ','
|
||||
switch writer.comma {
|
||||
case '\x00', '\n', '\r', 0xfffd:
|
||||
writer.comma = ','
|
||||
}
|
||||
writer.w = w
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user