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

@ -5,9 +5,10 @@ pub fn repeat(c byte, n int) string {
return ''
}
mut arr := malloc(n + 1)
//mut arr := [byte(0); n + 1]
for i := 0; i < n; i++ {
arr[i] = c
}
arr[n] = `\0`
return tos(arr, n)
return string(arr, n)
}