Remove len(), cap() and replace with selectors; fix defer in match

This commit is contained in:
Ginger Bill
2016-09-13 14:04:05 +01:00
parent 59fb74d2a2
commit 817ae643c5
11 changed files with 454 additions and 333 deletions
+2 -2
View File
@@ -31,7 +31,7 @@ file_close :: proc(f: ^File) {
file_write :: proc(f: ^File, buf: []byte) -> bool {
bytes_written: i32
return WriteFile(f.handle, ^buf[0], len(buf) as i32, ^bytes_written, null) != 0
return WriteFile(f.handle, ^buf[0], buf.count as i32, ^bytes_written, null) != 0
}
File_Standard :: type enum {
@@ -95,7 +95,7 @@ read_entire_file :: proc(name: string) -> (string, bool) {
ReadFile(f.handle as HANDLE, ^data[total_read], to_read, ^single_read_length, null)
if single_read_length <= 0 {
delete(data)
free(^data[0])
return "", false
}