Merge "String8: ensure static init done prior to empty string reference"
This commit is contained in:
commit
b4f1a027cb
@ -48,12 +48,16 @@ int gDarwinIsReallyAnnoying;
|
|||||||
|
|
||||||
static inline char* getEmptyString()
|
static inline char* getEmptyString()
|
||||||
{
|
{
|
||||||
|
if (!gEmptyStringBuf) initialize_string8();
|
||||||
|
|
||||||
gEmptyStringBuf->acquire();
|
gEmptyStringBuf->acquire();
|
||||||
return gEmptyString;
|
return gEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initialize_string8()
|
void initialize_string8()
|
||||||
{
|
{
|
||||||
|
if (gEmptyStringBuf) return;
|
||||||
|
|
||||||
// HACK: This dummy dependency forces linking libutils Static.cpp,
|
// HACK: This dummy dependency forces linking libutils Static.cpp,
|
||||||
// which is needed to initialize String8/String16 classes.
|
// which is needed to initialize String8/String16 classes.
|
||||||
// These variables are named for Darwin, but are needed elsewhere too,
|
// These variables are named for Darwin, but are needed elsewhere too,
|
||||||
|
Loading…
Reference in New Issue
Block a user