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

examples: use vcalloc

This commit is contained in:
Alexander Medvednikov 2020-03-04 17:28:05 +01:00
parent c203a744fe
commit 59a65d757b
2 changed files with 80 additions and 80 deletions

View File

@ -46,8 +46,8 @@ fn new_automaton(f [][]int) Automaton {
maxx = f[y].len
}
}
field := &A2D{ maxx: maxx maxy: maxy data: &int( calloc( sizeof(int) * maxy * maxx ) ) }
new_field := &A2D{ maxx: maxx maxy: maxy data: &int( calloc( sizeof(int) * maxy * maxx ) ) }
field := &A2D{ maxx: maxx maxy: maxy data: &int( vcalloc( sizeof(int) * maxy * maxx ) ) }
new_field := &A2D{ maxx: maxx maxy: maxy data: &int( vcalloc( sizeof(int) * maxy * maxx ) ) }
for y in 0..field.maxy {
for x in 0..field.maxx {
field.set( x, y, f[y][x] )

View File

@ -94,7 +94,7 @@ fn new_image(w int, h int) Image {
return Image{
width: w,
height: h,
data: &Vec(calloc(sizeof(Vec)*w*h))
data: &Vec(vcalloc(sizeof(Vec)*w*h))
}
}