From 962ac396707df4ce2142ed965814bf3d46e4e2e0 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Tue, 23 Sep 2025 14:38:18 -0700 Subject: [PATCH] cleanup: simplify scan for xcoff .text section As s_name is an 8-byte array, and we check only for ASCII characters, checking for UTF-8 validity is pure overhead. --- src/symbolize/gimli/xcoff.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/symbolize/gimli/xcoff.rs b/src/symbolize/gimli/xcoff.rs index 18c61cbd..51f00a8a 100644 --- a/src/symbolize/gimli/xcoff.rs +++ b/src/symbolize/gimli/xcoff.rs @@ -64,13 +64,7 @@ pub fn parse_xcoff(data: &[u8]) -> Option { let header = Xcoff::parse(data, &mut offset).ok()?; let _ = header.aux_header(data, &mut offset).ok()?; let sections = header.sections(data, &mut offset).ok()?; - if let Some(section) = sections.iter().find(|s| { - if let Ok(name) = str::from_utf8(&s.s_name()[0..5]) { - name == ".text" - } else { - false - } - }) { + if let Some(section) = sections.iter().find(|s| s.s_name().get(0..5) == b".text") { Some(Image { offset: section.s_scnptr() as usize, base: section.s_paddr() as u64,