Skip to content

Commit

Permalink
use constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
taegyunkim committed May 31, 2024
1 parent 78d2c05 commit 0d54ad0
Showing 1 changed file with 25 additions and 27 deletions.
52 changes: 25 additions & 27 deletions profiling/src/internal/profile/fuzz_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,33 +304,31 @@ fn assert_samples_eq(
let function = profile.functions[line.function_id as usize - 1];
assert!(!location.is_folded);

let owned_location = Location {
mapping: Mapping {
memory_start: mapping.memory_start,
memory_limit: mapping.memory_limit,
file_offset: mapping.file_offset,
filename: profile.string_table[mapping.filename as usize]
.clone()
.into_boxed_str(),
build_id: profile.string_table[mapping.build_id as usize]
.clone()
.into_boxed_str(),
},
function: Function {
name: profile.string_table[function.name as usize]
.clone()
.into_boxed_str(),
system_name: profile.string_table[function.system_name as usize]
.clone()
.into_boxed_str(),
filename: profile.string_table[function.filename as usize]
.clone()
.into_boxed_str(),
start_line: function.start_line,
},
address: location.address,
line: line.line,
};
let owned_mapping = Mapping::new(
mapping.memory_start,
mapping.memory_limit,
mapping.file_offset,
profile.string_table[mapping.filename as usize]
.clone()
.into_boxed_str(),
profile.string_table[mapping.build_id as usize]
.clone()
.into_boxed_str(),
);
let owned_function = Function::new(
profile.string_table[function.name as usize]
.clone()
.into_boxed_str(),
profile.string_table[function.system_name as usize]
.clone()
.into_boxed_str(),
profile.string_table[function.filename as usize]
.clone()
.into_boxed_str(),
function.start_line,
);
let owned_location =
Location::new(owned_mapping, owned_function, location.address, line.line);

owned_locations.push(owned_location);
}
Expand Down

0 comments on commit 0d54ad0

Please sign in to comment.