ICU-20202 MemoryPool and uloc_key_type structs inherit from UMemory. Fixes dependencies on global operator new().

This commit is contained in:
Andy Heninger 2018-11-02 14:54:45 -07:00
parent 53d8c8f3d1
commit 1bad36b91a
2 changed files with 10 additions and 5 deletions

View File

@ -32,6 +32,10 @@
#include <string.h>
#include "unicode/localpointer.h"
#ifdef __cplusplus
#include "unicode/uobject.h"
#endif
#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
#include <stdio.h>
#endif
@ -701,7 +705,7 @@ inline H *MaybeStackHeaderAndArray<H, T, stackCapacity>::orphanOrClone(int32_t l
* It doesn't do anything more than that, and is intentionally kept minimalist.
*/
template<typename T>
class MemoryPool {
class MemoryPool : public UMemory {
enum { STACK_CAPACITY = 8 };
public:
MemoryPool() : count(0), pool() {}

View File

@ -10,6 +10,7 @@
#include "unicode/utypes.h"
#include "unicode/unistr.h"
#include "unicode/uobject.h"
#include "charstr.h"
#include "cmemory.h"
@ -33,17 +34,17 @@ typedef enum {
SPECIALTYPE_RG_KEY_VALUE = 4
} SpecialType;
typedef struct LocExtKeyData {
struct LocExtKeyData : public icu::UMemory {
const char* legacyId;
const char* bcpId;
icu::LocalUHashtablePointer typeMap;
uint32_t specialTypes;
} LocExtKeyData;
};
typedef struct LocExtType {
struct LocExtType : public icu::UMemory {
const char* legacyId;
const char* bcpId;
} LocExtType;
};
static icu::MemoryPool<icu::CharString>* gKeyTypeStringPool = NULL;
static icu::MemoryPool<LocExtKeyData>* gLocExtKeyDataEntries = NULL;