summaryrefslogtreecommitdiffstats
path: root/src/storage
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2022-06-06 17:32:00 +0800
committerPeng Wu <alexepico@gmail.com>2022-06-06 17:32:00 +0800
commit2323c59d337ca56c585a8b58b855e84938ecfc27 (patch)
treedc32a1af5a593170bd6149d361521832f1885ca5 /src/storage
parent5f3df104b5ac0c3497a48cfc476eb3eedf1e543b (diff)
downloadlibpinyin-2323c59d337ca56c585a8b58b855e84938ecfc27.tar.gz
libpinyin-2323c59d337ca56c585a8b58b855e84938ecfc27.tar.xz
libpinyin-2323c59d337ca56c585a8b58b855e84938ecfc27.zip
Use abort function instead of assert macro
Diffstat (limited to 'src/storage')
-rw-r--r--src/storage/chewing_large_table.cpp14
-rw-r--r--src/storage/chewing_large_table2.cpp4
-rw-r--r--src/storage/chewing_large_table2_bdb.cpp8
-rw-r--r--src/storage/chewing_large_table2_kyotodb.cpp10
-rw-r--r--src/storage/flexible_ngram_bdb.h2
-rw-r--r--src/storage/ngram.cpp2
-rw-r--r--src/storage/phrase_index.cpp4
-rw-r--r--src/storage/phrase_index_logger.h2
-rw-r--r--src/storage/phrase_large_table2.cpp14
-rw-r--r--src/storage/pinyin_parser2.cpp4
-rw-r--r--src/storage/table_info.cpp12
-rw-r--r--src/storage/zhuyin_parser2.cpp4
12 files changed, 40 insertions, 40 deletions
diff --git a/src/storage/chewing_large_table.cpp b/src/storage/chewing_large_table.cpp
index dccdc8e..e856caf 100644
--- a/src/storage/chewing_large_table.cpp
+++ b/src/storage/chewing_large_table.cpp
@@ -344,7 +344,7 @@ ChewingLengthIndexLevel::~ChewingLengthIndexLevel() {
CASE(14);
CASE(15);
default:
- assert(false);
+ abort();
}
}
#undef CASE
@@ -389,7 +389,7 @@ int ChewingLengthIndexLevel::search(pinyin_option_t options, int phrase_length,
CASE(14);
CASE(15);
default:
- assert(false);
+ abort();
}
#undef CASE
@@ -545,7 +545,7 @@ int ChewingLengthIndexLevel::add_index(int phrase_length,
CASE(14);
CASE(15);
default:
- assert(false);
+ abort();
}
#undef CASE
@@ -599,7 +599,7 @@ int ChewingLengthIndexLevel::remove_index(int phrase_length,
CASE(14);
CASE(15);
default:
- assert(false);
+ abort();
}
#undef CASE
@@ -850,7 +850,7 @@ bool ChewingLengthIndexLevel::load(MemoryChunk * chunk, table_offset_t offset,
CASE(14);
CASE(15);
default:
- assert(false);
+ abort();
}
#undef CASE
@@ -910,7 +910,7 @@ bool ChewingLengthIndexLevel::store(MemoryChunk * new_chunk,
CASE(14);
CASE(15);
default:
- assert(false);
+ abort();
}
#undef CASE
@@ -1034,7 +1034,7 @@ bool ChewingLengthIndexLevel::mask_out(phrase_token_t mask,
CASE(14);
CASE(15);
default:
- assert(false);
+ abort();
}
}
#undef CASE
diff --git a/src/storage/chewing_large_table2.cpp b/src/storage/chewing_large_table2.cpp
index 0dc96f4..7ac1398 100644
--- a/src/storage/chewing_large_table2.cpp
+++ b/src/storage/chewing_large_table2.cpp
@@ -56,7 +56,7 @@ void ChewingLargeTable2::init_entries() {
CASE(15);
CASE(16);
default:
- assert(false);
+ abort();
}
}
@@ -97,7 +97,7 @@ void ChewingLargeTable2::fini_entries() {
CASE(15);
CASE(16);
default:
- assert(false);
+ abort();
}
}
diff --git a/src/storage/chewing_large_table2_bdb.cpp b/src/storage/chewing_large_table2_bdb.cpp
index 9813b57..82b7fd9 100644
--- a/src/storage/chewing_large_table2_bdb.cpp
+++ b/src/storage/chewing_large_table2_bdb.cpp
@@ -195,7 +195,7 @@ int ChewingLargeTable2::search_internal(int phrase_length,
CASE(15);
CASE(16);
default:
- assert(false);
+ abort();
}
#undef CASE
@@ -302,7 +302,7 @@ int ChewingLargeTable2::add_index_internal(int phrase_length,
CASE(15);
CASE(16);
default:
- assert(false);
+ abort();
}
#undef CASE
@@ -376,7 +376,7 @@ int ChewingLargeTable2::remove_index_internal(int phrase_length,
CASE(15);
CASE(16);
default:
- assert(false);
+ abort();
}
#undef CASE
@@ -443,7 +443,7 @@ bool ChewingLargeTable2::mask_out(phrase_token_t mask,
CASE(15);
CASE(16);
default:
- assert(false);
+ abort();
}
#undef CASE
diff --git a/src/storage/chewing_large_table2_kyotodb.cpp b/src/storage/chewing_large_table2_kyotodb.cpp
index e57552c..c606982 100644
--- a/src/storage/chewing_large_table2_kyotodb.cpp
+++ b/src/storage/chewing_large_table2_kyotodb.cpp
@@ -179,7 +179,7 @@ int ChewingLargeTable2::search_internal(int phrase_length,
CASE(15);
CASE(16);
default:
- assert(false);
+ abort();
}
#undef CASE
@@ -277,7 +277,7 @@ int ChewingLargeTable2::add_index_internal(int phrase_length,
CASE(15);
CASE(16);
default:
- assert(false);
+ abort();
}
#undef CASE
@@ -348,7 +348,7 @@ int ChewingLargeTable2::remove_index_internal(int phrase_length,
CASE(15);
CASE(16);
default:
- assert(false);
+ abort();
}
#undef CASE
@@ -409,12 +409,12 @@ public:
CASE(15);
CASE(16);
default:
- assert(false);
+ abort();
}
#undef CASE
- assert(false);
+ abort();
return NOP;
}
diff --git a/src/storage/flexible_ngram_bdb.h b/src/storage/flexible_ngram_bdb.h
index e526e69..3453752 100644
--- a/src/storage/flexible_ngram_bdb.h
+++ b/src/storage/flexible_ngram_bdb.h
@@ -105,7 +105,7 @@ public:
int ret = db_create(&m_db, NULL, 0);
if ( ret != 0 )
- assert(false);
+ abort();
ret = m_db->open(m_db, NULL, dbfile, NULL, DB_HASH, db_flags, 0644);
if ( ret != 0 && (flags & ATTACH_CREATE) ) {
diff --git a/src/storage/ngram.cpp b/src/storage/ngram.cpp
index ca845c5..c952768 100644
--- a/src/storage/ngram.cpp
+++ b/src/storage/ngram.cpp
@@ -105,7 +105,7 @@ guint32 SingleGram::mask_out(phrase_token_t mask, phrase_token_t value){
}
bool SingleGram::prune(){
- assert(false);
+ abort();
#if 0
SingleGramItem * begin = (SingleGramItem *)
((const char *)(m_chunk.begin()) + sizeof(guint32));
diff --git a/src/storage/phrase_index.cpp b/src/storage/phrase_index.cpp
index 36cb149..e9e9d5d 100644
--- a/src/storage/phrase_index.cpp
+++ b/src/storage/phrase_index.cpp
@@ -505,7 +505,7 @@ bool SubPhraseIndex::merge(PhraseIndexLogger * logger){
break;
}
default:
- assert(false);
+ abort();
}
}
return true;
@@ -801,7 +801,7 @@ bool _compute_new_header(PhraseIndexLogger * logger,
break;
}
default:
- assert(false);
+ abort();
}
}
diff --git a/src/storage/phrase_index_logger.h b/src/storage/phrase_index_logger.h
index cffd937..d1e42b6 100644
--- a/src/storage/phrase_index_logger.h
+++ b/src/storage/phrase_index_logger.h
@@ -294,7 +294,7 @@ public:
break;
}
default:
- assert(false);
+ abort();
}
/* store log record. */
diff --git a/src/storage/phrase_large_table2.cpp b/src/storage/phrase_large_table2.cpp
index 0e6fa62..b72917c 100644
--- a/src/storage/phrase_large_table2.cpp
+++ b/src/storage/phrase_large_table2.cpp
@@ -184,7 +184,7 @@ PhraseLengthIndexLevel2::~PhraseLengthIndexLevel2(){
CASE(15);
CASE(16);
default:
- assert(false);
+ abort();
}
}
g_array_free(m_phrase_array_indexes, TRUE);
@@ -228,7 +228,7 @@ int PhraseLengthIndexLevel2::search(int phrase_length,
CASE(15);
CASE(16);
default:
- assert(false);
+ abort();
}
#undef CASE
}
@@ -348,7 +348,7 @@ int PhraseLengthIndexLevel2::add_index(int phrase_length,
CASE(15);
CASE(16);
default:
- assert(false);
+ abort();
}
#undef CASE
@@ -402,7 +402,7 @@ int PhraseLengthIndexLevel2::remove_index(int phrase_length,
CASE(15);
CASE(16);
default:
- assert(false);
+ abort();
}
#undef CASE
}
@@ -605,7 +605,7 @@ bool PhraseLengthIndexLevel2::load(MemoryChunk * chunk,
CASE(15);
CASE(16);
default:
- assert(false);
+ abort();
}
#undef CASE
}
@@ -661,7 +661,7 @@ bool PhraseLengthIndexLevel2::store(MemoryChunk * new_chunk,
CASE(15);
CASE(16);
default:
- assert(false);
+ abort();
}
//add '#'
new_chunk->set_content(offset, &c_separate, sizeof(char));
@@ -781,7 +781,7 @@ bool PhraseLengthIndexLevel2::mask_out(phrase_token_t mask,
CASE(15);
CASE(16);
default:
- assert(false);
+ abort();
}
}
/* shrink self array. */
diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp
index 17aa358..ce640c3 100644
--- a/src/storage/pinyin_parser2.cpp
+++ b/src/storage/pinyin_parser2.cpp
@@ -395,7 +395,7 @@ bool FullPinyinParser2::set_scheme(FullPinyinScheme scheme){
m_pinyin_index_len = G_N_ELEMENTS(secondary_zhuyin_index);
break;
default:
- assert(false);
+ abort();
}
return true;
}
@@ -608,7 +608,7 @@ bool DoublePinyinParser2::set_scheme(DoublePinyinScheme scheme) {
m_fallback_table = double_pinyin_xhe_fallback;
return true;
case DOUBLE_PINYIN_CUSTOMIZED:
- assert(FALSE);
+ abort();
};
return false; /* no such scheme. */
diff --git a/src/storage/table_info.cpp b/src/storage/table_info.cpp
index 44fcf60..41c7da0 100644
--- a/src/storage/table_info.cpp
+++ b/src/storage/table_info.cpp
@@ -113,7 +113,7 @@ static TABLE_PHONETIC_TYPE to_table_phonetic_type(const char * str) {
if (0 == strcmp("zhuyin", str))
return ZHUYIN_TABLE;
- assert(FALSE);
+ abort();
}
static TABLE_DATABASE_FORMAT_TYPE to_table_database_format_type(const char * str) {
@@ -123,7 +123,7 @@ static TABLE_DATABASE_FORMAT_TYPE to_table_database_format_type(const char * str
if (0 == strcmp("KyotoCabinet", str))
return KYOTO_CABINET_FORMAT;
- assert(FALSE);
+ abort();
}
static TABLE_TARGET to_table_target(const char * str) {
@@ -133,7 +133,7 @@ static TABLE_TARGET to_table_target(const char * str) {
if (0 == strcmp("addon", str))
return ADDON_TABLE;
- assert(FALSE);
+ abort();
}
static guint8 to_index_of_default_tables(const char * str) {
@@ -147,7 +147,7 @@ static guint8 to_index_of_default_tables(const char * str) {
HANDLE(NETWORK_DICTIONARY);
HANDLE(USER_DICTIONARY);
- assert(FALSE);
+ abort();
}
static guint8 to_index_of_addon_tables(const char * str) {
@@ -166,7 +166,7 @@ static PHRASE_FILE_TYPE to_file_type(const char * str) {
HANDLE(DICTIONARY);
HANDLE(USER_FILE);
- assert(FALSE);
+ abort();
}
#undef HANDLE
@@ -178,7 +178,7 @@ static const char * from_table_database_format_type(const TABLE_DATABASE_FORMAT_
if (format == KYOTO_CABINET_FORMAT)
return "KyotoCabinet";
- assert(FALSE);
+ abort();
}
diff --git a/src/storage/zhuyin_parser2.cpp b/src/storage/zhuyin_parser2.cpp
index e711b76..3f14eab 100644
--- a/src/storage/zhuyin_parser2.cpp
+++ b/src/storage/zhuyin_parser2.cpp
@@ -291,7 +291,7 @@ bool ZhuyinSimpleParser2::set_scheme(ZhuyinScheme scheme) {
m_symbol_table = chewing_standard_dvorak_symbols;
m_tone_table = chewing_standard_dvorak_tones;
default:
- assert(FALSE);
+ abort();
}
return false;
@@ -484,7 +484,7 @@ bool ZhuyinDiscreteParser2::set_scheme(ZhuyinScheme scheme) {
INIT_PARSER(hsu_zhuyin_index, hsu_dvorak);
break;
default:
- assert(FALSE);
+ abort();
}
#undef INIT_PARSER