diff options
author | Peng Wu <alexepico@gmail.com> | 2016-07-04 11:05:29 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2016-07-04 11:05:29 +0800 |
commit | 4fdb35ab901e8570a84fe29a59f82123a85a16a8 (patch) | |
tree | 99a073111295b0743e6a76035be3947cc58bc8c2 | |
parent | 63cca4dd16a7d2156689e28f4027d069ab5ea33b (diff) | |
download | libpinyin-4fdb35ab901e8570a84fe29a59f82123a85a16a8.tar.gz libpinyin-4fdb35ab901e8570a84fe29a59f82123a85a16a8.tar.xz libpinyin-4fdb35ab901e8570a84fe29a59f82123a85a16a8.zip |
update Vistor code
-rw-r--r-- | src/storage/chewing_large_table2_kyotodb.cpp | 8 | ||||
-rw-r--r-- | src/storage/phrase_large_table3_kyotodb.cpp | 7 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/storage/chewing_large_table2_kyotodb.cpp b/src/storage/chewing_large_table2_kyotodb.cpp index 62f65fd..d04401c 100644 --- a/src/storage/chewing_large_table2_kyotodb.cpp +++ b/src/storage/chewing_large_table2_kyotodb.cpp @@ -349,15 +349,14 @@ int ChewingLargeTable2::remove_index_internal(int phrase_length, /* use MaskOutVisitor2 to avoid linking problem. */ class MaskOutVisitor2 : public DB::Visitor { - BasicDB * m_db; GPtrArray * m_entries; phrase_token_t m_mask; phrase_token_t m_value; public: - MaskOutVisitor2(BasicDB * db, GPtrArray * entries, + MaskOutVisitor2(GPtrArray * entries, phrase_token_t mask, phrase_token_t value) { - m_db = db; m_entries = entries; + m_entries = entries; m_mask = mask; m_value = value; } @@ -418,9 +417,10 @@ public: /* mask out method */ bool ChewingLargeTable2::mask_out(phrase_token_t mask, phrase_token_t value) { - MaskOutVisitor2 visitor(m_db, m_entries, mask, value); + MaskOutVisitor2 visitor(m_entries, mask, value); m_db->iterate(&visitor, true); + m_db->synchronize(); return true; } diff --git a/src/storage/phrase_large_table3_kyotodb.cpp b/src/storage/phrase_large_table3_kyotodb.cpp index a02eac3..14c5c94 100644 --- a/src/storage/phrase_large_table3_kyotodb.cpp +++ b/src/storage/phrase_large_table3_kyotodb.cpp @@ -243,14 +243,12 @@ int PhraseLargeTable3::remove_index(int phrase_length, class MaskOutVisitor : public DB::Visitor { private: - BasicDB * m_db; phrase_token_t m_mask; phrase_token_t m_value; PhraseTableEntry m_entry; public: - MaskOutVisitor(BasicDB * db, phrase_token_t mask, phrase_token_t value) { - m_db = db; + MaskOutVisitor(phrase_token_t mask, phrase_token_t value) { m_mask = mask; m_value = value; } @@ -274,9 +272,10 @@ public: /* mask out method */ bool PhraseLargeTable3::mask_out(phrase_token_t mask, phrase_token_t value) { - MaskOutVisitor visitor(m_db, mask, value); + MaskOutVisitor visitor(mask, value); m_db->iterate(&visitor, true); + m_db->synchronize(); return true; } |