Merge "String8: ensure static init done prior to empty string reference"

This commit is contained in:
Todd Poynor 2013-05-07 23:30:21 +00:00 committed by Android (Google) Code Review
commit b4f1a027cb
1 changed files with 4 additions and 0 deletions

View File

@ -48,12 +48,16 @@ int gDarwinIsReallyAnnoying;
static inline char* getEmptyString()
{
if (!gEmptyStringBuf) initialize_string8();
gEmptyStringBuf->acquire();
return gEmptyString;
}
void initialize_string8()
{
if (gEmptyStringBuf) return;
// HACK: This dummy dependency forces linking libutils Static.cpp,
// which is needed to initialize String8/String16 classes.
// These variables are named for Darwin, but are needed elsewhere too,