summaryrefslogtreecommitdiff
path: root/store
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-01-28 16:24:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-01-29 07:11:04 +0100
commit98e60805613ab6ea19c03c34c0f36d00374dab73 (patch)
treefb8249445f7ccb3005b5942e7bb495b671033b8e /store
parent4cff06065ebfe884d8661b790db76f15203f2549 (diff)
loplugin:flatten in stoc..store
Change-Id: Ib8c86179a3d13852cbb02b389b6103aca5456dba Reviewed-on: https://gerrit.libreoffice.org/67013 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'store')
-rw-r--r--store/source/storcach.cxx58
1 files changed, 29 insertions, 29 deletions
diff --git a/store/source/storcach.cxx b/store/source/storcach.cxx
index 3fdf60ec13a0..76a0c6d185c8 100644
--- a/store/source/storcach.cxx
+++ b/store/source/storcach.cxx
@@ -220,42 +220,42 @@ void PageCache::rescale_Impl (std::size_t new_size)
std::size_t new_bytes = new_size * sizeof(Entry*);
Entry ** new_table = static_cast<Entry**>(std::malloc(new_bytes));
- if (new_table != nullptr)
- {
- Entry ** old_table = m_hash_table;
- std::size_t old_size = m_hash_size;
+ if (new_table == nullptr)
+ return;
- SAL_INFO(
- "store",
- "ave chain length: " << (m_hash_entries >> m_hash_shift)
- << ", total entries: " << m_hash_entries << " [old_size: "
- << old_size << " new_size: " << new_size << "]");
+ Entry ** old_table = m_hash_table;
+ std::size_t old_size = m_hash_size;
- memset (new_table, 0, new_bytes);
+ SAL_INFO(
+ "store",
+ "ave chain length: " << (m_hash_entries >> m_hash_shift)
+ << ", total entries: " << m_hash_entries << " [old_size: "
+ << old_size << " new_size: " << new_size << "]");
- m_hash_table = new_table;
- m_hash_size = new_size;
- m_hash_shift = highbit(m_hash_size) - 1;
+ memset (new_table, 0, new_bytes);
- std::size_t i;
- for (i = 0; i < old_size; i++)
+ m_hash_table = new_table;
+ m_hash_size = new_size;
+ m_hash_shift = highbit(m_hash_size) - 1;
+
+ std::size_t i;
+ for (i = 0; i < old_size; i++)
+ {
+ Entry * curr = old_table[i];
+ while (curr != nullptr)
{
- Entry * curr = old_table[i];
- while (curr != nullptr)
- {
- Entry * next = curr->m_pNext;
- int index = hash_index_Impl(curr->m_nOffset);
- curr->m_pNext = m_hash_table[index];
- m_hash_table[index] = curr;
- curr = next;
- }
- old_table[i] = nullptr;
+ Entry * next = curr->m_pNext;
+ int index = hash_index_Impl(curr->m_nOffset);
+ curr->m_pNext = m_hash_table[index];
+ m_hash_table[index] = curr;
+ curr = next;
}
- if (old_table != m_hash_table_0)
- {
+ old_table[i] = nullptr;
+ }
+ if (old_table != m_hash_table_0)
+ {
- std::free (old_table);
- }
+ std::free (old_table);
}
}