1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

free/malloc fixes

This commit is contained in:
Alexander Medvednikov
2019-07-21 12:22:41 +02:00
parent 975286302c
commit 6e6f6bc387
6 changed files with 31 additions and 22 deletions

View File

@@ -7,25 +7,25 @@ module builtin
pub fn (d double) str() string {
buf := malloc(sizeof(double) * 5 + 1)// TODO
C.sprintf(buf, '%f', d)
return tos(buf, _strlen(buf))
return tos(buf, strlen(buf))
}
pub fn (d f64) str() string {
buf := malloc(sizeof(double) * 5 + 1)// TODO
C.sprintf(buf, '%f', d)
return tos(buf, _strlen(buf))
return tos(buf, strlen(buf))
}
pub fn (d f32) str() string {
buf := malloc(sizeof(double) * 5 + 1)// TODO
C.sprintf(buf, '%f', d)
return tos(buf, _strlen(buf))
return tos(buf, strlen(buf))
}
pub fn ptr_str(ptr voidptr) string {
buf := malloc(sizeof(double) * 5 + 1)// TODO
C.sprintf(buf, '%p', ptr)
return tos(buf, _strlen(buf))
return tos(buf, strlen(buf))
}
// fn (nn i32) str() string {