1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

checker: check unsafe V function calls (#8752)

This commit is contained in:
Nick Treleaven
2021-02-14 18:31:42 +00:00
committed by GitHub
parent d3bcd5d305
commit ea803113c3
36 changed files with 200 additions and 161 deletions

View File

@@ -165,7 +165,7 @@ fn utf8util_char_len(b byte) int {
// up_low make the dirt job
fn up_low(s string, upper_flag bool) string {
mut index := 0
mut str_res := malloc(s.len + 1)
mut str_res := unsafe {malloc(s.len + 1)}
for {
ch_len := utf8util_char_len(s[index])
@@ -289,11 +289,9 @@ fn up_low(s string, upper_flag bool) string {
// for c compatibility set the ending 0
unsafe {
str_res[index] = 0
//C.printf("str_res: %s\n--------------\n",str_res)
return tos(str_res, s.len)
}
//C.printf("str_res: %s\n--------------\n",str_res)
return tos(str_res, s.len)
}
// find_char_in_table utility function for up_low, search utf8 chars in the conversion table