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:
parent
c203a744fe
commit
59a65d757b
@ -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] )
|
||||
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user