OLD | NEW |
1 /* | 1 /* |
2 ****************************************************************************** | 2 ****************************************************************************** |
3 * Copyright (C) 1996-2009, International Business Machines * | 3 * Copyright (C) 1996-2009, International Business Machines * |
4 * Corporation and others. All Rights Reserved. * | 4 * Corporation and others. All Rights Reserved. * |
5 ****************************************************************************** | 5 ****************************************************************************** |
6 */ | 6 */ |
7 | 7 |
8 #include "unicode/utypes.h" | 8 #include "unicode/utypes.h" |
9 | 9 |
10 #if !UCONFIG_NO_COLLATION | 10 #if !UCONFIG_NO_COLLATION |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 } | 229 } |
230 | 230 |
231 #ifdef INSTRUMENT_STRING_LIST | 231 #ifdef INSTRUMENT_STRING_LIST |
232 _strings += 1; | 232 _strings += 1; |
233 #endif | 233 #endif |
234 | 234 |
235 if (listSize >= listMax) { | 235 if (listSize >= listMax) { |
236 int32_t newMax = listMax + STRING_LIST_BUFFER_SIZE; | 236 int32_t newMax = listMax + STRING_LIST_BUFFER_SIZE; |
237 | 237 |
238 UnicodeString *newStrings = new UnicodeString[newMax]; | 238 UnicodeString *newStrings = new UnicodeString[newMax]; |
239 | 239 if (newStrings == NULL) { |
240 uprv_memcpy(newStrings, strings, listSize * sizeof(UnicodeString)); | 240 status = U_MEMORY_ALLOCATION_ERROR; |
| 241 return; |
| 242 } |
| 243 for (int32_t i=0; i<listSize; ++i) { |
| 244 newStrings[i] = strings[i]; |
| 245 } |
241 | 246 |
242 #ifdef INSTRUMENT_STRING_LIST | 247 #ifdef INSTRUMENT_STRING_LIST |
243 int32_t _h = listSize / STRING_LIST_BUFFER_SIZE; | 248 int32_t _h = listSize / STRING_LIST_BUFFER_SIZE; |
244 | 249 |
245 if (_h > 100) { | 250 if (_h > 100) { |
246 _h = 100; | 251 _h = 100; |
247 } | 252 } |
248 | 253 |
249 _histogram[_h] += 1; | 254 _histogram[_h] += 1; |
250 #endif | 255 #endif |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 // **** this will fail if the another **** | 1096 // **** this will fail if the another **** |
1092 // **** thread deletes the cache here **** | 1097 // **** thread deletes the cache here **** |
1093 if (cache != NULL) { | 1098 if (cache != NULL) { |
1094 cache->flush(); | 1099 cache->flush(); |
1095 } | 1100 } |
1096 } | 1101 } |
1097 | 1102 |
1098 U_NAMESPACE_END | 1103 U_NAMESPACE_END |
1099 | 1104 |
1100 #endif // #if !UCONFIG_NO_COLLATION | 1105 #endif // #if !UCONFIG_NO_COLLATION |
OLD | NEW |