diff options
author | Eric Albright <eric_albright@sil.org> | 2007-12-21 03:53:02 +0000 |
---|---|---|
committer | Eric Albright <eric_albright@sil.org> | 2007-12-21 03:53:02 +0000 |
commit | f4f1480e2b4101ab44ae39c57e314d94fb1aa221 (patch) | |
tree | eb437927bf223b7561c391283a9502d177330c78 | |
parent | 2ab92e740131866a07fa0faf79741f88e99ce5ab (diff) | |
download | enchant-f4f1480e2b4101ab44ae39c57e314d94fb1aa221.tar.gz |
allocate the exact size of the matcher path
git-svn-id: svn+ssh://svn.abisource.com/svnroot/enchant/trunk@22380 bcba8976-2d24-0410-9c9c-aab3bd5fdfd6
-rw-r--r-- | src/pwl.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1075,10 +1075,11 @@ static EnchantTrieMatcher* enchant_trie_matcher_init(const char* const word, char * normalized_word, * pattern; normalized_word = g_utf8_normalize (word, len, G_NORMALIZE_NFD); + len = strlen(normalized_word); if(mode == case_insensitive) { - pattern = g_utf8_strdown (normalized_word, -1); + pattern = g_utf8_strdown (normalized_word, len); g_free(normalized_word); } else @@ -1089,9 +1090,9 @@ static EnchantTrieMatcher* enchant_trie_matcher_init(const char* const word, matcher->max_errors = maxerrs; matcher->word = pattern; matcher->word_pos = 0; - matcher->path = g_new0(char,10); + matcher->path = g_new0(char,len+maxerrs+1); matcher->path[0] = '\0'; - matcher->path_len = 10; + matcher->path_len = len+maxerrs+1; matcher->path_pos = 0; matcher->mode = mode; matcher->cbfunc = cbfunc; @@ -1189,3 +1190,4 @@ static int edit_dist(const char* utf8word1, const char* utf8word2) } + |