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

Commit 9620663e authored by Greg Kaiser's avatar Greg Kaiser
Browse files

MediaMetrics: Avoid creating temporary string

We change our empty string comparison, the expected common case,
to directly check the character array contents, instead of
implicitly constructing a std::string object for comparison.

Bug: 199763036
Test: TreeHugger
Change-Id: Idcb96ff6f6b86a187c4999b37670721c1adaa51d
parent 2bd0adb2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ static const std::unordered_map<std::string, int32_t>& getErrorStringMap() {

status_t errorStringToStatus(const char *error) {
    const auto& map = getErrorStringMap();
    if (error == nullptr || error == "") return NO_ERROR;
    if (error == nullptr || error[0] == '\0') return NO_ERROR;
    auto it = map.find(error);
    if (it != map.end()) {
        return it->second;