builtin: remove unneeded casts
parent
efaca5974c
commit
06b5f43e48
|
@ -63,8 +63,8 @@ fn print_backtrace_skipping_top_frames_nix(xskipframes int) bool {
|
||||||
fn print_backtrace_skipping_top_frames_mac(skipframes int) bool {
|
fn print_backtrace_skipping_top_frames_mac(skipframes int) bool {
|
||||||
$if macos {
|
$if macos {
|
||||||
buffer := [100]byteptr
|
buffer := [100]byteptr
|
||||||
nr_ptrs := C.backtrace(*voidptr(buffer), 100)
|
nr_ptrs := C.backtrace(buffer, 100)
|
||||||
C.backtrace_symbols_fd(*voidptr(&buffer[skipframes]), nr_ptrs - skipframes, 1)
|
C.backtrace_symbols_fd(&buffer[skipframes], nr_ptrs - skipframes, 1)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -72,8 +72,8 @@ fn print_backtrace_skipping_top_frames_mac(skipframes int) bool {
|
||||||
fn print_backtrace_skipping_top_frames_freebsd(skipframes int) bool {
|
fn print_backtrace_skipping_top_frames_freebsd(skipframes int) bool {
|
||||||
$if freebsd {
|
$if freebsd {
|
||||||
buffer := [100]byteptr
|
buffer := [100]byteptr
|
||||||
nr_ptrs := C.backtrace(*voidptr(buffer), 100)
|
nr_ptrs := C.backtrace(buffer, 100)
|
||||||
C.backtrace_symbols_fd(*voidptr(&buffer[skipframes]), nr_ptrs - skipframes, 1)
|
C.backtrace_symbols_fd(&buffer[skipframes], nr_ptrs - skipframes, 1)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -87,10 +87,11 @@ fn print_backtrace_skipping_top_frames_linux(skipframes int) bool {
|
||||||
// backtrace is not available on Android.
|
// backtrace is not available on Android.
|
||||||
$if glibc {
|
$if glibc {
|
||||||
buffer := [100]byteptr
|
buffer := [100]byteptr
|
||||||
nr_ptrs := C.backtrace(*voidptr(buffer), 100)
|
nr_ptrs := C.backtrace(buffer, 100)
|
||||||
nr_actual_frames := nr_ptrs - skipframes
|
nr_actual_frames := nr_ptrs - skipframes
|
||||||
mut sframes := []string
|
mut sframes := []string
|
||||||
csymbols := C.backtrace_symbols(*voidptr(&buffer[skipframes]), nr_actual_frames)
|
//////csymbols := C.backtrace_symbols(*voidptr(&buffer[skipframes]), nr_actual_frames)
|
||||||
|
csymbols := C.backtrace_symbols(&buffer[skipframes], nr_actual_frames)
|
||||||
for i in 0 .. nr_actual_frames {
|
for i in 0 .. nr_actual_frames {
|
||||||
sframes << tos2(csymbols[i])
|
sframes << tos2(csymbols[i])
|
||||||
}
|
}
|
||||||
|
@ -107,11 +108,11 @@ fn print_backtrace_skipping_top_frames_linux(skipframes int) bool {
|
||||||
}
|
}
|
||||||
buf := [1000]byte
|
buf := [1000]byte
|
||||||
mut output := ''
|
mut output := ''
|
||||||
for C.fgets(voidptr(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 != C.pclose(f) {
|
if C.pclose(f) != 0 {
|
||||||
println(sframe)
|
println(sframe)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
@ -469,7 +469,7 @@ pub fn (s string) split_into_lines() []string {
|
||||||
mut start := 0
|
mut start := 0
|
||||||
for i := 0; i < s.len; i++ {
|
for i := 0; i < s.len; i++ {
|
||||||
last := i == s.len - 1
|
last := i == s.len - 1
|
||||||
if int(s[i]) == 10 || last {
|
if s[i] == 10 || last {
|
||||||
if last {
|
if last {
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue