bultin: mark unsafe functions

pull/2460/head
Alexander Medvednikov 2019-10-20 20:29:24 +03:00
parent c13b58e6db
commit 81b1b882fd
2 changed files with 4 additions and 2 deletions

View File

@ -67,7 +67,7 @@ pub fn print_backtrace_skipping_top_frames(skipframes int) {
buf := [1000]byte buf := [1000]byte
mut output := '' mut output := ''
for C.fgets(buf, 1000, f) != 0 { for C.fgets(buf, 1000, f) != 0 {
output += tos(buf, vstrlen(buf)) output += tos(buf, vstrlen(buf))
} }
output = output.trim_space()+':' output = output.trim_space()+':'
if 0 != int(C.pclose(f)) { if 0 != int(C.pclose(f)) {
@ -153,6 +153,7 @@ pub fn print(s string) {
__global total_m i64 = 0 __global total_m i64 = 0
//__global nr_mallocs int = 0 //__global nr_mallocs int = 0
[unsafe_fn]
pub fn malloc(n int) byteptr { pub fn malloc(n int) byteptr {
if n < 0 { if n < 0 {
panic('malloc(<0)') panic('malloc(<0)')
@ -185,6 +186,7 @@ pub fn calloc(n int) byteptr {
return C.calloc(n, 1) return C.calloc(n, 1)
} }
[unsafe_fn]
pub fn free(ptr voidptr) { pub fn free(ptr voidptr) {
C.free(ptr) C.free(ptr)
} }

View File

@ -39,5 +39,5 @@ pub fn (b mut Builder) cut(n int) {
} }
pub fn (b mut Builder) free() { pub fn (b mut Builder) free() {
free(b.buf.data) //free(b.buf.data)
} }