Skip to content

Commit

Permalink
write get_first_token
Browse files Browse the repository at this point in the history
  • Loading branch information
epico committed Sep 3, 2012
1 parent 4f3e1e5 commit 930426a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/storage/phrase_large_table2.h
Expand Up @@ -108,6 +108,26 @@ class PhraseLargeTable2{
}
};

/* 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

0 comments on commit 930426a

Please sign in to comment.