mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-2313 init and dispose of UCA as a regular collator
X-SVN-Rev: 9908
This commit is contained in:
parent
cf2040937e
commit
67eefcaadc
1 changed files with 5 additions and 10 deletions
|
@ -795,10 +795,7 @@ ucol_cleanup(void)
|
|||
UCA_DATA_MEM = NULL;
|
||||
}
|
||||
if (UCA) {
|
||||
/* Since UCA was opened with ucol_initCollator, ucol_close won't work. */
|
||||
/*ucmpe32_close(UCA->mapping);*/
|
||||
uprv_free(UCA->mapping);
|
||||
uprv_free(UCA);
|
||||
ucol_close(UCA);
|
||||
UCA = NULL;
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -966,12 +963,7 @@ void ucol_initUCA(UErrorCode *status) {
|
|||
return;
|
||||
|
||||
if(UCA == NULL) {
|
||||
UCollator *newUCA = (UCollator *)uprv_malloc(sizeof(UCollator));
|
||||
if (newUCA == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
UCollator *newUCA = NULL;
|
||||
UDataMemory *result = udata_openChoice(NULL, UCA_DATA_TYPE, UCA_DATA_NAME, isAcceptableUCA, NULL, status);
|
||||
|
||||
if(U_FAILURE(*status)) {
|
||||
|
@ -985,6 +977,9 @@ void ucol_initUCA(UErrorCode *status) {
|
|||
newUCA = ucol_initCollator((const UCATableHeader *)udata_getMemory(result), newUCA, status);
|
||||
if(U_SUCCESS(*status)){
|
||||
newUCA->rb = NULL;
|
||||
newUCA->binary = NULL;
|
||||
newUCA->requestedLocale = NULL;
|
||||
newUCA->hasRealData = FALSE; // real data lives in .dat file...
|
||||
umtx_lock(NULL);
|
||||
if(UCA == NULL) {
|
||||
UCA = newUCA;
|
||||
|
|
Loading…
Add table
Reference in a new issue