Skip to content

Commit e05cacd

Browse files
authored
Merge pull request #43 from staticfloat/sf/rpath_type_stability
Improve type stability of `rpaths(RPath(oh::ELFHandle))`
2 parents 2dce787 + 6ec5680 commit e05cacd

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/ELF/ELFDynamicLink.jl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Stores the RPath entries from an ELF object
8989
"""
9090
struct ELFRPath{H <: ELFHandle} <: RPath{H}
9191
section_ref::SectionRef{H}
92-
rpath::Vector
92+
rpath::Vector{<:AbstractString}
9393
end
9494

9595
"""
@@ -106,13 +106,18 @@ function RPath(oh::ELFHandle)
106106
des = ELFDynEntries(oh, [DT_RPATH, DT_RUNPATH])
107107

108108
# Lookup each and every one of those strings, split them out into paths
109-
colon_paths = [strtab_lookup(d) for d in des]
110-
paths = vcat([split(p, ":") for p in colon_paths]...)
109+
colon_paths = String[strtab_lookup(d) for d in des]
110+
paths = AbstractString[]
111+
for colon_path in colon_paths
112+
for component in split(colon_path, ':')
113+
push!(paths, component)
114+
end
115+
end
111116

112117
# Return our RPath object
113118
return ELFRPath(dyn_section, paths)
114119
end
115120

116121
Section(rpath::ELFRPath) = rpath.section_ref
117122
handle(rpath::ELFRPath) = handle(Section(rpath))
118-
rpaths(rpath::ELFRPath) = rpath.rpath
123+
rpaths(rpath::ELFRPath) = rpath.rpath

0 commit comments

Comments
 (0)