Commit 54a59e00 authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

[cleanup] Remove at() from ZoneChunkList

We should probably discourage random access given that it isn't
constant time for this data structure. You can always still do it
via the Find() function if you really need to - at least the weird
interface tells you that something strange is going on.

Change-Id: I5e20cf9172afaa9265f1a6e38f619543b65614f2
Reviewed-on: https://chromium-review.googlesource.com/1184916Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55317}
parent 827e6d12
......@@ -617,7 +617,7 @@ class ELF BASE_EMBEDDED {
WriteSections(w);
}
ELFSection* SectionAt(uint32_t index) { return sections_.at(index); }
ELFSection* SectionAt(uint32_t index) { return *sections_.Find(index); }
size_t AddSection(ELFSection* section) {
sections_.push_back(section);
......@@ -911,9 +911,9 @@ class ELFSymbolTable : public ELFSection {
void WriteSymbolsList(const ZoneChunkList<ELFSymbol>* src,
Writer::Slot<ELFSymbol::SerializedLayout> dst,
ELFStringTable* strtab) {
size_t len = src->size();
for (uint32_t i = 0; i < len; i++) {
src->at(i).Write(dst.at(i), strtab);
int i = 0;
for (const ELFSymbol& symbol : *src) {
symbol.Write(dst.at(i++), strtab);
}
}
......
......@@ -66,9 +66,6 @@ class ZoneChunkList : public ZoneObject {
T& front() const;
T& back() const;
const T& at(size_t index) const;
T& at(size_t index);
void push_back(const T& item);
void pop_back();
......@@ -294,18 +291,6 @@ T& ZoneChunkList<T>::back() const {
}
}
template <typename T>
const T& ZoneChunkList<T>::at(size_t index) const {
DCHECK_LT(index, size());
return *Find(index);
}
template <typename T>
T& ZoneChunkList<T>::at(size_t index) {
DCHECK_LT(index, size());
return *Find(index);
}
template <typename T>
void ZoneChunkList<T>::push_back(const T& item) {
if (back_ == nullptr) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment