From a3d54898d4a86260bcd242bc68f361e7de614a36 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Thu, 19 May 2016 16:15:02 +0800 Subject: update get_items method --- src/storage/phonetic_key_matrix.cpp | 5 ----- src/storage/phonetic_key_matrix.h | 5 ++++- src/storage/pinyin_parser2.cpp | 2 -- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/storage/phonetic_key_matrix.cpp b/src/storage/phonetic_key_matrix.cpp index 150ba5d..61554fb 100644 --- a/src/storage/phonetic_key_matrix.cpp +++ b/src/storage/phonetic_key_matrix.cpp @@ -83,7 +83,6 @@ bool fuzzy_syllable_step(pinyin_option_t options, for (size_t index = 0; index < length; ++index) { /* for pinyin initials. */ matrix->get_items(index, keys, key_rests); - assert(keys->len == key_rests->len); if (0 == keys->len) continue; @@ -125,7 +124,6 @@ bool fuzzy_syllable_step(pinyin_option_t options, /* for pinyin finals. */ matrix->get_items(index, keys, key_rests); - assert(keys->len == key_rests->len); assert(0 != keys->len); for (i = 0; i < keys->len; ++i) { @@ -170,7 +168,6 @@ bool dump_phonetic_key_matrix(PhoneticKeyMatrix * matrix) { for (size_t index = 0; index < length; ++index) { matrix->get_items(index, keys, key_rests); - assert(keys->len == key_rests->len); if (0 == keys->len) continue; @@ -218,7 +215,6 @@ int search_matrix_recur(GArray * cached_keys, GArray * key_rests = g_array_new(TRUE, TRUE, sizeof(ChewingKeyRest)); matrix->get_items(start, keys, key_rests); - assert(keys->len == key_rests->len); /* assume pinyin parsers will filter invalid keys. */ assert(0 != keys->len); @@ -254,7 +250,6 @@ int search_matrix(FacadeChewingTable2 * table, GArray * key_rests = g_array_new(TRUE, TRUE, sizeof(ChewingKeyRest)); matrix->get_items(start, keys, key_rests); - assert(keys->len == key_rests->len); const size_t len = keys->len; g_array_free(keys, TRUE); diff --git a/src/storage/phonetic_key_matrix.h b/src/storage/phonetic_key_matrix.h index 328cee2..6a1940e 100644 --- a/src/storage/phonetic_key_matrix.h +++ b/src/storage/phonetic_key_matrix.h @@ -123,8 +123,11 @@ public: /* Array of keys and key rests. */ bool get_items(size_t index, GArray * keys, GArray * key_rests) { - return m_keys.get_items(index, keys) && + bool result = m_keys.get_items(index, keys) && m_key_rests.get_items(index, key_rests); + + assert(keys->len == key_rests->len); + return result; } bool append(size_t index, const ChewingKey & key, diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp index c5e734d..a5222fe 100644 --- a/src/storage/pinyin_parser2.cpp +++ b/src/storage/pinyin_parser2.cpp @@ -898,7 +898,6 @@ bool resplit_step(pinyin_option_t options, /* skip the last column */ for (size_t index = 0; index < length - 1; ++index) { matrix->get_items(index, keys, key_rests); - assert(keys->len == key_rests->len); if (0 == keys->len) continue; @@ -974,7 +973,6 @@ bool inner_split_step(pinyin_option_t options, for (size_t index = 0; index < length; ++index) { matrix->get_items(index, keys, key_rests); - assert(keys->len == key_rests->len); if (0 == keys->len) continue; -- cgit