Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions kframework_ffi/src/kllvm/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ impl fmt::Display for Block {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let result = unsafe {
let c_str = ffi::kore_block_dump(self.block);
let result = CStr::from_ptr(c_str)
.to_str()
.expect("Failed to convert kllvm::Block to &str")
.to_string();
let bytes = CStr::from_ptr(c_str).to_bytes();
let result: String = bytes.iter().map(|&b| b as char).collect();
libc::free(c_str as *mut c_void);
result
};
write!(f, "{}", result)
f.write_str(&result)
}
}

Expand Down
Loading