Use long-form names and alias with short-form UNIX-like names

This commit is contained in:
gingerBill
2024-01-29 13:33:39 +00:00
parent 338793b68e
commit a626adac8e
9 changed files with 57 additions and 37 deletions
+8 -1
View File
@@ -74,14 +74,21 @@ read_ptr :: proc(f: ^File, data: rawptr, len: int) -> (n: int, err: Error) {
}
read_entire_file :: proc{
read_entire_file_from_path,
read_entire_file_from_file,
}
read_entire_file :: proc(name: string, allocator: runtime.Allocator) -> (data: []byte, err: Error) {
read_entire_file_from_path :: proc(name: string, allocator: runtime.Allocator) -> (data: []byte, err: Error) {
f, ferr := open(name)
if ferr != nil {
return nil, ferr
}
defer close(f)
return read_entire_file_from_file(f, allocator)
}
read_entire_file_from_file :: proc(f: ^File, allocator: runtime.Allocator) -> (data: []byte, err: Error) {
size: int
if size64, err := file_size(f); err == nil {
if i64(int(size64)) != size64 {