diff options
author | Peng Wu <alexepico@gmail.com> | 2016-03-03 16:44:19 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2016-03-03 16:44:26 +0800 |
commit | 9181f558e6aa784d7734a728e1581a16ba36b422 (patch) | |
tree | 33eed6151a61eabdaa176a97d0eb0ad26d1107f1 /src/storage/ngram_bdb.cpp | |
parent | 9d0f69f772571e2ea2e3c9f50198d843d07227a8 (diff) | |
download | libpinyin-9181f558e6aa784d7734a728e1581a16ba36b422.tar.gz libpinyin-9181f558e6aa784d7734a728e1581a16ba36b422.tar.xz libpinyin-9181f558e6aa784d7734a728e1581a16ba36b422.zip |
use attach_options function
Diffstat (limited to 'src/storage/ngram_bdb.cpp')
-rw-r--r-- | src/storage/ngram_bdb.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/storage/ngram_bdb.cpp b/src/storage/ngram_bdb.cpp index e0c2479..1e2cbe1 100644 --- a/src/storage/ngram_bdb.cpp +++ b/src/storage/ngram_bdb.cpp @@ -24,6 +24,7 @@ #include "memory_chunk.h" #include "novel_types.h" #include "ngram.h" +#include "bdb_utils.h" using namespace pinyin; @@ -150,14 +151,7 @@ bool Bigram::save_db(const char * dbfile){ bool Bigram::attach(const char * dbfile, guint32 flags){ reset(); - u_int32_t db_flags = 0; - - if ( flags & ATTACH_READONLY ) - db_flags |= DB_RDONLY; - if ( flags & ATTACH_READWRITE ) - assert( !( flags & ATTACH_READONLY ) ); - if ( flags & ATTACH_CREATE ) - db_flags |= DB_CREATE; + u_int32_t db_flags = attach_options(flags); if ( !dbfile ) return false; |