Skip to content

Commit

Permalink
format a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jul 7, 2019
1 parent f5b3021 commit 076a5cd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/librustc_codegen_llvm/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,13 @@ fn search_meta_section<'a>(of: &'a ObjectFile,
let mut name_buf = None;
let name_len = llvm::LLVMRustGetSectionName(si.llsi, &mut name_buf);
let name = name_buf.map_or(
"".to_string(),
String::new(), // We got a NULL ptr, ignore `name_len`.
|buf| String::from_utf8(
slice::from_raw_parts(buf.as_ptr() as *const u8,
name_len as usize)
.to_vec()).unwrap());
.to_vec()
).unwrap()
);
debug!("get_metadata_section: name {}", name);
if read_metadata_section_name(target) == name {
let cbuf = llvm::LLVMGetSectionContents(si.llsi);
Expand Down

0 comments on commit 076a5cd

Please sign in to comment.