summaryrefslogtreecommitdiffstats
path: root/src/storage/chewing_large_table2_bdb.cpp
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-03-14 13:48:07 +0800
committerPeng Wu <alexepico@gmail.com>2016-03-14 13:48:07 +0800
commitc8068ec8520d3ab1f34b7e55c9238827d8d56a68 (patch)
treeeef9153298aa2278ba7e18532f5c095483c4fd50 /src/storage/chewing_large_table2_bdb.cpp
parent312eb6bb3212ed3aceef1daaadfe3e7d5554c95a (diff)
downloadlibpinyin-c8068ec8520d3ab1f34b7e55c9238827d8d56a68.tar.gz
libpinyin-c8068ec8520d3ab1f34b7e55c9238827d8d56a68.tar.xz
libpinyin-c8068ec8520d3ab1f34b7e55c9238827d8d56a68.zip
re-factor code
Diffstat (limited to 'src/storage/chewing_large_table2_bdb.cpp')
-rw-r--r--src/storage/chewing_large_table2_bdb.cpp84
1 files changed, 0 insertions, 84 deletions
diff --git a/src/storage/chewing_large_table2_bdb.cpp b/src/storage/chewing_large_table2_bdb.cpp
index 8bd47f3..2ecfced 100644
--- a/src/storage/chewing_large_table2_bdb.cpp
+++ b/src/storage/chewing_large_table2_bdb.cpp
@@ -39,90 +39,6 @@ ChewingLargeTable2::ChewingLargeTable2() {
init_entries();
}
-void ChewingLargeTable2::init_entries() {
- assert(NULL == m_entries);
-
- m_entries = g_ptr_array_new();
- /* NULL for the first pointer. */
- g_ptr_array_set_size(m_entries, MAX_PHRASE_LENGTH + 1);
-
-#define CASE(len) case len: \
- { \
- ChewingTableEntry<len> * entry = \
- new ChewingTableEntry<len>; \
- g_ptr_array_index(m_entries, len) = entry; \
- }
-
- for (size_t i = 1; i < m_entries->len; i++) {
- switch(i) {
- CASE(1);
- CASE(2);
- CASE(3);
- CASE(4);
- CASE(5);
- CASE(6);
- CASE(7);
- CASE(8);
- CASE(9);
- CASE(10);
- CASE(11);
- CASE(12);
- CASE(13);
- CASE(14);
- CASE(15);
- CASE(16);
- default:
- assert(false);
- }
- }
-
-#undef CASE
-}
-
-void ChewingLargeTable2::fini_entries() {
- assert(NULL != m_entries);
-
- assert(MAX_PHRASE_LENGTH + 1 == m_entries->len);
-
- for (size_t i = 1; i < m_entries->len; i++) {
-
-#define CASE(len) case len: \
- { \
- ChewingTableEntry<len> * entry = \
- (ChewingTableEntry<len> *) \
- g_ptr_array_index(m_entries, len); \
- delete entry; \
- }
-
- switch(i) {
- CASE(1);
- CASE(2);
- CASE(3);
- CASE(4);
- CASE(5);
- CASE(6);
- CASE(7);
- CASE(8);
- CASE(9);
- CASE(10);
- CASE(11);
- CASE(12);
- CASE(13);
- CASE(14);
- CASE(15);
- CASE(16);
- default:
- assert(false);
- }
-
-#undef CASE
-
- }
-
- g_ptr_array_free(m_entries, TRUE);
- m_entries = NULL;
-}
-
void ChewingLargeTable2::reset() {
if (m_db) {
m_db->sync(m_db, 0);