Browse Source

Fix -vet for demo.odin

gingerBill 6 years ago
parent
commit
a019059975
4 changed files with 9 additions and 10 deletions
  1. 1 1
      core/dynlib/lib_windows.odin
  2. 6 6
      core/os/os_osx.odin
  3. 2 2
      core/strconv/strconv.odin
  4. 0 1
      examples/demo/demo.odin

+ 1 - 1
core/dynlib/lib_windows.odin

@@ -17,7 +17,7 @@ unload_library :: proc(library: Library) -> bool {
 }
 }
 
 
 symbol_address :: proc(library: Library, symbol: string) -> (ptr: rawptr, found: 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);
 	ptr = win32.get_proc_address(cast(win32.Hmodule)library, c_str);
 	found == ptr != nil;
 	found == ptr != nil;
 	return;
 	return;

+ 6 - 6
core/os/os_osx.odin

@@ -153,7 +153,7 @@ foreign dl {
 }
 }
 
 
 open :: proc(path: string, flags: int = O_RDONLY, mode: int = 0) -> (Handle, Errno) {
 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);
 	handle := _unix_open(cstr, flags, mode);
 	delete(cstr);
 	delete(cstr);
 	if handle == -1 {
 	if handle == -1 {
@@ -221,14 +221,14 @@ is_path_separator :: proc(r: rune) -> bool {
 
 
 stat :: inline proc(path: string) -> (Stat, bool) {
 stat :: inline proc(path: string) -> (Stat, bool) {
 	s: Stat;
 	s: Stat;
-	cstr := strings.new_cstring(path);
+	cstr := strings.clone_to_cstring(path);
 	defer delete(cstr);
 	defer delete(cstr);
 	ret_int := _unix_stat(cstr, &s);
 	ret_int := _unix_stat(cstr, &s);
 	return s, ret_int==0;
 	return s, ret_int==0;
 }
 }
 
 
 access :: inline proc(path: string, mask: int) -> bool {
 access :: inline proc(path: string, mask: int) -> bool {
-	cstr := strings.new_cstring(path);
+	cstr := strings.clone_to_cstring(path);
 	defer delete(cstr);
 	defer delete(cstr);
 	return _unix_access(cstr, mask) == 0;
 	return _unix_access(cstr, mask) == 0;
 }
 }
@@ -245,7 +245,7 @@ heap_free :: inline proc(ptr: rawptr) {
 }
 }
 
 
 getenv :: proc(name: string) -> (string, bool) {
 getenv :: proc(name: string) -> (string, bool) {
-	path_str := strings.new_cstring(name);
+	path_str := strings.clone_to_cstring(name);
 	defer delete(path_str);
 	defer delete(path_str);
 	cstr := _unix_getenv(path_str);
 	cstr := _unix_getenv(path_str);
 	if cstr == nil {
 	if cstr == nil {
@@ -265,14 +265,14 @@ current_thread_id :: proc "contextless" () -> int {
 }
 }
 
 
 dlopen :: inline proc(filename: string, flags: int) -> rawptr {
 dlopen :: inline proc(filename: string, flags: int) -> rawptr {
-	cstr := strings.new_cstring(filename);
+	cstr := strings.clone_to_cstring(filename);
 	defer delete(cstr);
 	defer delete(cstr);
 	handle := _unix_dlopen(cstr, flags);
 	handle := _unix_dlopen(cstr, flags);
 	return handle;
 	return handle;
 }
 }
 dlsym :: inline proc(handle: rawptr, symbol: string) -> rawptr {
 dlsym :: inline proc(handle: rawptr, symbol: string) -> rawptr {
 	assert(handle != nil);
 	assert(handle != nil);
-	cstr := strings.new_cstring(symbol);
+	cstr := strings.clone_to_cstring(symbol);
 	defer delete(cstr);
 	defer delete(cstr);
 	proc_handle := _unix_dlsym(handle, cstr);
 	proc_handle := _unix_dlsym(handle, cstr);
 	return proc_handle;
 	return proc_handle;

+ 2 - 2
core/strconv/strconv.odin

@@ -236,8 +236,8 @@ quote :: proc(buf: []byte, s: string) -> string {
 			write_byte(buf, &i, digits[s[0]&0xf]);
 			write_byte(buf, &i, digits[s[0]&0xf]);
 		}
 		}
 		if i < len(buf) {
 		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);
 	write_byte(buf, &i, c);

+ 0 - 1
examples/demo/demo.odin

@@ -5,7 +5,6 @@ import "core:mem"
 import "core:os"
 import "core:os"
 
 
 when os.OS == "windows" {
 when os.OS == "windows" {
-	import "core:runtime"
 	import "core:thread"
 	import "core:thread"
 }
 }