From: George Rhoten Date: Sun, 12 Aug 2012 00:33:34 +0000 (+0000) Subject: ICU-9474 Reduce the exported C++ static variables too. X-Git-Tag: milestone-59-0-1~3669 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ce96470daf7136def672627cb321ae3d02ba15bc;p=icu ICU-9474 Reduce the exported C++ static variables too. X-SVN-Rev: 32159 --- diff --git a/icu4c/source/i18n/alphaindex.cpp b/icu4c/source/i18n/alphaindex.cpp index cf51a03fe4e..2178ee25666 100644 --- a/icu4c/source/i18n/alphaindex.cpp +++ b/icu4c/source/i18n/alphaindex.cpp @@ -63,8 +63,19 @@ alphaIndex_deleteRecord(void *obj) { } - +typedef const UChar PinyinLookup[24][3]; + static const Normalizer2 *nfkdNormalizer; +static UBool indexCharactersAreInitialized = FALSE; +static UnicodeSet *ALPHABETIC; +static UnicodeSet *HANGUL; +static UnicodeSet *ETHIOPIC; +static UnicodeSet *CORE_LATIN; +static UnicodeSet *IGNORE_SCRIPTS; +static UnicodeSet *TO_TRY; +static UnicodeSet *UNIHAN; +static const UnicodeString *EMPTY_STRING; + // // Append the contents of a UnicodeSet to a UVector of UnicodeStrings. @@ -605,7 +616,6 @@ void AlphabeticIndex::init(UErrorCode &status) { } -static UBool indexCharactersAreInitialized = FALSE; // Index Characters Clean up function. Delete statically allocated constant stuff. U_CDECL_BEGIN @@ -637,15 +647,6 @@ void AlphabeticIndex::staticCleanup() { } -UnicodeSet *AlphabeticIndex::ALPHABETIC; -UnicodeSet *AlphabeticIndex::HANGUL; -UnicodeSet *AlphabeticIndex::ETHIOPIC; -UnicodeSet *AlphabeticIndex::CORE_LATIN; -UnicodeSet *AlphabeticIndex::IGNORE_SCRIPTS; -UnicodeSet *AlphabeticIndex::TO_TRY; -UnicodeSet *AlphabeticIndex::UNIHAN; -const UnicodeString *AlphabeticIndex::EMPTY_STRING; - // // staticInit() One-time initialization of constants. // Thread safe. Called from constructors. @@ -951,7 +952,7 @@ static const UChar PINYIN_LOWER_BOUNDS_SHORT[] = { // "\u0101bcd\u0113fghjk // Pinyin lookup tables copied, pasted (and reformatted) from the ICU4J code. -AlphabeticIndex::PinyinLookup AlphabeticIndex::HACK_PINYIN_LOOKUP_SHORT = { +static const PinyinLookup HACK_PINYIN_LOOKUP_SHORT = { {(UChar)0, (UChar)0, (UChar)0}, // A {(UChar)0x516B, (UChar)0, (UChar)0}, // B {(UChar)0x5693, (UChar)0, (UChar)0}, // C @@ -982,7 +983,7 @@ static const UChar PINYIN_LOWER_BOUNDS_LONG[] = { // "\u0101bcd\u0113fghjkl\u1 0x0101, 0x62, 0x63, 0x64, 0x0113, 0x66, 0x67, 0x68, 0x6A, 0x6B, /*l*/0x6C, 0x1E3F, 0x0144, 0x014D, /*p*/0x70, 0x71, 0x72, 0x73, 0x74, /*w*/0x77, 0x78, 0x79, 0x7A}; -AlphabeticIndex::PinyinLookup AlphabeticIndex::HACK_PINYIN_LOOKUP_LONG = { +static const PinyinLookup HACK_PINYIN_LOOKUP_LONG = { {(UChar)0, (UChar)0, (UChar)0}, // A {(UChar)0x516B, (UChar)0, (UChar)0}, // b {(UChar)0xD863, (UChar)0xDEAD, (UChar)0}, // c @@ -1022,8 +1023,8 @@ AlphabeticIndex::PinyinLookup AlphabeticIndex::HACK_PINYIN_LOOKUP_LONG = { // // This whole arrangement is temporary. // -AlphabeticIndex::PinyinLookup *AlphabeticIndex::HACK_PINYIN_LOOKUP = NULL; -const UChar *AlphabeticIndex::PINYIN_LOWER_BOUNDS = NULL; +static const PinyinLookup *HACK_PINYIN_LOOKUP = NULL; +static const UChar *PINYIN_LOWER_BOUNDS = NULL; void AlphabeticIndex::initPinyinBounds(const Collator *col, UErrorCode &status) { { diff --git a/icu4c/source/i18n/colldata.cpp b/icu4c/source/i18n/colldata.cpp index a488ea07726..c03b733d00f 100644 --- a/icu4c/source/i18n/colldata.cpp +++ b/icu4c/source/i18n/colldata.cpp @@ -1038,7 +1038,7 @@ void CollData::close(CollData *collData) cache->unref(collData); } -CollDataCache *CollData::collDataCache = NULL; +static CollDataCache *collDataCache = NULL; CollDataCache *CollData::getCollDataCache() { diff --git a/icu4c/source/i18n/ucol.cpp b/icu4c/source/i18n/ucol.cpp index 882a3873792..c3d05c0cbfc 100644 --- a/icu4c/source/i18n/ucol.cpp +++ b/icu4c/source/i18n/ucol.cpp @@ -4272,6 +4272,8 @@ ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length, U_NAMESPACE_BEGIN +static uint8_t lastResortByte_ = 0; + class SortKeyByteSink : public ByteSink { public: static const uint32_t FILL_ORIGINAL_BUFFER = 1; @@ -4343,8 +4345,6 @@ private: capacity_ = 0; } - static uint8_t lastResortByte_; // last-resort return value from LastByte() - char *ownedBuffer_; char *buffer_; int32_t capacity_; @@ -4353,8 +4353,6 @@ private: UBool grow_; }; -uint8_t SortKeyByteSink::lastResortByte_ = 0; - SortKeyByteSink::~SortKeyByteSink() { uprv_free(ownedBuffer_); } diff --git a/icu4c/source/i18n/unicode/alphaindex.h b/icu4c/source/i18n/unicode/alphaindex.h index 7b7d18c356f..473a241da41 100644 --- a/icu4c/source/i18n/unicode/alphaindex.h +++ b/icu4c/source/i18n/unicode/alphaindex.h @@ -695,30 +695,8 @@ private: ELangType langType_; // The language type, simplified Chinese, Traditional Chinese, // or not Chinese (Normal). Part of the Pinyin support - typedef const UChar PinyinLookup[24][3]; - static PinyinLookup HACK_PINYIN_LOOKUP_SHORT; - static PinyinLookup HACK_PINYIN_LOOKUP_LONG; - - // These will be lazily set to the short or long tables based on which - // Chinese collation has been configured into the ICU library. - static PinyinLookup *HACK_PINYIN_LOOKUP; - static const UChar *PINYIN_LOWER_BOUNDS; - - - int32_t recordCounter_; // Counts Records created. For minting record serial numbers. -// Constants. Lazily initialized the first time an AlphabeticIndex object is created. - - static UnicodeSet *ALPHABETIC; - static UnicodeSet *CORE_LATIN; - static UnicodeSet *ETHIOPIC; - static UnicodeSet *HANGUL; - static UnicodeSet *IGNORE_SCRIPTS; - static UnicodeSet *TO_TRY; - static UnicodeSet *UNIHAN; - static const UnicodeString *EMPTY_STRING; - }; U_NAMESPACE_END diff --git a/icu4c/source/i18n/unicode/colldata.h b/icu4c/source/i18n/unicode/colldata.h index efdb15968c5..c8e3433bb6f 100644 --- a/icu4c/source/i18n/unicode/colldata.h +++ b/icu4c/source/i18n/unicode/colldata.h @@ -1,6 +1,6 @@ /* ****************************************************************************** - * Copyright (C) 1996-2011, International Business Machines * + * Copyright (C) 1996-2012, International Business Machines * * Corporation and others. All Rights Reserved. * ****************************************************************************** */ @@ -441,8 +441,6 @@ private: char keyBuffer[KEY_BUFFER_SIZE]; char *key; - static CollDataCache *collDataCache; - uint32_t minHan; uint32_t maxHan;