mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 12:49:19 +00:00
AK: Forbid from_utf8
and from_deprecated_{...}
with unintended types
Calling `from_utf8` with a DeprecatedString will hide the fact that we have a DeprecatedString, while using `from_deprecated_string` with a StringView will silently and needlessly allocate a DeprecatedString, so let's forbid that.
This commit is contained in:
parent
02c4b69f16
commit
ca0106ba1d
Notes:
sideshowbarker
2024-07-17 08:35:21 +09:00
Author: https://github.com/Hendiadyoin1
Commit: ca0106ba1d
Pull-request: https://github.com/SerenityOS/serenity/pull/19356
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/gmta ✅
Reviewed-by: https://github.com/krkk ✅
3 changed files with 14 additions and 1 deletions
|
@ -1047,7 +1047,7 @@ ErrorOr<String> mkdtemp(Span<char> pattern)
|
|||
return Error::from_errno(errno);
|
||||
}
|
||||
|
||||
return String::from_utf8({ path, strlen(path) });
|
||||
return String::from_utf8(StringView { path, strlen(path) });
|
||||
}
|
||||
|
||||
ErrorOr<void> rename(StringView old_path, StringView new_path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue