summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-07-20 19:25:12 +0800
committerPeng Wu <alexepico@gmail.com>2011-07-20 19:25:12 +0800
commit027b54b4cadda5af698e95b9ef27801f197cba49 (patch)
tree57ef5ddb35b37d421026a4fd578e0d6cf57fc01e /src
parent9bd6cea3eb09d561bb9f59468807a23debadb4f3 (diff)
downloadlibpinyin-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.cpp17
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;