summaryrefslogtreecommitdiffstats
path: root/src/storage
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-05-19 16:15:02 +0800
committerPeng Wu <alexepico@gmail.com>2016-05-19 16:15:02 +0800
commita3d54898d4a86260bcd242bc68f361e7de614a36 (patch)
treea11634ccb9066e05f02867b61cf8ab7e457d4cb5 /src/storage
parente3fd3425a8402752f8b3bbef8bf1784e970a8712 (diff)
downloadlibpinyin-a3d54898d4a86260bcd242bc68f361e7de614a36.tar.gz
libpinyin-a3d54898d4a86260bcd242bc68f361e7de614a36.tar.xz
libpinyin-a3d54898d4a86260bcd242bc68f361e7de614a36.zip
update get_items method
Diffstat (limited to 'src/storage')
-rw-r--r--src/storage/phonetic_key_matrix.cpp5
-rw-r--r--src/storage/phonetic_key_matrix.h5
-rw-r--r--src/storage/pinyin_parser2.cpp2
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;