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

builtin: remove commented code; improve print_backtrace with tcc

This commit is contained in:
Delyan Angelov
2021-05-23 12:37:23 +03:00
parent a08cbd364a
commit a27e7f7675
3 changed files with 54 additions and 69 deletions

View File

@@ -1521,20 +1521,21 @@ pub fn (c byte) is_letter() bool {
}
// free allows for manually freeing the memory occupied by the string
[unsafe]
[manualfree; unsafe]
pub fn (s &string) free() {
$if prealloc {
return
}
if s.is_lit == -98761234 {
dsfree_msg := c'double string.free() detected\n'
$if freestanding {
bare_eprint(c'double string.free() detected\n', u64(unsafe { C.strlen(c'double string.free() detected\n') }))
bare_eprint(dsfree_msg, u64(unsafe { C.strlen(dsfree_msg) }))
} $else {
C.printf(c'double string.free() detected\n')
C.printf(dsfree_msg)
}
return
}
if s.is_lit == 1 || s.len == 0 {
if s.is_lit == 1 || s.len == 0 || s.str == 0 {
return
}
unsafe {