ICU-770 add transliterator cleanup support

X-SVN-Rev: 5820
This commit is contained in:
Alan Liu 2001-09-19 16:50:06 +00:00
parent 34a2507c41
commit e74e4950ed
4 changed files with 30 additions and 0 deletions

View File

@ -1440,4 +1440,26 @@ void Transliterator::initializeRegistry(void) {
NormalizationTransliterator::registerIDs();
}
// Defined in ucln_in.h:
/**
* Cleanup function for transliterator component; delegates to
* Transliterator::cleanupRegistry().
*/
U_CFUNC UBool transliterator_cleanup(void) {
Transliterator::cleanupRegistry();
return TRUE;
}
/**
* Release all static memory held by transliterator. This will
* necessarily invalidate any rule-based transliterators held by the
* user, because RBTs hold pointers to common data objects.
*/
void Transliterator::cleanupRegistry() {
Mutex lock(&registryMutex);
delete registry;
registry = 0;
}
//eof

View File

@ -22,6 +22,7 @@ static UBool i18n_cleanup(void)
ucol_bld_cleanup();
ucol_cleanup();
timeZone_cleanup();
transliterator_cleanup();
return TRUE;
}

View File

@ -28,4 +28,6 @@ U_CFUNC UBool ucol_bld_cleanup(void);
U_CFUNC UBool timeZone_cleanup(void);
U_CFUNC UBool transliterator_cleanup(void);
#endif

View File

@ -20,6 +20,8 @@ class Hashtable;
class U_I18N_API UVector;
class CompoundTransliterator;
U_CFUNC UBool transliterator_cleanup();
/**
* <code>Transliterator</code> is an abstract class that
* transliterates text from one format to another. The most common
@ -923,6 +925,9 @@ protected:
private:
static void initializeRegistry(void);
friend UBool transliterator_cleanup();
static void cleanupRegistry(void);
};
inline int32_t Transliterator::getMaximumContextLength(void) const {