From 38068dc1f723f3960c144d82ec74eab7ecae9a31 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Fri, 27 Aug 2010 13:17:40 +0800 Subject: clean up code --- src/storage/pinyin_large_table.cpp | 20 ++++++++++---------- 1 file 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 * &array = g_array_index \ - (m_pinyin_array_indexes, PinyinArrayIndexLevel *, x); \ - if ( !array ) \ - array = new PinyinArrayIndexLevel; \ - return array->add_index(keys, token); \ +#define CASE(len) case len: \ + { \ + PinyinArrayIndexLevel * &array = g_array_index \ + (m_pinyin_array_indexes, PinyinArrayIndexLevel *, len); \ + if ( !array ) \ + array = new PinyinArrayIndexLevel; \ + 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 * &array = g_array_index \ - (m_pinyin_array_indexes, PinyinArrayIndexLevel *, x); \ + PinyinArrayIndexLevel * &array = g_array_index \ + (m_pinyin_array_indexes, PinyinArrayIndexLevel *, len); \ if ( !array ) \ return false; \ return array->remove_index(keys, token); \ -- cgit