summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2010-08-27 13:17:40 +0800
committerPeng Wu <alexepico@gmail.com>2010-08-27 13:17:40 +0800
commit38068dc1f723f3960c144d82ec74eab7ecae9a31 (patch)
tree3f2ecfffccbd8b20139f01fc77e91424e663263a
parent4d1695f4b3fb75cc23e984b5cf5ce5a5b6005119 (diff)
downloadlibpinyin-38068dc1f723f3960c144d82ec74eab7ecae9a31.tar.gz
libpinyin-38068dc1f723f3960c144d82ec74eab7ecae9a31.tar.xz
libpinyin-38068dc1f723f3960c144d82ec74eab7ecae9a31.zip
clean up code
-rw-r--r--src/storage/pinyin_large_table.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/storage/pinyin_large_table.cpp b/src/storage/pinyin_large_table.cpp
index 41ca0d7..9f0f8ee 100644
--- a/src/storage/pinyin_large_table.cpp
+++ b/src/storage/pinyin_large_table.cpp
@@ -356,13 +356,13 @@ int PinyinLengthIndexLevel::add_index( int phrase_length, /* in */ PinyinKey key
assert(phrase_length + 1 < MAX_PHRASE_LENGTH);
if ( m_pinyin_array_indexes -> len <= phrase_length )
g_array_set_size(m_pinyin_array_indexes, phrase_length + 1);
-#define CASE(x) case x: \
- { \
- PinyinArrayIndexLevel<x> * &array = g_array_index \
- (m_pinyin_array_indexes, PinyinArrayIndexLevel<x> *, x); \
- if ( !array ) \
- array = new PinyinArrayIndexLevel<x>; \
- return array->add_index(keys, token); \
+#define CASE(len) case len: \
+ { \
+ PinyinArrayIndexLevel<len> * &array = g_array_index \
+ (m_pinyin_array_indexes, PinyinArrayIndexLevel<len> *, len); \
+ if ( !array ) \
+ array = new PinyinArrayIndexLevel<len>; \
+ return array->add_index(keys, token); \
}
switch(phrase_length){
CASE(0);
@@ -391,10 +391,10 @@ int PinyinLengthIndexLevel::remove_index( int phrase_length, /* in */ PinyinKey
assert(phrase_length + 1 < MAX_PHRASE_LENGTH);
if ( m_pinyin_array_indexes -> len <= phrase_length )
return false;
-#define CASE(x) case x: \
+#define CASE(len) case len: \
{ \
- PinyinArrayIndexLevel<x> * &array = g_array_index \
- (m_pinyin_array_indexes, PinyinArrayIndexLevel<x> *, x); \
+ PinyinArrayIndexLevel<len> * &array = g_array_index \
+ (m_pinyin_array_indexes, PinyinArrayIndexLevel<len> *, len); \
if ( !array ) \
return false; \
return array->remove_index(keys, token); \