From 00b4391a586864987a9c46dca7e0f4876e1c1ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20M=C3=BCller?= Date: Mon, 25 Sep 2023 10:01:46 -0700 Subject: [PATCH] Use read_elf_build_id() more MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change switches two uses of DefaultBuildIdReader::read_build_id_from_elf() over to using the simpler read_elf_build_id() API. Signed-off-by: Daniel Müller --- src/normalize/normalizer.rs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/normalize/normalizer.rs b/src/normalize/normalizer.rs index 54fdd73a..7f067262 100644 --- a/src/normalize/normalizer.rs +++ b/src/normalize/normalizer.rs @@ -109,8 +109,7 @@ mod tests { use crate::inspect::FindAddrOpts; use crate::inspect::SymType; use crate::mmap::Mmap; - use crate::normalize::buildid::BuildIdReader; - use crate::normalize::buildid::DefaultBuildIdReader; + use crate::normalize::buildid::read_elf_build_id; use crate::normalize::ApkElf; use crate::normalize::Elf; use crate::normalize::Unknown; @@ -235,11 +234,7 @@ mod tests { .join("data") .join("libtest-so.so"); let expected_elf = Elf { - build_id: Some( - DefaultBuildIdReader::read_build_id_from_elf(&so_path) - .unwrap() - .unwrap(), - ), + build_id: Some(read_elf_build_id(&so_path).unwrap().unwrap()), path: so_path, _non_exhaustive: (), }; @@ -305,11 +300,7 @@ mod tests { let expected = ApkElf { apk_path: test_zip, elf_path: PathBuf::from(so_name), - elf_build_id: Some( - DefaultBuildIdReader::read_build_id_from_elf(&so_path) - .unwrap() - .unwrap(), - ), + elf_build_id: Some(read_elf_build_id(&so_path).unwrap().unwrap()), _non_exhaustive: (), }; assert_eq!(meta, &UserAddrMeta::ApkElf(expected));