From 81b1b882fd83dad3523dfced2c9132fe5fab589a Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sun, 20 Oct 2019 20:29:24 +0300 Subject: [PATCH] bultin: mark unsafe functions --- vlib/builtin/builtin.v | 4 +++- vlib/strings/builder_c.v | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/vlib/builtin/builtin.v b/vlib/builtin/builtin.v index e630f40dbf..9f5e07a601 100644 --- a/vlib/builtin/builtin.v +++ b/vlib/builtin/builtin.v @@ -67,7 +67,7 @@ pub fn print_backtrace_skipping_top_frames(skipframes int) { buf := [1000]byte mut output := '' for C.fgets(buf, 1000, f) != 0 { - output += tos(buf, vstrlen(buf)) + output += tos(buf, vstrlen(buf)) } output = output.trim_space()+':' if 0 != int(C.pclose(f)) { @@ -153,6 +153,7 @@ pub fn print(s string) { __global total_m i64 = 0 //__global nr_mallocs int = 0 +[unsafe_fn] pub fn malloc(n int) byteptr { if n < 0 { panic('malloc(<0)') @@ -185,6 +186,7 @@ pub fn calloc(n int) byteptr { return C.calloc(n, 1) } +[unsafe_fn] pub fn free(ptr voidptr) { C.free(ptr) } diff --git a/vlib/strings/builder_c.v b/vlib/strings/builder_c.v index b26ca5e4ec..f401d08872 100644 --- a/vlib/strings/builder_c.v +++ b/vlib/strings/builder_c.v @@ -39,5 +39,5 @@ pub fn (b mut Builder) cut(n int) { } pub fn (b mut Builder) free() { - free(b.buf.data) + //free(b.buf.data) }