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

v/checker.v: disallow pointer arithmetic for InfixExpr outside unsafe {} (#5640)

This commit is contained in:
Nick Treleaven
2020-07-03 17:10:10 +01:00
committed by GitHub
parent a2395ff3e8
commit 0b49e4db1c
13 changed files with 221 additions and 93 deletions

View File

@ -48,7 +48,9 @@ fn new_sorted_map(n, value_bytes int) SortedMap { // TODO: Remove `n`
fn new_sorted_map_init(n, value_bytes int, keys &string, values voidptr) SortedMap {
mut out := new_sorted_map(n, value_bytes)
for i in 0 .. n {
out.set(keys[i], byteptr(values) + i * value_bytes)
unsafe {
out.set(keys[i], byteptr(values) + i * value_bytes)
}
}
return out
}