Skip to content

Commit 45cbcda

Browse files
Copilotenghitalo
andcommitted
wasm: fix unsafe block consistency in array.v
Removed unsafe blocks around vcalloc calls to match the main builtin/array.v implementation exactly. This ensures consistency between the WASM and C backend implementations. Co-authored-by: enghitalo <63821277+enghitalo@users.noreply.github.com>
1 parent 9aa3064 commit 45cbcda

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

vlib/builtin/wasm/array.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn __new_array(mylen int, cap int, elm_size int) array {
5555
cap_ := if cap < mylen { mylen } else { cap }
5656
arr := array{
5757
element_size: elm_size
58-
data: unsafe { vcalloc(u64(cap_) * u64(elm_size)) }
58+
data: vcalloc(u64(cap_) * u64(elm_size))
5959
len: mylen
6060
cap: cap_
6161
}
@@ -75,7 +75,7 @@ fn __new_array_with_default(mylen int, cap int, elm_size int, val voidptr) array
7575
if cap_ > 0 && mylen == 0 {
7676
arr.data = unsafe { malloc(__at_least_one(total_size)) }
7777
} else {
78-
arr.data = unsafe { vcalloc(total_size) }
78+
arr.data = vcalloc(total_size)
7979
}
8080
if val != 0 {
8181
mut eptr := &u8(arr.data)

0 commit comments

Comments
 (0)