Merge branch 'master' into llvm-integration

This commit is contained in:
gingerBill
2020-03-15 14:31:26 +00:00
12 changed files with 119 additions and 32 deletions
+7 -7
View File
@@ -87,11 +87,11 @@ read_entire_file :: proc(name: string) -> (data: []byte, success: bool) {
}
bytes_read, read_err := read(fd, data);
if read_err != 0 {
if read_err != ERROR_NONE {
delete(data);
return nil, false;
}
return data[0:bytes_read], true;
return data[:bytes_read], true;
}
write_entire_file :: proc(name: string, data: []byte, truncate := true) -> (success: bool) {
@@ -100,11 +100,11 @@ write_entire_file :: proc(name: string, data: []byte, truncate := true) -> (succ
flags |= O_TRUNC;
}
mode: int = 0;
when OS == "linux" {
// NOTE(justasd): 644 (owner read, write; group read; others read)
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
}
mode: int = 0;
when OS == "linux" {
// NOTE(justasd): 644 (owner read, write; group read; others read)
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
}
fd, err := open(name, flags, mode);
if err != 0 {
+1 -1
View File
@@ -124,7 +124,7 @@ default_temp_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode
clear(&allocator.leaked_allocations);
case .Resize:
last_ptr := rawptr(&allocator.data[allocator.prev_offset]);
last_ptr := #no_bounds_check rawptr(&allocator.data[allocator.prev_offset]);
if old_memory == last_ptr && len(allocator.data)-allocator.prev_offset >= size {
allocator.curr_offset = allocator.prev_offset+size;
return old_memory;
+5 -5
View File
@@ -10,11 +10,11 @@ foreign kernel32 {
inherit_handle: Bool, creation_flags: u32, environment: rawptr,
current_direcotry: cstring, startup_info: ^Startup_Info,
process_information: ^Process_Information) -> Bool ---;
@(link_name="CreateProcessW") create_process_w :: proc(application_name, command_line: Wstring,
process_attributes, thread_attributes: ^Security_Attributes,
inherit_handle: Bool, creation_flags: u32, environment: rawptr,
current_direcotry: cstring, startup_info: ^Startup_Info,
process_information: ^Process_Information) -> Bool ---;
@(link_name="CreateProcessW") create_process_w :: proc(application_name, command_line: Wstring,
process_attributes, thread_attributes: ^Security_Attributes,
inherit_handle: Bool, creation_flags: u32, environment: rawptr,
current_direcotry: cstring, startup_info: ^Startup_Info,
process_information: ^Process_Information) -> Bool ---;
@(link_name="GetExitCodeProcess") get_exit_code_process :: proc(process: Handle, exit: ^u32) -> Bool ---;
@(link_name="ExitProcess") exit_process :: proc(exit_code: u32) ---;
@(link_name="GetModuleHandleA") get_module_handle_a :: proc(module_name: cstring) -> Hmodule ---;