mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-06 14:48:21 +00:00
Merge pull request #6332 from Faker-09/bufio_remove_mem_depend
Remove core:mem import from core:bufio
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
package bufio
|
||||
|
||||
import "base:runtime"
|
||||
import "core:io"
|
||||
import "core:mem"
|
||||
import "core:unicode/utf8"
|
||||
import "core:bytes"
|
||||
|
||||
// Reader is a buffered wrapper for an io.Reader
|
||||
Reader :: struct {
|
||||
buf: []byte,
|
||||
buf_allocator: mem.Allocator,
|
||||
buf_allocator: runtime.Allocator,
|
||||
|
||||
rd: io.Reader, // reader
|
||||
r, w: int, // read and write positions for buf
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package bufio
|
||||
|
||||
import "core:bytes"
|
||||
import "core:io"
|
||||
import "core:mem"
|
||||
import "core:unicode/utf8"
|
||||
import "base:runtime"
|
||||
import "base:intrinsics"
|
||||
import "core:io"
|
||||
import "core:bytes"
|
||||
import "core:unicode/utf8"
|
||||
|
||||
// Extra errors returns by scanning procedures
|
||||
Scanner_Extra_Error :: enum i32 {
|
||||
@@ -60,7 +60,15 @@ scanner_init_with_buffer :: proc(s: ^Scanner, r: io.Reader, buf: []byte) -> ^Sca
|
||||
s.r = r
|
||||
s.split = scan_lines
|
||||
s.max_token_size = DEFAULT_MAX_SCAN_TOKEN_SIZE
|
||||
s.buf = mem.buffer_from_slice(buf)
|
||||
s.buf = transmute([dynamic]byte)runtime.Raw_Dynamic_Array{
|
||||
data = raw_data(buf),
|
||||
len = 0,
|
||||
cap = len(buf),
|
||||
allocator = runtime.Allocator{
|
||||
procedure = runtime.nil_allocator_proc,
|
||||
data = nil,
|
||||
},
|
||||
}
|
||||
resize(&s.buf, cap(s.buf))
|
||||
return s
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package bufio
|
||||
|
||||
import "base:runtime"
|
||||
import "core:io"
|
||||
import "core:mem"
|
||||
import "core:unicode/utf8"
|
||||
// import "core:bytes"
|
||||
|
||||
// Writer is a buffered wrapper for an io.Writer
|
||||
Writer :: struct {
|
||||
buf: []byte,
|
||||
buf_allocator: mem.Allocator,
|
||||
buf_allocator: runtime.Allocator,
|
||||
|
||||
wr: io.Writer,
|
||||
n: int,
|
||||
|
||||
Reference in New Issue
Block a user