diff options
author | Peng Wu <alexepico@gmail.com> | 2012-10-22 16:31:42 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2012-10-22 16:31:42 +0800 |
commit | 15d4a0e6298eca0def77b9d80d94ce6c4beccc95 (patch) | |
tree | 3ef98a1c1ec645e81a8aea2daafbf17ab8e08881 /src/storage/phrase_large_table2.h | |
parent | bf3f5d029bb0432fbae882b8d0465d7a9b01f896 (diff) | |
download | libpinyin-15d4a0e6298eca0def77b9d80d94ce6c4beccc95.tar.gz libpinyin-15d4a0e6298eca0def77b9d80d94ce6c4beccc95.tar.xz libpinyin-15d4a0e6298eca0def77b9d80d94ce6c4beccc95.zip |
move back get_first_token
Diffstat (limited to 'src/storage/phrase_large_table2.h')
-rw-r--r-- | src/storage/phrase_large_table2.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/storage/phrase_large_table2.h b/src/storage/phrase_large_table2.h index dd1a1e4..c853f48 100644 --- a/src/storage/phrase_large_table2.h +++ b/src/storage/phrase_large_table2.h @@ -130,6 +130,20 @@ static inline int reduce_tokens(PhraseTokens tokens, return num; } +/* for compatibility. */ +static inline int get_first_token(PhraseTokens tokens, + /* out */ phrase_token_t & token){ + token = null_token; + + GArray * tokenarray = g_array_new(FALSE, FALSE, sizeof(phrase_token_t)); + int num = reduce_tokens(tokens, tokenarray); + if (num) + token = g_array_index(tokenarray, phrase_token_t, 0); + g_array_free(tokenarray, TRUE); + + return num; +} + }; #endif |