mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-6554 Remove previous free from timezone.cpp and use static array in TestOpenVsOpenRules() capitst.
X-SVN-Rev: 24693
This commit is contained in:
parent
13b807cf6f
commit
f92998e519
2 changed files with 6 additions and 13 deletions
|
@ -605,10 +605,7 @@ TimeZone::initDefault()
|
|||
ucln_i18n_registerCleanup(UCLN_I18N_TIMEZONE, timeZone_cleanup);
|
||||
}
|
||||
umtx_unlock(&LOCK);
|
||||
// cleanup hostID from uprv_tzname()
|
||||
if (hostID != NULL) {
|
||||
uprv_free((char*)hostID);
|
||||
}
|
||||
|
||||
delete default_zone;
|
||||
}
|
||||
|
||||
|
|
|
@ -869,7 +869,7 @@ void TestOpenVsOpenRules(){
|
|||
int32_t numLocales = uloc_countAvailable();
|
||||
int32_t sizeOfStdSet;
|
||||
uint32_t adder;
|
||||
UChar *str;
|
||||
UChar str[41]; /* create an array of UChar of size maximum strSize + 1 */
|
||||
USet *stdSet;
|
||||
char* curLoc;
|
||||
UCollator * c1;
|
||||
|
@ -933,7 +933,6 @@ void TestOpenVsOpenRules(){
|
|||
|
||||
/* make a string with these characters in it */
|
||||
strSize = (rand()%40) + 1;
|
||||
str = (UChar*)uprv_malloc(sizeof(UChar) * (strSize + 1));
|
||||
|
||||
for(z = 0; z < strSize; z++){
|
||||
str[z] = uset_charAt(eSet, rand()%eSize);
|
||||
|
@ -957,12 +956,12 @@ void TestOpenVsOpenRules(){
|
|||
|
||||
/* get sort keys for both of them, and check that the keys are identicle */
|
||||
sortKeyLen1 = ucol_getSortKey(c1, str, u_strlen(str), NULL, 0);
|
||||
sortKey1 = (uint8_t*)uprv_malloc(sizeof(uint8_t) * (sortKeyLen1 + 1));
|
||||
sortKey1 = (uint8_t*)malloc(sizeof(uint8_t) * (sortKeyLen1 + 1));
|
||||
/*memset(sortKey1, 0xFE, sortKeyLen1);*/
|
||||
ucol_getSortKey(c1, str, u_strlen(str), sortKey1, sortKeyLen1 + 1);
|
||||
|
||||
sortKeyLen2 = ucol_getSortKey(c2, str, u_strlen(str), NULL, 0);
|
||||
sortKey2 = (uint8_t*)uprv_malloc(sizeof(uint8_t) * (sortKeyLen2 + 1));
|
||||
sortKey2 = (uint8_t*)malloc(sizeof(uint8_t) * (sortKeyLen2 + 1));
|
||||
/*memset(sortKey2, 0xFE, sortKeyLen2);*/
|
||||
ucol_getSortKey(c2, str, u_strlen(str), sortKey2, sortKeyLen2 + 1);
|
||||
|
||||
|
@ -972,12 +971,9 @@ void TestOpenVsOpenRules(){
|
|||
/* check that the keys are the same */
|
||||
doAssert((memcmp(sortKey1, sortKey2, sortKeyLen1) == 0), "Keys are not equivalent");
|
||||
|
||||
|
||||
|
||||
/* clean up after each string */
|
||||
uprv_free(str);
|
||||
uprv_free(sortKey1);
|
||||
uprv_free(sortKey2);
|
||||
free(sortKey1);
|
||||
free(sortKey2);
|
||||
uset_close(eSet);
|
||||
}
|
||||
/* clean up after each locale */
|
||||
|
|
Loading…
Add table
Reference in a new issue