Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4f1a027 authored by Todd Poynor's avatar Todd Poynor Committed by Android (Google) Code Review
Browse files

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

parents de9ae529 1bf3b4a0
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -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,