diff options
author | Peng Wu <alexepico@gmail.com> | 2011-07-20 19:25:12 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2011-07-20 19:25:12 +0800 |
commit | 027b54b4cadda5af698e95b9ef27801f197cba49 (patch) | |
tree | 57ef5ddb35b37d421026a4fd578e0d6cf57fc01e /src | |
parent | 9bd6cea3eb09d561bb9f59468807a23debadb4f3 (diff) | |
download | libpinyin-027b54b4cadda5af698e95b9ef27801f197cba49.tar.gz libpinyin-027b54b4cadda5af698e95b9ef27801f197cba49.tar.xz libpinyin-027b54b4cadda5af698e95b9ef27801f197cba49.zip |
add class destructor to phrase lookup
Diffstat (limited to 'src')
-rw-r--r-- | src/lookup/phrase_lookup.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lookup/phrase_lookup.cpp b/src/lookup/phrase_lookup.cpp index 96069da..c51fabc 100644 --- a/src/lookup/phrase_lookup.cpp +++ b/src/lookup/phrase_lookup.cpp @@ -43,6 +43,23 @@ PhraseLookup::PhraseLookup(PhraseLargeTable * phrase_table, m_steps_content = g_ptr_array_new(); } +PhraseLookup::~PhraseLookup(){ + //free m_steps_index + for ( size_t i = 0; i < m_steps_index->len; ++i){ + GHashTable * table = (GHashTable *) g_ptr_array_index(m_steps_index, i); + g_hash_table_destroy(table); + } + g_ptr_array_free(m_steps_index, TRUE); + m_steps_index = NULL; + + //free m_steps_content + for ( size_t i = 0; i < m_steps_content->len; ++i){ + GArray * array = (GArray *) g_ptr_array_index(m_steps_content, i); + g_array_free(array, TRUE); + } + g_ptr_array_free(m_steps_content, TRUE); +} + bool PhraseLookup::get_best_match(int sentence_length, utf16_t sentence[], MatchResults & results){ m_sentence_length = sentence_length; |