Skip to content

Commit 491ea5b

Browse files
Use a superpub field in MapsEntry
This may eliminate some of the overhead of a getter. Also use a slightly more modern code style.
1 parent 44c7461 commit 491ea5b

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/symbolize/gimli/libs_dl_iterate_phdr.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@ fn infer_current_exe(
3636
#[cfg(not(target_os = "hurd"))]
3737
if let Some(entries) = maps {
3838
let opt_path = entries
39-
.iter()
40-
.find(|e| e.ip_matches(base_addr) && e.pathname().len() > 0)
41-
.map(|e| e.pathname())
42-
.cloned();
39+
.into_iter()
40+
.find(|e| e.ip_matches(base_addr) && !e.pathname.is_empty())
41+
.map(|e| e.pathname);
4342
if let Some(path) = opt_path {
4443
return path;
4544
}

src/symbolize/gimli/parse_running_mmaps_unix.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub(super) struct MapsEntry {
5252
/// in general the pathname may be ambiguous. (I.e. you cannot tell if the
5353
/// denoted filename actually ended with the text "(deleted)", or if that
5454
/// was added by the maps rendering.
55-
pathname: OsString,
55+
pub(super) pathname: OsString,
5656
}
5757

5858
pub(super) fn parse_maps() -> Result<Vec<MapsEntry>, &'static str> {
@@ -72,11 +72,6 @@ pub(super) fn parse_maps() -> Result<Vec<MapsEntry>, &'static str> {
7272
}
7373

7474
impl MapsEntry {
75-
#[inline]
76-
pub(super) fn pathname(&self) -> &OsString {
77-
&self.pathname
78-
}
79-
8075
#[inline]
8176
pub(super) fn ip_matches(&self, ip: usize) -> bool {
8277
self.address.0 <= ip && ip < self.address.1

0 commit comments

Comments
 (0)