diff --git a/icu4c/source/common/rbbiscan.cpp b/icu4c/source/common/rbbiscan.cpp index 2b4e804e8f..776b7d21ed 100644 --- a/icu4c/source/common/rbbiscan.cpp +++ b/icu4c/source/common/rbbiscan.cpp @@ -37,13 +37,6 @@ U_NAMESPACE_BEGIN const char RBBIRuleScanner::fgClassID=0; -// -// Forward Declarations -// -U_CDECL_BEGIN -static void U_EXPORT2 U_CALLCONV RBBISetTable_deleter(void *p); -U_CDECL_END - //---------------------------------------------------------------------------------------- // // Unicode Set init strings for each of the character classes needed for parsing a rule file. @@ -77,6 +70,17 @@ static const UChar gRuleSet_name_start_char_pattern[] = { static const UChar kAny[] = {0x61, 0x6e, 0x79, 0x00}; // "any" +U_CDECL_BEGIN +static void U_EXPORT2 U_CALLCONV RBBISetTable_deleter(void *p) { + RBBISetTableEl *px = (RBBISetTableEl *)p; + delete px->key; + // Note: px->val is owned by the linked list "fSetsListHead" in scanner. + // Don't delete the value nodes here. + uprv_free(px); +}; +U_CDECL_END + + //---------------------------------------------------------------------------------------- // // Constructor. @@ -607,16 +611,6 @@ void RBBIRuleScanner::fixOpStack(RBBINode::OpPrecedence p) { // If the string is "any", return a set containing all chars. // //---------------------------------------------------------------------------------------- -U_CDECL_BEGIN -static void U_EXPORT2 U_CALLCONV RBBISetTable_deleter(void *p) { - RBBISetTableEl *px = (RBBISetTableEl *)p; - delete px->key; - // Note: px->val is owned by the linked list "fSetsListHead" in scanner. - // Don't delete the value nodes here. - uprv_free(px); -}; -U_CDECL_END - void RBBIRuleScanner::findSetFor(const UnicodeString &s, RBBINode *node, UnicodeSet *setToAdopt) { RBBISetTableEl *el; diff --git a/icu4c/source/common/rbbistbl.cpp b/icu4c/source/common/rbbistbl.cpp index 8df5f056a7..e2ad0a2d48 100644 --- a/icu4c/source/common/rbbistbl.cpp +++ b/icu4c/source/common/rbbistbl.cpp @@ -19,18 +19,23 @@ #include "rbbinode.h" +// +// RBBISymbolTableEntry_deleter Used by the UHashTable to delete the contents +// when the hash table is deleted. +// +U_CDECL_BEGIN +static void U_EXPORT2 U_CALLCONV RBBISymbolTableEntry_deleter(void *p) { + RBBISymbolTableEntry *px = (RBBISymbolTableEntry *)p; + delete px; +}; +U_CDECL_END + + + U_NAMESPACE_BEGIN const char RBBISymbolTable::fgClassID=0; -// -// Forward Declarations -// -U_CDECL_BEGIN -static void U_EXPORT2 U_CALLCONV RBBISymbolTableEntry_deleter(void *p); -U_CDECL_END - - RBBISymbolTable::RBBISymbolTable(RBBIRuleScanner *rs, const UnicodeString &rules, UErrorCode &status) @@ -42,8 +47,8 @@ RBBISymbolTable::RBBISymbolTable(RBBIRuleScanner *rs, const UnicodeString &rules return; } - fHashTable = uhash_open(uhash_hashUnicodeString, uhash_compareUnicodeString, &status); - uhash_setValueDeleter(fHashTable, RBBISymbolTableEntry_deleter); + fHashTable = uhash_open(uhash_hashUnicodeString, uhash_compareUnicodeString, &status); + uhash_setValueDeleter(fHashTable, RBBISymbolTableEntry_deleter); }; @@ -199,17 +204,6 @@ void RBBISymbolTable::addEntry (const UnicodeString &key, RBBINode * }; -// -// RBBISymbolTableEntry_deleter Used by the UHashTable to delete the contents -// when the hash table is deleted. -// -U_CDECL_BEGIN -static void U_EXPORT2 U_CALLCONV RBBISymbolTableEntry_deleter(void *p) { - RBBISymbolTableEntry *px = (RBBISymbolTableEntry *)p; - delete px; -}; -U_CDECL_END - const char RBBISymbolTableEntry::fgClassID=0; RBBISymbolTableEntry::~RBBISymbolTableEntry() {