summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-03-31 14:08:01 +0800
committerPeng Wu <alexepico@gmail.com>2016-03-31 14:08:01 +0800
commitd8a55692370a11440802b81814e026140f41ed9c (patch)
treedaa34893dd60b1d82aa4fca5be45c5581bcd26af
parent3e1537b4c456d9f41bbd81f1f9c00d6920a8137e (diff)
downloadlibpinyin-d8a55692370a11440802b81814e026140f41ed9c.tar.gz
libpinyin-d8a55692370a11440802b81814e026140f41ed9c.tar.xz
libpinyin-d8a55692370a11440802b81814e026140f41ed9c.zip
fixes test_pinyin
-rw-r--r--src/storage/chewing_large_table2_bdb.cpp8
-rw-r--r--src/storage/chewing_large_table2_kyotodb.cpp7
2 files changed, 8 insertions, 7 deletions
diff --git a/src/storage/chewing_large_table2_bdb.cpp b/src/storage/chewing_large_table2_bdb.cpp
index db63731..10b5663 100644
--- a/src/storage/chewing_large_table2_bdb.cpp
+++ b/src/storage/chewing_large_table2_bdb.cpp
@@ -53,6 +53,8 @@ void ChewingLargeTable2::reset() {
bool ChewingLargeTable2::attach(const char * dbfile, guint32 flags) {
reset();
+ init_entries();
+
u_int32_t db_flags = attach_options(flags);
if (!dbfile)
@@ -66,8 +68,6 @@ bool ChewingLargeTable2::attach(const char * dbfile, guint32 flags) {
if (ret != 0)
return false;
- init_entries();
-
return true;
}
@@ -75,6 +75,8 @@ bool ChewingLargeTable2::attach(const char * dbfile, guint32 flags) {
bool ChewingLargeTable2::load_db(const char * filename) {
reset();
+ init_entries();
+
/* create in-memory db. */
int ret = db_create(&m_db, NULL, 0);
assert(0 == ret);
@@ -103,8 +105,6 @@ bool ChewingLargeTable2::load_db(const char * filename) {
if (tmp_db != NULL)
tmp_db->close(tmp_db, 0);
- init_entries();
-
return true;
}
diff --git a/src/storage/chewing_large_table2_kyotodb.cpp b/src/storage/chewing_large_table2_kyotodb.cpp
index 469bb54..2d2f6aa 100644
--- a/src/storage/chewing_large_table2_kyotodb.cpp
+++ b/src/storage/chewing_large_table2_kyotodb.cpp
@@ -52,13 +52,14 @@ void ChewingLargeTable2::reset() {
bool ChewingLargeTable2::attach(const char * dbfile, guint32 flags) {
reset();
+ init_entries();
+
uint32_t mode = attach_options(flags);
if (!dbfile)
return false;
m_db = new TreeDB;
- init_entries();
return m_db->open(dbfile, mode);
}
@@ -68,6 +69,8 @@ bool ChewingLargeTable2::attach(const char * dbfile, guint32 flags) {
bool ChewingLargeTable2::load_db(const char * filename) {
reset();
+ init_entries();
+
/* create in-memory db. */
m_db = new ProtoTreeDB;
@@ -85,8 +88,6 @@ bool ChewingLargeTable2::load_db(const char * filename) {
tmp_db->close();
delete tmp_db;
- init_entries();
-
return true;
}