BIND 10 trac1603, updated. 4dbcf3b666bf27ae2c3018007e163235e5c326e2 [1603] simplified the part of trimming exceessive renderer table space.
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Mar 12 05:34:11 UTC 2012
The branch, trac1603 has been updated
via 4dbcf3b666bf27ae2c3018007e163235e5c326e2 (commit)
from 75b062049db49cade952510e66324761a8ba09b6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 4dbcf3b666bf27ae2c3018007e163235e5c326e2
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Sun Mar 11 22:33:09 2012 -0700
[1603] simplified the part of trimming exceessive renderer table space.
since we don't have to preserve the existing item in this context, we can
simply swap the current vector with a newly created (with a reserved space)
vector.
-----------------------------------------------------------------------
Summary of changes:
src/lib/dns/messagerenderer.cc | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/dns/messagerenderer.cc b/src/lib/dns/messagerenderer.cc
index e704ba0..1f087f8 100644
--- a/src/lib/dns/messagerenderer.cc
+++ b/src/lib/dns/messagerenderer.cc
@@ -242,12 +242,11 @@ MessageRenderer::clear() {
// subsequent use of the renderer.
for (size_t i = 0; i < MessageRendererImpl::BUCKETS; ++i) {
if (impl_->table_[i].size() > MessageRendererImpl::RESERVED_ITEMS) {
- // Trim excessive capacity: reserve() invalidates the excessive
- // items, and swap ensures the new capacity is only reasonably
- // large for the reserved space.
- impl_->table_[i].reserve(MessageRendererImpl::RESERVED_ITEMS);
- vector<OffsetItem>(impl_->table_[i].begin(),
- impl_->table_[i].end()).swap(impl_->table_[i]);
+ // Trim excessive capacity: swap ensures the new capacity is only
+ // reasonably large for the reserved space.
+ vector<OffsetItem> new_table;
+ new_table.reserve(MessageRendererImpl::RESERVED_ITEMS);
+ new_table.swap(impl_->table_[i]);
}
impl_->table_[i].clear();
}
More information about the bind10-changes
mailing list