mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-21 02:08:12 +03:00
LibSQL: Don't copy strings when searching for a column's index
Also don't cast the return value to an int.
This commit is contained in:
parent
c3a6fad080
commit
47dd1b9f8b
Notes:
sideshowbarker
2024-07-17 04:32:07 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/47dd1b9f8b Pull-request: https://github.com/SerenityOS/serenity/pull/16239 Reviewed-by: https://github.com/gmta Reviewed-by: https://github.com/linusg
@ -79,13 +79,12 @@ Tuple& Tuple::operator=(Tuple const& other)
|
||||
return *this;
|
||||
}
|
||||
|
||||
Optional<size_t> Tuple::index_of(String name) const
|
||||
Optional<size_t> Tuple::index_of(StringView name) const
|
||||
{
|
||||
auto n = move(name);
|
||||
for (auto ix = 0u; ix < m_descriptor->size(); ix++) {
|
||||
auto& part = (*m_descriptor)[ix];
|
||||
if (part.name == n) {
|
||||
return (int)ix;
|
||||
if (part.name == name) {
|
||||
return ix;
|
||||
}
|
||||
}
|
||||
return {};
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
[[nodiscard]] u32 hash() const;
|
||||
|
||||
protected:
|
||||
[[nodiscard]] Optional<size_t> index_of(String) const;
|
||||
[[nodiscard]] Optional<size_t> index_of(StringView) const;
|
||||
void copy_from(Tuple const&);
|
||||
virtual void serialize(Serializer&) const;
|
||||
virtual void deserialize(Serializer&);
|
||||
|
Loading…
Reference in New Issue
Block a user