builtin: remove unneeded casts

pull/3659/head
Alexander Medvednikov 2020-02-05 11:22:17 +01:00
parent efaca5974c
commit 06b5f43e48
2 changed files with 10 additions and 9 deletions

View File

@ -63,8 +63,8 @@ fn print_backtrace_skipping_top_frames_nix(xskipframes int) bool {
fn print_backtrace_skipping_top_frames_mac(skipframes int) bool {
$if macos {
buffer := [100]byteptr
nr_ptrs := C.backtrace(*voidptr(buffer), 100)
C.backtrace_symbols_fd(*voidptr(&buffer[skipframes]), nr_ptrs - skipframes, 1)
nr_ptrs := C.backtrace(buffer, 100)
C.backtrace_symbols_fd(&buffer[skipframes], nr_ptrs - skipframes, 1)
}
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 {
$if freebsd {
buffer := [100]byteptr
nr_ptrs := C.backtrace(*voidptr(buffer), 100)
C.backtrace_symbols_fd(*voidptr(&buffer[skipframes]), nr_ptrs - skipframes, 1)
nr_ptrs := C.backtrace(buffer, 100)
C.backtrace_symbols_fd(&buffer[skipframes], nr_ptrs - skipframes, 1)
}
return true
}
@ -87,10 +87,11 @@ fn print_backtrace_skipping_top_frames_linux(skipframes int) bool {
// backtrace is not available on Android.
$if glibc {
buffer := [100]byteptr
nr_ptrs := C.backtrace(*voidptr(buffer), 100)
nr_ptrs := C.backtrace(buffer, 100)
nr_actual_frames := nr_ptrs - skipframes
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 {
sframes << tos2(csymbols[i])
}
@ -107,11 +108,11 @@ fn print_backtrace_skipping_top_frames_linux(skipframes int) bool {
}
buf := [1000]byte
mut output := ''
for C.fgets(voidptr(buf), 1000, f) != 0 {
for C.fgets(buf, 1000, f) != 0 {
output += tos(buf, vstrlen(buf))
}
output = output.trim_space() + ':'
if 0 != C.pclose(f) {
if C.pclose(f) != 0 {
println(sframe)
continue
}

View File

@ -469,7 +469,7 @@ pub fn (s string) split_into_lines() []string {
mut start := 0
for i := 0; i < s.len; i++ {
last := i == s.len - 1
if int(s[i]) == 10 || last {
if s[i] == 10 || last {
if last {
i++
}