ICU-5190 Decrease size of collator. Performance isn't addressed, but it helps to reduce what to look at for cloning.
X-SVN-Rev: 19625
This commit is contained in:
parent
a91ec74f43
commit
3893bd1ab2
@ -667,14 +667,14 @@ UCollator* ucol_initCollator(const UCATableHeader *image, UCollator *fillIn, con
|
||||
result->hiraganaQisDefault = TRUE;
|
||||
result->numericCollationisDefault = TRUE;
|
||||
|
||||
result->scriptOrder = NULL;
|
||||
/*result->scriptOrder = NULL;*/
|
||||
|
||||
result->rules = NULL;
|
||||
result->rulesLength = 0;
|
||||
|
||||
/* get the version info from UCATableHeader and populate the Collator struct*/
|
||||
result->dataInfo.dataVersion[0] = result->image->version[0]; /* UCA Builder version*/
|
||||
result->dataInfo.dataVersion[1] = result->image->version[1]; /* UCA Tailoring rules version*/
|
||||
result->dataVersion[0] = result->image->version[0]; /* UCA Builder version*/
|
||||
result->dataVersion[1] = result->image->version[1]; /* UCA Tailoring rules version*/
|
||||
|
||||
result->unsafeCP = (uint8_t *)result->image + result->image->unsafeCP;
|
||||
result->minUnsafeCP = 0;
|
||||
@ -4396,7 +4396,7 @@ ucol_calcSortKey(const UCollator *coll,
|
||||
UBool shifted = (coll->alternateHandling == UCOL_SHIFTED);
|
||||
//UBool qShifted = shifted && (compareQuad == 0);
|
||||
UBool doHiragana = (coll->hiraganaQ == UCOL_ON) && (compareQuad == 0);
|
||||
const uint8_t *scriptOrder = coll->scriptOrder;
|
||||
/*const uint8_t *scriptOrder = coll->scriptOrder;*/
|
||||
|
||||
uint32_t variableTopValue = coll->variableTopValue;
|
||||
// TODO: UCOL_COMMON_BOT4 should be a function of qShifted. If we have no
|
||||
@ -4522,11 +4522,9 @@ ucol_calcSortKey(const UCollator *coll,
|
||||
primary2 = (uint8_t)((order >>= 8) & UCOL_BYTE_SIZE_MASK);
|
||||
primary1 = (uint8_t)(order >> 8);
|
||||
|
||||
if(notIsContinuation) {
|
||||
if(scriptOrder != NULL) {
|
||||
/*if(notIsContinuation && scriptOrder != NULL) {
|
||||
primary1 = scriptOrder[primary1];
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if(shifted && ((notIsContinuation && order <= variableTopValue && primary1 > 0)
|
||||
|| (!notIsContinuation && wasShifted))
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1998-2005, International Business Machines
|
||||
* Copyright (C) 1998-2006, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -862,16 +862,18 @@ struct UCollator {
|
||||
uint32_t *latinOneCEs;
|
||||
char* validLocale;
|
||||
char* requestedLocale;
|
||||
const UChar *rules;
|
||||
const UCollator *UCA;
|
||||
ResourceCleaner *resCleaner;
|
||||
UResourceBundle *rb;
|
||||
UResourceBundle *elements;
|
||||
const UCATableHeader *image;
|
||||
/*CompactEIntArray *mapping;*/
|
||||
UTrie *mapping;
|
||||
const uint32_t *latinOneMapping;
|
||||
const uint32_t *expansion;
|
||||
const UChar *contractionIndex;
|
||||
const uint32_t *contractionCEs;
|
||||
const uint8_t *scriptOrder;
|
||||
/*const uint8_t *scriptOrder;*/
|
||||
|
||||
const uint32_t *endExpansionCE; /* array of last ces in an expansion ce.
|
||||
corresponds to expansionCESize */
|
||||
@ -885,12 +887,9 @@ struct UCollator {
|
||||
UChar minUnsafeCP; /* Smallest unsafe Code Point. */
|
||||
UChar minContrEndCP; /* Smallest code point at end of a contraction */
|
||||
|
||||
const UChar *rules;
|
||||
int32_t rulesLength;
|
||||
int32_t latinOneTableLen;
|
||||
|
||||
/*UErrorCode errorCode;*/ /* internal error code */
|
||||
|
||||
uint32_t variableTopValue;
|
||||
UColAttributeValue frenchCollation;
|
||||
UColAttributeValue alternateHandling; /* attribute for handling variable elements*/
|
||||
@ -931,10 +930,7 @@ struct UCollator {
|
||||
uint8_t tertiaryTopCount;
|
||||
uint8_t tertiaryBottomCount;
|
||||
|
||||
UDataInfo dataInfo; /* Data info of UCA table */
|
||||
const UCollator *UCA;
|
||||
ResourceCleaner *resCleaner;
|
||||
|
||||
UVersionInfo dataVersion; /* Data info of UCA table */
|
||||
};
|
||||
|
||||
U_CDECL_END
|
||||
|
@ -163,12 +163,7 @@ ucol_open_internal(const char *loc,
|
||||
result->rb = b;
|
||||
result->elements = collElem;
|
||||
} else { /* There is another error, and we're just gonna clean up */
|
||||
clean:
|
||||
ures_close(b);
|
||||
ures_close(collElem);
|
||||
ures_close(collations);
|
||||
ures_close(binary);
|
||||
return NULL;
|
||||
goto clean;
|
||||
}
|
||||
|
||||
result->validLocale = NULL; // default is to use rb info
|
||||
@ -180,11 +175,7 @@ clean:
|
||||
/* test for NULL */
|
||||
if (result->requestedLocale == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
ures_close(b); // ??? appears needed
|
||||
ures_close(collElem);
|
||||
ures_close(collations);
|
||||
ures_close(binary); // ??? appears needed
|
||||
return NULL;
|
||||
goto clean;
|
||||
}
|
||||
uprv_strcpy(result->requestedLocale, loc);
|
||||
|
||||
@ -192,6 +183,13 @@ clean:
|
||||
ures_close(collations); //??? we have to decide on that. Probably affects something :)
|
||||
result->resCleaner = ucol_prv_closeResources;
|
||||
return result;
|
||||
|
||||
clean:
|
||||
ures_close(b);
|
||||
ures_close(collElem);
|
||||
ures_close(collations);
|
||||
ures_close(binary);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
U_CAPI UCollator*
|
||||
@ -322,7 +320,7 @@ ucol_openRules( const UChar *rules,
|
||||
|
||||
if(U_SUCCESS(*status)) {
|
||||
UChar *newRules;
|
||||
result->dataInfo.dataVersion[0] = UCOL_BUILDER_VERSION;
|
||||
result->dataVersion[0] = UCOL_BUILDER_VERSION;
|
||||
if(rulesLength > 0) {
|
||||
newRules = (UChar *)uprv_malloc((rulesLength+1)*U_SIZEOF_UCHAR);
|
||||
/* test for NULL */
|
||||
|
Loading…
Reference in New Issue
Block a user