Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 4 additions & 5 deletions src/archive_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,11 +588,10 @@ fn write_symbols(

// If EC is enabled, then the import descriptors are NOT put into EC
// objects so we need to copy them to the EC map manually.
if let Some(ec_map) = &mut ec_map
&& is_import_descriptor(name)
{
ec_map.insert(name.to_vec().into_boxed_slice(), index);
}
ec_map.as_mut().and_then(|ec_map| {
is_import_descriptor(name)
.then(|| ec_map.insert(name.to_vec().into_boxed_slice(), index))
});
}
} else {
ret.push(sym_names.stream_position()?);
Expand Down
9 changes: 3 additions & 6 deletions src/coff_import_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,9 @@ fn set_name_to_string_table_entry(symbol: &mut ImageSymbol, offset: usize) {

fn apply_name_type(import_type: ImportNameType, name: &str) -> &str {
fn ltrim1<'a>(name: &'a str, chars: &str) -> &'a str {
if let Some((first_char, rest)) = name.split_at_checked(1)
&& chars.contains(first_char)
{
return rest;
}
name
name.split_at_checked(1)
.and_then(|(first_char, rest)| chars.contains(first_char).then_some(rest))
.unwrap_or(name)
}

match import_type {
Expand Down
Loading