diff options
author | Peng Wu <alexepico@gmail.com> | 2013-06-17 15:19:03 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2013-06-17 15:19:03 +0800 |
commit | 32071df5b2689e040073ef678bfd6766a26a4efd (patch) | |
tree | 5c6362a5a1bda5933b62fbd36429c0dd51e5812e /utils/storage | |
parent | 46af45028fbb166c3a4be4239b0126db39efd2b4 (diff) | |
download | libpinyin-32071df5b2689e040073ef678bfd6766a26a4efd.tar.gz libpinyin-32071df5b2689e040073ef678bfd6766a26a4efd.tar.xz libpinyin-32071df5b2689e040073ef678bfd6766a26a4efd.zip |
add asserts
Diffstat (limited to 'utils/storage')
-rw-r--r-- | utils/storage/import_interpolation.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/utils/storage/import_interpolation.cpp b/utils/storage/import_interpolation.cpp index d1d60e2..205a27a 100644 --- a/utils/storage/import_interpolation.cpp +++ b/utils/storage/import_interpolation.cpp @@ -188,20 +188,23 @@ bool parse_bigram(FILE * input, PhraseLargeTable2 * phrase_table, if ( last_token && last_single_gram ) { bigram->store(last_token, last_single_gram); delete last_single_gram; - //safe guard - last_token = 0; + + /* safe guard */ + last_token = null_token; last_single_gram = NULL; } SingleGram * single_gram = NULL; bigram->load(token1, single_gram); - //create the new single gram + /* create the new single gram */ if ( single_gram == NULL ) single_gram = new SingleGram; last_token = token1; last_single_gram = single_gram; } - //save the freq + + /* save the freq */ + assert(NULL != last_single_gram); guint32 total_freq = 0; assert(last_single_gram->get_total_freq(total_freq)); assert(last_single_gram->insert_freq(token2, count)); |