mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-22 15:37:51 +00:00
Fix -vet for demo.odin
This commit is contained in:
@@ -17,7 +17,7 @@ unload_library :: proc(library: Library) -> bool {
|
||||
}
|
||||
|
||||
symbol_address :: proc(library: Library, symbol: string) -> (ptr: rawptr, found: bool) {
|
||||
c_str := strings.new_cstring(symbol, context.temp_allocator);
|
||||
c_str := strings.clone_to_cstring(symbol, context.temp_allocator);
|
||||
ptr = win32.get_proc_address(cast(win32.Hmodule)library, c_str);
|
||||
found == ptr != nil;
|
||||
return;
|
||||
|
||||
+6
-6
@@ -153,7 +153,7 @@ foreign dl {
|
||||
}
|
||||
|
||||
open :: proc(path: string, flags: int = O_RDONLY, mode: int = 0) -> (Handle, Errno) {
|
||||
cstr := strings.new_cstring(path);
|
||||
cstr := strings.clone_to_cstring(path);
|
||||
handle := _unix_open(cstr, flags, mode);
|
||||
delete(cstr);
|
||||
if handle == -1 {
|
||||
@@ -221,14 +221,14 @@ is_path_separator :: proc(r: rune) -> bool {
|
||||
|
||||
stat :: inline proc(path: string) -> (Stat, bool) {
|
||||
s: Stat;
|
||||
cstr := strings.new_cstring(path);
|
||||
cstr := strings.clone_to_cstring(path);
|
||||
defer delete(cstr);
|
||||
ret_int := _unix_stat(cstr, &s);
|
||||
return s, ret_int==0;
|
||||
}
|
||||
|
||||
access :: inline proc(path: string, mask: int) -> bool {
|
||||
cstr := strings.new_cstring(path);
|
||||
cstr := strings.clone_to_cstring(path);
|
||||
defer delete(cstr);
|
||||
return _unix_access(cstr, mask) == 0;
|
||||
}
|
||||
@@ -245,7 +245,7 @@ heap_free :: inline proc(ptr: rawptr) {
|
||||
}
|
||||
|
||||
getenv :: proc(name: string) -> (string, bool) {
|
||||
path_str := strings.new_cstring(name);
|
||||
path_str := strings.clone_to_cstring(name);
|
||||
defer delete(path_str);
|
||||
cstr := _unix_getenv(path_str);
|
||||
if cstr == nil {
|
||||
@@ -265,14 +265,14 @@ current_thread_id :: proc "contextless" () -> int {
|
||||
}
|
||||
|
||||
dlopen :: inline proc(filename: string, flags: int) -> rawptr {
|
||||
cstr := strings.new_cstring(filename);
|
||||
cstr := strings.clone_to_cstring(filename);
|
||||
defer delete(cstr);
|
||||
handle := _unix_dlopen(cstr, flags);
|
||||
return handle;
|
||||
}
|
||||
dlsym :: inline proc(handle: rawptr, symbol: string) -> rawptr {
|
||||
assert(handle != nil);
|
||||
cstr := strings.new_cstring(symbol);
|
||||
cstr := strings.clone_to_cstring(symbol);
|
||||
defer delete(cstr);
|
||||
proc_handle := _unix_dlsym(handle, cstr);
|
||||
return proc_handle;
|
||||
|
||||
@@ -236,8 +236,8 @@ quote :: proc(buf: []byte, s: string) -> string {
|
||||
write_byte(buf, &i, digits[s[0]&0xf]);
|
||||
}
|
||||
if i < len(buf) {
|
||||
s := quote_rune(buf[i:], r);
|
||||
i += len(s);
|
||||
x := quote_rune(buf[i:], r);
|
||||
i += len(x);
|
||||
}
|
||||
}
|
||||
write_byte(buf, &i, c);
|
||||
|
||||
@@ -5,7 +5,6 @@ import "core:mem"
|
||||
import "core:os"
|
||||
|
||||
when os.OS == "windows" {
|
||||
import "core:runtime"
|
||||
import "core:thread"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user