Commit 8ce8b2af authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

src: Remove unused Memchunk::shrink

parent d1e49a19
......@@ -43,18 +43,13 @@ namespace nghttp2 {
template <size_t N> struct Memchunk {
Memchunk(std::unique_ptr<Memchunk> next_chunk)
: pos(std::begin(buf)), last(pos), knext(std::move(next_chunk)),
kprev(nullptr), next(nullptr) {
if (knext) {
knext->kprev = this;
}
}
next(nullptr) {}
size_t len() const { return last - pos; }
size_t left() const { return std::end(buf) - last; }
void reset() { pos = last = std::begin(buf); }
std::array<uint8_t, N> buf;
uint8_t *pos, *last;
std::unique_ptr<Memchunk> knext;
Memchunk *kprev;
Memchunk *next;
static const size_t size = N;
};
......@@ -82,27 +77,6 @@ template <typename T> struct Pool {
}
freelist = m;
}
void shrink(size_t max) {
auto m = freelist;
for (; m && poolsize > max;) {
auto next = m->next;
poolsize -= T::size;
auto p = m->kprev;
if (p) {
p->knext = std::move(m->knext);
if (p->knext) {
p->knext->kprev = p;
}
} else {
pool = std::move(m->knext);
if (pool) {
pool->kprev = nullptr;
}
}
m = next;
}
freelist = m;
}
void clear() {
freelist = nullptr;
pool = 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