mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-01 20:28:15 +00:00
Clean up of the core library to make the stream vtables not be pointers directly.
This commit is contained in:
@@ -4,7 +4,7 @@ import "core:io"
|
||||
|
||||
to_stream :: proc(f: ^File) -> (s: io.Stream) {
|
||||
s.stream_data = f
|
||||
s.stream_vtable = _file_stream_vtable
|
||||
s.stream_vtable = &_file_stream_vtable
|
||||
return
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ error_to_io_error :: proc(ferr: Error) -> io.Error {
|
||||
|
||||
|
||||
@(private)
|
||||
_file_stream_vtable := &io.Stream_VTable{
|
||||
_file_stream_vtable := io.Stream_VTable{
|
||||
impl_read = proc(s: io.Stream, p: []byte) -> (n: int, err: io.Error) {
|
||||
f := (^File)(s.stream_data)
|
||||
ferr: Error
|
||||
|
||||
+2
-2
@@ -5,13 +5,13 @@ import "core:io"
|
||||
stream_from_handle :: proc(fd: Handle) -> io.Stream {
|
||||
s: io.Stream
|
||||
s.stream_data = rawptr(uintptr(fd))
|
||||
s.stream_vtable = _file_stream_vtable
|
||||
s.stream_vtable = &_file_stream_vtable
|
||||
return s
|
||||
}
|
||||
|
||||
|
||||
@(private)
|
||||
_file_stream_vtable := &io.Stream_VTable{
|
||||
_file_stream_vtable := io.Stream_VTable{
|
||||
impl_read = proc(s: io.Stream, p: []byte) -> (n: int, err: io.Error) {
|
||||
fd := Handle(uintptr(s.stream_data))
|
||||
os_err: Errno
|
||||
|
||||
Reference in New Issue
Block a user