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

Commit e0490fbc authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Clean up the attribute searching func" into main

parents ecc63bcb e7de40d9
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -130,11 +130,14 @@ Result<Res_value> XmlParser::Node::GetAttributeValue(ResourceId attr,
}

Result<Res_value> XmlParser::Node::GetAttributeValue(const std::string& name) const {
  String16 name16;
  return FindAttribute(parser_, name, [&](size_t index) -> bool {
    size_t len;
    const String16 key16(parser_.getAttributeName(index, &len));
    std::string key = String8(key16).c_str();
    return key == name;
    if (name16.empty()) {
        name16 = String16(name.c_str(), name.size());
    }
    size_t key_len;
    const auto key16 = parser_.getAttributeName(index, &key_len);
    return key16 && name16.size() == key_len && name16 == key16;
  });
}