mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
bultin: mark unsafe functions
This commit is contained in:
parent
c13b58e6db
commit
81b1b882fd
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user