Make EncodingMapper singleton "new-less"
Use the modern way to code Singleton to get rid of the allocation memory. Close #6031, close #6019
This commit is contained in:
parent
d269fda5b2
commit
fc9dfc86fc
@ -83,8 +83,6 @@ static EncodingUnit encodings[] = {
|
||||
{20866, "koi8_r csKOI8R"} //IDM_FORMAT_KOI8R_CYRILLIC
|
||||
};
|
||||
|
||||
EncodingMapper * EncodingMapper::_pSelf = new EncodingMapper;
|
||||
|
||||
bool isInListA(const char *token, const char *list) {
|
||||
if ((!token) || (!list))
|
||||
return false;
|
||||
|
@ -35,7 +35,10 @@ struct EncodingUnit {
|
||||
|
||||
class EncodingMapper {
|
||||
public:
|
||||
static EncodingMapper * getInstance() {return _pSelf;};
|
||||
static EncodingMapper * getInstance() {
|
||||
static EncodingMapper _pSelf;
|
||||
return &_pSelf;
|
||||
};
|
||||
int getEncodingFromIndex(int index) const;
|
||||
int getIndexFromEncoding(int encoding) const;
|
||||
int getEncodingFromString(const char * encodingAlias) const;
|
||||
@ -43,7 +46,6 @@ public:
|
||||
private:
|
||||
EncodingMapper(){};
|
||||
~EncodingMapper(){};
|
||||
static EncodingMapper *_pSelf;
|
||||
EncodingUnit* _encodings = nullptr;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user