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

@@ -53,10 +53,10 @@ pub fn (mut tf_skl TTF_render_Sokol) create_text(in_txt string, in_font_size f32
// RAM buffer
if sz > tf_skl.bmp.buf_size {
if sz > 0 {
free(tf_skl.bmp.buf)
unsafe {free(tf_skl.bmp.buf)}
}
dprintln('create_text Alloc: $sz bytes')
tf_skl.bmp.buf = malloc(sz)
tf_skl.bmp.buf = unsafe {malloc(sz)}
tf_skl.bmp.buf_size = sz
}
@@ -91,10 +91,10 @@ pub fn (mut tf_skl TTF_render_Sokol) create_text_block(in_txt string, in_w int,
// RAM buffer
if sz > tf_skl.bmp.buf_size {
if sz > 0 {
free(tf_skl.bmp.buf)
unsafe {free(tf_skl.bmp.buf)}
}
dprintln('Alloc: $sz bytes')
tf_skl.bmp.buf = malloc(sz)
tf_skl.bmp.buf = unsafe {malloc(sz)}
tf_skl.bmp.buf_size = sz
}