Skip to content

Commit 64a1915

Browse files
committed
ELFSegments should inherit from Segments
1 parent 51ebf13 commit 64a1915

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

src/ELF/ELFSegment.jl

+1-19
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,12 @@ export ELFSegments, ELFSegment, ELFSegment32, ELFSegment64
66
ELF segment header table type, containing information about the number of
77
segments within the ELF object, the location of the segment headers, etc...
88
"""
9-
struct ELFSegments{H <: ELFHandle}
9+
struct ELFSegments{H <: ELFHandle} <: Segments{H}
1010
handle::H
1111
end
1212
Segments(oh::ELFHandle) = ELFSegments(oh)
1313
handle(segs::ELFSegments) = segs.handle
14-
15-
# Iteration
16-
iterate(segs::ELFSegments, idx=1) = idx > length(segs) ? nothing : (segs[idx], idx+1)
1714
lastindex(segs::ELFSegments) = header(handle(segs)).e_phnum
18-
length(segs::ELFSegments) = lastindex(segs)
19-
eltype(::Type{S}) where {S <: ELFSegments} = ELFSegmentRef
20-
21-
function getindex(segs::ELFSegments{H}, idx) where {H <: ELFHandle}
22-
# Punt off to `getindex_ref`
23-
oh = handle(segs)
24-
return getindex_ref(
25-
segs,
26-
segment_header_offset(oh),
27-
segment_header_size(oh),
28-
segment_header_type(oh),
29-
SegmentRef,
30-
idx
31-
)
32-
end
3315

3416

3517
"""

0 commit comments

Comments
 (0)