mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 09:20:28 +03:00
AK: Add FlyString::from_deprecated_fly_string()
Let's add FlyString::from_deprecated_fly_string() so we can use it instead of FlyString::from_utf8(). This will make it easier to detect potential unncessary allocations as we transfer to FlyString.
This commit is contained in:
parent
41b8d81d49
commit
e28a6d5da4
Notes:
sideshowbarker
2024-07-16 23:55:09 +09:00
Author: https://github.com/kennethmyhra Commit: https://github.com/SerenityOS/serenity/commit/e28a6d5da4 Pull-request: https://github.com/SerenityOS/serenity/pull/17785 Reviewed-by: https://github.com/AtkinsSJ ✅ Reviewed-by: https://github.com/alimpfard
@ -168,6 +168,11 @@ DeprecatedFlyString FlyString::to_deprecated_fly_string() const
|
||||
return DeprecatedFlyString(bytes_as_string_view());
|
||||
}
|
||||
|
||||
ErrorOr<FlyString> FlyString::from_deprecated_fly_string(DeprecatedFlyString const& deprecated_fly_string)
|
||||
{
|
||||
return FlyString::from_utf8(deprecated_fly_string.view());
|
||||
}
|
||||
|
||||
unsigned Traits<FlyString>::hash(FlyString const& fly_string)
|
||||
{
|
||||
return fly_string.hash();
|
||||
|
@ -51,8 +51,9 @@ public:
|
||||
// This is primarily interesting to unit tests.
|
||||
[[nodiscard]] static size_t number_of_fly_strings();
|
||||
|
||||
// FIXME: Remove this once all code has been ported to FlyString
|
||||
// FIXME: Remove these once all code has been ported to FlyString
|
||||
[[nodiscard]] DeprecatedFlyString to_deprecated_fly_string() const;
|
||||
static ErrorOr<FlyString> from_deprecated_fly_string(DeprecatedFlyString const&);
|
||||
|
||||
// Compare this FlyString against another string with ASCII caseless matching.
|
||||
[[nodiscard]] bool equals_ignoring_ascii_case(FlyString const&) const;
|
||||
|
Loading…
Reference in New Issue
Block a user