projects
/
platform
/
upstream
/
libpinyin.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4f3e1e5
)
write get_first_token
author
Peng Wu
<alexepico@gmail.com>
Mon, 3 Sep 2012 01:53:19 +0000
(09:53 +0800)
committer
Peng Wu
<alexepico@gmail.com>
Mon, 3 Sep 2012 01:53:19 +0000
(09:53 +0800)
src/storage/phrase_large_table2.h
patch
|
blob
|
history
diff --git
a/src/storage/phrase_large_table2.h
b/src/storage/phrase_large_table2.h
index
01adb83
..
c4d4092
100644
(file)
--- a/
src/storage/phrase_large_table2.h
+++ b/
src/storage/phrase_large_table2.h
@@
-108,6
+108,26
@@
public:
}
};
+/* for compatibility. */
+static inline int get_first_token(PhraseTokens tokens,
+ /* out */ phrase_token_t & token){
+ int num = 0; token = null_token;
+
+ for (size_t i = 0; i < PHRASE_INDEX_LIBRARY_COUNT; ++i) {
+ GArray * array = tokens[i];
+ if (NULL == array || 0 == array->len)
+ continue;
+
+ num += array->len;
+
+ if (null_token == token) {
+ token = g_array_index(array, phrase_token_t, 0);
+ }
+ }
+
+ return num;
+}
+
};
#endif