From 8b1108e4858f797c9216dc8ae4a3918ad50c73b4 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 11 Nov 2021 00:55:02 +0100 Subject: [PATCH] Everywhere: Pass AK::StringView by value --- AK/Base64.cpp | 4 +- AK/Base64.h | 4 +- AK/DateTimeLexer.h | 2 +- AK/Demangle.h | 2 +- AK/FlyString.cpp | 10 +-- AK/FlyString.h | 12 ++-- AK/GenericLexer.h | 6 +- AK/Hex.cpp | 2 +- AK/Hex.h | 2 +- AK/IPv4Address.h | 2 +- AK/JsonArraySerializer.h | 2 +- AK/JsonObjectSerializer.h | 30 ++++---- AK/JsonParser.h | 2 +- AK/JsonPath.h | 2 +- AK/JsonValue.cpp | 2 +- AK/JsonValue.h | 2 +- AK/LexicalPath.cpp | 6 +- AK/LexicalPath.h | 14 ++-- AK/MACAddress.h | 2 +- AK/String.cpp | 18 ++--- AK/String.h | 34 ++++----- AK/StringBuilder.cpp | 4 +- AK/StringBuilder.h | 4 +- AK/StringUtils.cpp | 72 +++++++++---------- AK/StringUtils.h | 40 +++++------ AK/StringView.cpp | 20 +++--- AK/StringView.h | 38 +++++----- AK/URL.cpp | 12 ++-- AK/URL.h | 12 ++-- AK/URLParser.cpp | 20 +++--- AK/URLParser.h | 4 +- AK/UUID.cpp | 4 +- AK/UUID.h | 4 +- AK/Utf16View.cpp | 2 +- AK/Utf16View.h | 2 +- AK/Utf8View.h | 2 +- Kernel/CommandLine.cpp | 4 +- Kernel/CommandLine.h | 4 +- Kernel/FileSystem/DevPtsFS.cpp | 4 +- Kernel/FileSystem/DevPtsFS.h | 4 +- Kernel/FileSystem/DevTmpFS.cpp | 6 +- Kernel/FileSystem/DevTmpFS.h | 6 +- Kernel/FileSystem/Ext2FileSystem.cpp | 4 +- Kernel/FileSystem/Ext2FileSystem.h | 4 +- Kernel/FileSystem/FileSystem.cpp | 2 +- Kernel/FileSystem/FileSystem.h | 2 +- Kernel/FileSystem/ISO9660FileSystem.cpp | 10 +-- Kernel/FileSystem/ISO9660FileSystem.h | 10 +-- Kernel/FileSystem/Inode.h | 4 +- Kernel/FileSystem/Plan9FileSystem.cpp | 16 ++--- Kernel/FileSystem/Plan9FileSystem.h | 6 +- Kernel/FileSystem/ProcFS.cpp | 4 +- Kernel/FileSystem/ProcFS.h | 4 +- Kernel/FileSystem/SysFS.cpp | 4 +- Kernel/FileSystem/SysFS.h | 4 +- Kernel/FileSystem/TmpFS.cpp | 4 +- Kernel/FileSystem/TmpFS.h | 4 +- Kernel/Firmware/ACPI/Definitions.h | 2 +- Kernel/Firmware/ACPI/Parser.cpp | 20 +++--- Kernel/Firmware/ACPI/Parser.h | 4 +- Kernel/KBufferBuilder.cpp | 4 +- Kernel/KBufferBuilder.h | 4 +- Kernel/KLexicalPath.cpp | 12 ++-- Kernel/KLexicalPath.h | 12 ++-- Kernel/KSyms.cpp | 2 +- Kernel/KSyms.h | 2 +- Kernel/Net/NetworkingManagement.cpp | 2 +- Kernel/Net/NetworkingManagement.h | 2 +- Kernel/PerformanceEventBuffer.cpp | 6 +- Kernel/PerformanceEventBuffer.h | 6 +- Kernel/TTY/VirtualConsole.cpp | 2 +- Kernel/TTY/VirtualConsole.h | 4 +- .../LibUnicode/GenerateUnicodeData.cpp | 10 +-- .../LibUnicode/GenerateUnicodeLocale.cpp | 26 +++---- .../CodeGenerators/LibUnicode/GeneratorUtil.h | 2 +- .../LibWeb/Generate_CSS_PropertyID_cpp.cpp | 2 +- .../LibWeb/Generate_CSS_PropertyID_h.cpp | 2 +- .../LibWeb/Generate_CSS_ValueID_cpp.cpp | 2 +- .../LibWeb/Generate_CSS_ValueID_h.cpp | 2 +- .../LibWeb/WrapperGenerator.cpp | 4 +- Meta/Lagom/Tools/ConfigureComponents/main.cpp | 4 +- Tests/LibJS/test-js.cpp | 2 +- Tests/LibWeb/TestHTMLTokenizer.cpp | 2 +- .../Browser/BookmarksBarWidget.cpp | 4 +- .../Applications/Browser/ConsoleWidget.cpp | 4 +- Userland/Applications/Browser/ConsoleWidget.h | 4 +- .../FileManager/DirectoryView.cpp | 2 +- .../Applications/FileManager/DirectoryView.h | 6 +- .../FileOperationProgressWidget.cpp | 4 +- .../FileManager/FileOperationProgressWidget.h | 4 +- Userland/Applications/FileManager/main.cpp | 2 +- Userland/Applications/Help/History.cpp | 2 +- Userland/Applications/Help/History.h | 2 +- Userland/Applications/Help/ManualModel.cpp | 2 +- Userland/Applications/Help/ManualModel.h | 2 +- Userland/Applications/Help/ManualPageNode.h | 2 +- .../HexEditor/HexEditorWidget.cpp | 2 +- .../Applications/HexEditor/HexEditorWidget.h | 2 +- .../KeyboardMapper/KeyboardMapperWidget.cpp | 2 +- .../KeyboardMapper/KeyboardMapperWidget.h | 2 +- Userland/Applications/Piano/Track.cpp | 2 +- Userland/Applications/Piano/Track.h | 2 +- .../Applications/PixelPaint/ToolboxWidget.cpp | 2 +- Userland/Applications/Spreadsheet/Cell.cpp | 2 +- Userland/Applications/Spreadsheet/Cell.h | 2 +- .../Spreadsheet/CellType/Type.cpp | 4 +- .../Applications/Spreadsheet/CellType/Type.h | 4 +- .../Applications/Spreadsheet/HelpWindow.cpp | 2 +- .../Applications/Spreadsheet/HelpWindow.h | 2 +- .../Applications/Spreadsheet/Spreadsheet.cpp | 12 ++-- .../Applications/Spreadsheet/Spreadsheet.h | 16 ++--- .../Spreadsheet/SpreadsheetWidget.cpp | 4 +- .../Spreadsheet/SpreadsheetWidget.h | 4 +- .../Applications/Spreadsheet/Workbook.cpp | 4 +- Userland/Applications/Spreadsheet/Workbook.h | 6 +- .../SystemMonitor/ProcessModel.cpp | 2 +- .../Applications/SystemMonitor/ProcessModel.h | 2 +- Userland/Applications/Terminal/main.cpp | 2 +- .../Applications/TextEditor/MainWidget.cpp | 2 +- Userland/Applications/TextEditor/MainWidget.h | 2 +- .../DevTools/HackStudio/ClassViewWidget.h | 2 +- .../Debugger/EvaluateExpressionDialog.cpp | 2 +- .../Debugger/EvaluateExpressionDialog.h | 2 +- .../HackStudio/Debugger/VariablesModel.cpp | 4 +- .../HackStudio/Debugger/VariablesModel.h | 2 +- .../DevTools/HackStudio/FindInFilesWidget.cpp | 2 +- Userland/DevTools/HackStudio/LanguageClient.h | 2 +- .../Cpp/CppComprehensionEngine.cpp | 6 +- .../Cpp/CppComprehensionEngine.h | 2 +- .../Shell/ShellComprehensionEngine.h | 2 +- Userland/DevTools/Inspector/RemoteProcess.cpp | 2 +- Userland/DevTools/Inspector/RemoteProcess.h | 2 +- Userland/DevTools/Profiler/Profile.cpp | 2 +- Userland/DevTools/Profiler/Profile.h | 2 +- Userland/DevTools/Profiler/ProfileModel.cpp | 2 +- Userland/DevTools/Profiler/ProfileModel.h | 2 +- Userland/DevTools/UserspaceEmulator/Report.h | 2 +- .../DevTools/UserspaceEmulator/SoftCPU.cpp | 2 +- Userland/DevTools/UserspaceEmulator/SoftCPU.h | 2 +- Userland/Games/Chess/ChessWidget.cpp | 10 +-- Userland/Games/Chess/ChessWidget.h | 8 +-- Userland/Games/Chess/Engine.cpp | 2 +- Userland/Games/Chess/Engine.h | 2 +- Userland/Libraries/LibAudio/FlacLoader.cpp | 2 +- Userland/Libraries/LibAudio/FlacLoader.h | 2 +- Userland/Libraries/LibAudio/Loader.cpp | 2 +- Userland/Libraries/LibAudio/Loader.h | 4 +- Userland/Libraries/LibAudio/WavLoader.cpp | 2 +- Userland/Libraries/LibAudio/WavLoader.h | 2 +- Userland/Libraries/LibAudio/WavWriter.cpp | 4 +- Userland/Libraries/LibAudio/WavWriter.h | 4 +- Userland/Libraries/LibC/getopt.cpp | 4 +- Userland/Libraries/LibChess/Chess.cpp | 8 +-- Userland/Libraries/LibChess/Chess.h | 8 +-- Userland/Libraries/LibChess/UCICommand.cpp | 24 +++---- Userland/Libraries/LibChess/UCICommand.h | 28 ++++---- Userland/Libraries/LibCore/IODevice.cpp | 2 +- Userland/Libraries/LibCore/IODevice.h | 2 +- Userland/Libraries/LibCore/MimeData.cpp | 2 +- Userland/Libraries/LibCore/MimeData.h | 2 +- Userland/Libraries/LibCpp/AST.h | 6 +- Userland/Libraries/LibCpp/Lexer.cpp | 6 +- Userland/Libraries/LibCpp/Lexer.h | 2 +- Userland/Libraries/LibCpp/Parser.cpp | 8 +-- Userland/Libraries/LibCpp/Parser.h | 6 +- Userland/Libraries/LibCpp/Preprocessor.cpp | 10 +-- Userland/Libraries/LibCpp/Preprocessor.h | 10 +-- Userland/Libraries/LibCpp/Token.h | 4 +- Userland/Libraries/LibCrypto/ASN1/ASN1.cpp | 4 +- Userland/Libraries/LibCrypto/ASN1/ASN1.h | 4 +- .../Libraries/LibCrypto/Authentication/HMAC.h | 6 +- .../LibCrypto/BigInt/SignedBigInteger.h | 2 +- .../LibCrypto/BigInt/UnsignedBigInteger.h | 2 +- .../Libraries/LibCrypto/Hash/HashFunction.h | 2 +- Userland/Libraries/LibCrypto/Hash/MD5.h | 2 +- Userland/Libraries/LibCrypto/Hash/SHA1.h | 2 +- Userland/Libraries/LibCrypto/Hash/SHA2.h | 6 +- Userland/Libraries/LibCrypto/PK/RSA.h | 2 +- .../Libraries/LibDebug/Dwarf/DwarfInfo.cpp | 2 +- Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h | 2 +- Userland/Libraries/LibDesktop/AppFile.cpp | 8 +-- Userland/Libraries/LibDesktop/AppFile.h | 8 +-- Userland/Libraries/LibDiff/Generator.cpp | 2 +- Userland/Libraries/LibDiff/Generator.h | 2 +- Userland/Libraries/LibELF/DynamicLinker.cpp | 2 +- Userland/Libraries/LibELF/DynamicLinker.h | 2 +- Userland/Libraries/LibELF/DynamicObject.cpp | 8 +-- Userland/Libraries/LibELF/DynamicObject.h | 12 ++-- Userland/Libraries/LibELF/Hashes.h | 4 +- Userland/Libraries/LibELF/Image.cpp | 4 +- Userland/Libraries/LibELF/Image.h | 4 +- .../LibFileSystemAccessClient/Client.cpp | 2 +- .../LibFileSystemAccessClient/Client.h | 2 +- Userland/Libraries/LibGUI/AboutDialog.cpp | 4 +- Userland/Libraries/LibGUI/AboutDialog.h | 4 +- Userland/Libraries/LibGUI/AbstractView.cpp | 2 +- Userland/Libraries/LibGUI/AbstractView.h | 2 +- Userland/Libraries/LibGUI/ComboBox.cpp | 2 +- Userland/Libraries/LibGUI/ComboBox.h | 2 +- Userland/Libraries/LibGUI/Desktop.cpp | 6 +- Userland/Libraries/LibGUI/Desktop.h | 6 +- .../Libraries/LibGUI/EmojiInputDialog.cpp | 2 +- Userland/Libraries/LibGUI/Event.h | 2 +- Userland/Libraries/LibGUI/FilePicker.cpp | 6 +- Userland/Libraries/LibGUI/FilePicker.h | 6 +- Userland/Libraries/LibGUI/FileSystemModel.cpp | 4 +- Userland/Libraries/LibGUI/FileSystemModel.h | 2 +- .../Libraries/LibGUI/FilteringProxyModel.cpp | 4 +- .../Libraries/LibGUI/FilteringProxyModel.h | 4 +- .../LibGUI/GMLAutocompleteProvider.h | 2 +- Userland/Libraries/LibGUI/GMLFormatter.cpp | 2 +- Userland/Libraries/LibGUI/GMLFormatter.h | 2 +- Userland/Libraries/LibGUI/GMLLexer.cpp | 2 +- Userland/Libraries/LibGUI/GMLLexer.h | 2 +- Userland/Libraries/LibGUI/GMLParser.cpp | 2 +- Userland/Libraries/LibGUI/GMLParser.h | 2 +- Userland/Libraries/LibGUI/GroupBox.cpp | 4 +- Userland/Libraries/LibGUI/GroupBox.h | 4 +- Userland/Libraries/LibGUI/INILexer.cpp | 2 +- Userland/Libraries/LibGUI/INILexer.h | 2 +- Userland/Libraries/LibGUI/Icon.cpp | 2 +- Userland/Libraries/LibGUI/Icon.h | 2 +- Userland/Libraries/LibGUI/ImageWidget.cpp | 4 +- Userland/Libraries/LibGUI/ImageWidget.h | 4 +- Userland/Libraries/LibGUI/InputBox.cpp | 4 +- Userland/Libraries/LibGUI/InputBox.h | 4 +- Userland/Libraries/LibGUI/ItemListModel.h | 2 +- Userland/Libraries/LibGUI/MessageBox.cpp | 6 +- Userland/Libraries/LibGUI/MessageBox.h | 6 +- Userland/Libraries/LibGUI/Model.h | 4 +- Userland/Libraries/LibGUI/ProcessChooser.cpp | 2 +- Userland/Libraries/LibGUI/ProcessChooser.h | 2 +- .../Libraries/LibGUI/SortingProxyModel.cpp | 2 +- Userland/Libraries/LibGUI/SortingProxyModel.h | 2 +- Userland/Libraries/LibGUI/TabWidget.cpp | 4 +- Userland/Libraries/LibGUI/TabWidget.h | 6 +- Userland/Libraries/LibGUI/TextDocument.cpp | 16 ++--- Userland/Libraries/LibGUI/TextDocument.h | 16 ++--- Userland/Libraries/LibGUI/TextEditor.cpp | 4 +- Userland/Libraries/LibGUI/TextEditor.h | 6 +- Userland/Libraries/LibGUI/Variant.cpp | 2 +- Userland/Libraries/LibGUI/Variant.h | 2 +- Userland/Libraries/LibGUI/Widget.cpp | 4 +- Userland/Libraries/LibGUI/Widget.h | 4 +- Userland/Libraries/LibGemini/Document.cpp | 4 +- Userland/Libraries/LibGemini/Document.h | 4 +- Userland/Libraries/LibGfx/Bitmap.h | 2 +- Userland/Libraries/LibGfx/BitmapFont.cpp | 2 +- Userland/Libraries/LibGfx/BitmapFont.h | 2 +- .../Libraries/LibGfx/ClassicStylePainter.cpp | 2 +- .../Libraries/LibGfx/ClassicStylePainter.h | 2 +- .../Libraries/LibGfx/ClassicWindowTheme.cpp | 4 +- .../Libraries/LibGfx/ClassicWindowTheme.h | 4 +- Userland/Libraries/LibGfx/Color.cpp | 6 +- Userland/Libraries/LibGfx/Color.h | 2 +- Userland/Libraries/LibGfx/CursorParams.cpp | 2 +- Userland/Libraries/LibGfx/CursorParams.h | 2 +- Userland/Libraries/LibGfx/Font.h | 2 +- Userland/Libraries/LibGfx/FontDatabase.cpp | 2 +- Userland/Libraries/LibGfx/FontDatabase.h | 2 +- Userland/Libraries/LibGfx/ICOLoader.cpp | 2 +- Userland/Libraries/LibGfx/ICOLoader.h | 2 +- Userland/Libraries/LibGfx/PBMLoader.cpp | 2 +- Userland/Libraries/LibGfx/PBMLoader.h | 2 +- Userland/Libraries/LibGfx/PGMLoader.cpp | 2 +- Userland/Libraries/LibGfx/PGMLoader.h | 2 +- Userland/Libraries/LibGfx/PPMLoader.cpp | 2 +- Userland/Libraries/LibGfx/PPMLoader.h | 2 +- Userland/Libraries/LibGfx/Painter.cpp | 10 +-- Userland/Libraries/LibGfx/Painter.h | 10 +-- .../LibGfx/PortableImageLoaderCommon.h | 2 +- Userland/Libraries/LibGfx/StylePainter.cpp | 2 +- Userland/Libraries/LibGfx/StylePainter.h | 4 +- Userland/Libraries/LibGfx/TextAlignment.h | 2 +- .../Libraries/LibGfx/TrueTypeFont/Font.cpp | 2 +- Userland/Libraries/LibGfx/TrueTypeFont/Font.h | 2 +- Userland/Libraries/LibGfx/WindowTheme.h | 4 +- .../Libraries/LibIMAP/QuotedPrintable.cpp | 2 +- Userland/Libraries/LibIMAP/QuotedPrintable.h | 2 +- Userland/Libraries/LibIPC/Encoder.cpp | 2 +- Userland/Libraries/LibIPC/Encoder.h | 2 +- Userland/Libraries/LibIPC/ServerConnection.h | 2 +- Userland/Libraries/LibJS/Lexer.h | 4 +- Userland/Libraries/LibJS/MarkupGenerator.cpp | 2 +- Userland/Libraries/LibJS/MarkupGenerator.h | 2 +- Userland/Libraries/LibJS/Parser.cpp | 4 +- Userland/Libraries/LibJS/Parser.h | 2 +- .../LibJS/Runtime/Intl/AbstractOperations.cpp | 2 +- .../LibJS/Runtime/Intl/AbstractOperations.h | 2 +- .../Libraries/LibJS/Runtime/Utf16String.cpp | 4 +- .../Libraries/LibJS/Runtime/Utf16String.h | 4 +- Userland/Libraries/LibJS/Token.h | 8 +-- Userland/Libraries/LibLine/Editor.cpp | 8 +-- Userland/Libraries/LibLine/Editor.h | 10 +-- .../Libraries/LibLine/InternalFunctions.cpp | 2 +- Userland/Libraries/LibLine/Style.h | 2 +- .../Libraries/LibLine/SuggestionManager.cpp | 2 +- .../Libraries/LibLine/SuggestionManager.h | 4 +- Userland/Libraries/LibMarkdown/Document.cpp | 2 +- Userland/Libraries/LibMarkdown/Document.h | 2 +- Userland/Libraries/LibMarkdown/Heading.cpp | 2 +- .../Libraries/LibMarkdown/HorizontalRule.cpp | 2 +- .../Libraries/LibMarkdown/LineIterator.cpp | 2 +- Userland/Libraries/LibMarkdown/LineIterator.h | 2 +- Userland/Libraries/LibMarkdown/List.cpp | 2 +- Userland/Libraries/LibMarkdown/Text.cpp | 10 +-- Userland/Libraries/LibMarkdown/Text.h | 10 +-- Userland/Libraries/LibPDF/Command.h | 2 +- Userland/Libraries/LibRegex/RegexByteCode.cpp | 8 +-- Userland/Libraries/LibRegex/RegexByteCode.h | 6 +- Userland/Libraries/LibRegex/RegexLexer.h | 2 +- Userland/Libraries/LibRegex/RegexMatch.h | 16 ++--- Userland/Libraries/LibRegex/RegexMatcher.cpp | 2 +- Userland/Libraries/LibRegex/RegexMatcher.h | 24 +++---- Userland/Libraries/LibRegex/RegexParser.cpp | 2 +- Userland/Libraries/LibTLS/HandshakeClient.cpp | 4 +- Userland/Libraries/LibTLS/TLSv12.h | 12 ++-- Userland/Libraries/LibTextCodec/Decoder.cpp | 22 +++--- Userland/Libraries/LibTextCodec/Decoder.h | 24 +++---- .../Libraries/LibUnicode/CharacterTypes.cpp | 10 +-- .../Libraries/LibUnicode/CharacterTypes.h | 10 +-- Userland/Libraries/LibVT/Terminal.cpp | 4 +- Userland/Libraries/LibVT/Terminal.h | 6 +- Userland/Libraries/LibVT/TerminalWidget.cpp | 8 +-- Userland/Libraries/LibVT/TerminalWidget.h | 12 ++-- .../Libraries/LibVideo/MatroskaReader.cpp | 4 +- Userland/Libraries/LibVideo/MatroskaReader.h | 4 +- .../Libraries/LibWeb/CSS/CSSGroupingRule.cpp | 2 +- .../Libraries/LibWeb/CSS/CSSGroupingRule.h | 2 +- .../Libraries/LibWeb/CSS/Parser/Parser.cpp | 22 +++--- Userland/Libraries/LibWeb/CSS/Parser/Parser.h | 20 +++--- .../Libraries/LibWeb/CSS/Parser/Tokenizer.cpp | 2 +- .../Libraries/LibWeb/CSS/Parser/Tokenizer.h | 2 +- Userland/Libraries/LibWeb/CSS/Serialize.cpp | 12 ++-- Userland/Libraries/LibWeb/CSS/Serialize.h | 12 ++-- Userland/Libraries/LibWeb/DOM/Document.cpp | 2 +- Userland/Libraries/LibWeb/DOM/Document.h | 2 +- Userland/Libraries/LibWeb/DOM/Event.h | 2 +- Userland/Libraries/LibWeb/DOMTreeModel.cpp | 2 +- .../Libraries/LibWeb/HTML/Parser/Entities.cpp | 2 +- .../Libraries/LibWeb/HTML/Parser/Entities.h | 2 +- .../LibWeb/HTML/Parser/HTMLParser.cpp | 8 +-- .../Libraries/LibWeb/HTML/Parser/HTMLParser.h | 6 +- .../LibWeb/HTML/Parser/HTMLTokenizer.cpp | 4 +- .../LibWeb/HTML/Parser/HTMLTokenizer.h | 4 +- .../Libraries/LibWeb/InProcessWebView.cpp | 2 +- Userland/Libraries/LibWeb/InProcessWebView.h | 2 +- Userland/Libraries/LibWeb/Layout/TextNode.cpp | 4 +- Userland/Libraries/LibWeb/Layout/TextNode.h | 2 +- .../Libraries/LibWeb/Loader/FrameLoader.cpp | 2 +- .../Libraries/LibWeb/Loader/FrameLoader.h | 2 +- .../Libraries/LibWeb/OutOfProcessWebView.cpp | 2 +- .../Libraries/LibWeb/OutOfProcessWebView.h | 2 +- Userland/Libraries/LibWeb/Page/Page.cpp | 2 +- Userland/Libraries/LibWeb/Page/Page.h | 2 +- .../Libraries/LibWeb/URL/URLSearchParams.cpp | 2 +- .../Libraries/LibWeb/URL/URLSearchParams.h | 2 +- Userland/Services/LaunchServer/Launcher.cpp | 2 +- Userland/Services/LaunchServer/Launcher.h | 2 +- Userland/Services/LoginServer/LoginWindow.h | 4 +- Userland/Services/SystemServer/Service.cpp | 2 +- Userland/Services/SystemServer/Service.h | 2 +- Userland/Services/Taskbar/TaskbarButton.cpp | 2 +- Userland/Services/TelnetServer/Client.cpp | 4 +- Userland/Services/TelnetServer/Client.h | 2 +- Userland/Services/TelnetServer/Parser.cpp | 2 +- Userland/Services/TelnetServer/Parser.h | 4 +- Userland/Services/WindowServer/Cursor.cpp | 6 +- Userland/Services/WindowServer/Cursor.h | 4 +- Userland/Services/WindowServer/Menu.cpp | 2 +- Userland/Services/WindowServer/Menu.h | 2 +- .../WindowServer/MultiScaleBitmaps.cpp | 6 +- .../Services/WindowServer/MultiScaleBitmaps.h | 4 +- .../Services/WindowServer/WindowFrame.cpp | 2 +- Userland/Shell/Builtin.cpp | 2 +- Userland/Shell/Formatter.h | 2 +- Userland/Shell/ImmediateFunctions.cpp | 2 +- Userland/Shell/Parser.cpp | 4 +- Userland/Shell/Parser.h | 4 +- Userland/Shell/Shell.cpp | 18 ++--- Userland/Shell/Shell.h | 20 +++--- Userland/Utilities/expr.cpp | 6 +- Userland/Utilities/gml-format.cpp | 4 +- Userland/Utilities/js.cpp | 2 +- Userland/Utilities/less.cpp | 4 +- Userland/Utilities/mount.cpp | 2 +- Userland/Utilities/pro.cpp | 6 +- Userland/Utilities/stty.cpp | 2 +- Userland/Utilities/sysctl.cpp | 6 +- Userland/Utilities/test.cpp | 2 +- Userland/Utilities/wasm.cpp | 2 +- Userland/Utilities/xargs.cpp | 8 +-- 392 files changed, 978 insertions(+), 978 deletions(-) diff --git a/AK/Base64.cpp b/AK/Base64.cpp index 4d0a419f4ad..f9d321ee38f 100644 --- a/AK/Base64.cpp +++ b/AK/Base64.cpp @@ -38,7 +38,7 @@ static constexpr auto make_lookup_table() return table; } -size_t calculate_base64_decoded_length(const StringView& input) +size_t calculate_base64_decoded_length(StringView input) { return input.length() * 3 / 4; } @@ -48,7 +48,7 @@ size_t calculate_base64_encoded_length(ReadonlyBytes input) return ((4 * input.size() / 3) + 3) & ~3; } -Optional decode_base64(const StringView& input) +Optional decode_base64(StringView input) { auto get = [&](const size_t offset, bool* is_padding) -> Optional { constexpr auto table = make_lookup_table(); diff --git a/AK/Base64.h b/AK/Base64.h index c1c5388629c..d4c6de40f84 100644 --- a/AK/Base64.h +++ b/AK/Base64.h @@ -13,11 +13,11 @@ namespace AK { -size_t calculate_base64_decoded_length(const StringView&); +size_t calculate_base64_decoded_length(StringView); size_t calculate_base64_encoded_length(ReadonlyBytes); -Optional decode_base64(const StringView&); +Optional decode_base64(StringView); String encode_base64(ReadonlyBytes); diff --git a/AK/DateTimeLexer.h b/AK/DateTimeLexer.h index 51de0c42668..98c81b78f64 100644 --- a/AK/DateTimeLexer.h +++ b/AK/DateTimeLexer.h @@ -14,7 +14,7 @@ namespace AK { class DateTimeLexer : public GenericLexer { public: - constexpr explicit DateTimeLexer(const StringView& input) + constexpr explicit DateTimeLexer(StringView input) : GenericLexer(input) { } diff --git a/AK/Demangle.h b/AK/Demangle.h index 9e41dc949c8..c04df9e674e 100644 --- a/AK/Demangle.h +++ b/AK/Demangle.h @@ -12,7 +12,7 @@ namespace AK { -inline String demangle(const StringView& name) +inline String demangle(StringView name) { int status = 0; auto* demangled_name = abi::__cxa_demangle(name.to_string().characters(), nullptr, nullptr, &status); diff --git a/AK/FlyString.cpp b/AK/FlyString.cpp index ecf3a31df88..20b8e2ab048 100644 --- a/AK/FlyString.cpp +++ b/AK/FlyString.cpp @@ -55,7 +55,7 @@ FlyString::FlyString(const String& string) } } -FlyString::FlyString(StringView const& string) +FlyString::FlyString(StringView string) { if (string.is_null()) return; @@ -95,17 +95,17 @@ template Optional FlyString::to_uint(TrimWhitespace) const; template Optional FlyString::to_uint(TrimWhitespace) const; template Optional FlyString::to_uint(TrimWhitespace) const; -bool FlyString::equals_ignoring_case(const StringView& other) const +bool FlyString::equals_ignoring_case(StringView other) const { return StringUtils::equals_ignoring_case(view(), other); } -bool FlyString::starts_with(const StringView& str, CaseSensitivity case_sensitivity) const +bool FlyString::starts_with(StringView str, CaseSensitivity case_sensitivity) const { return StringUtils::starts_with(view(), str, case_sensitivity); } -bool FlyString::ends_with(const StringView& str, CaseSensitivity case_sensitivity) const +bool FlyString::ends_with(StringView str, CaseSensitivity case_sensitivity) const { return StringUtils::ends_with(view(), str, case_sensitivity); } @@ -132,7 +132,7 @@ bool FlyString::operator==(const String& other) const return !__builtin_memcmp(characters(), other.characters(), length()); } -bool FlyString::operator==(const StringView& string) const +bool FlyString::operator==(StringView string) const { return *this == String(string); } diff --git a/AK/FlyString.h b/AK/FlyString.h index d91e94c68b5..8c8d55dad08 100644 --- a/AK/FlyString.h +++ b/AK/FlyString.h @@ -23,7 +23,7 @@ public: { } FlyString(const String&); - FlyString(const StringView&); + FlyString(StringView); FlyString(const char* string) : FlyString(static_cast(string)) { @@ -58,8 +58,8 @@ public: bool operator==(const String&) const; bool operator!=(const String& string) const { return !(*this == string); } - bool operator==(const StringView&) const; - bool operator!=(const StringView& string) const { return !(*this == string); } + bool operator==(StringView) const; + bool operator!=(StringView string) const { return !(*this == string); } bool operator==(const char*) const; bool operator!=(const char* string) const { return !(*this == string); } @@ -78,9 +78,9 @@ public: template Optional to_uint(TrimWhitespace = TrimWhitespace::Yes) const; - bool equals_ignoring_case(const StringView&) const; - bool starts_with(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const; - bool ends_with(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const; + bool equals_ignoring_case(StringView) const; + bool starts_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; + bool ends_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; static void did_destroy_impl(Badge, StringImpl&); diff --git a/AK/GenericLexer.h b/AK/GenericLexer.h index 7a010600688..0a44bffc65e 100644 --- a/AK/GenericLexer.h +++ b/AK/GenericLexer.h @@ -13,7 +13,7 @@ namespace AK { class GenericLexer { public: - constexpr explicit GenericLexer(const StringView& input) + constexpr explicit GenericLexer(StringView input) : m_input(input) { } @@ -93,7 +93,7 @@ public: return consume_specific(StringView { next }); } - constexpr char consume_escaped_character(char escape_char = '\\', const StringView& escape_map = "n\nr\rt\tb\bf\f") + constexpr char consume_escaped_character(char escape_char = '\\', StringView escape_map = "n\nr\rt\tb\bf\f") { if (!consume_specific(escape_char)) return consume(); @@ -215,7 +215,7 @@ private: Result decode_single_or_paired_surrogate(bool combine_surrogate_pairs); }; -constexpr auto is_any_of(const StringView& values) +constexpr auto is_any_of(StringView values) { return [values](auto c) { return values.contains(c); }; } diff --git a/AK/Hex.cpp b/AK/Hex.cpp index 099b96eb5f2..7e8cd99d86f 100644 --- a/AK/Hex.cpp +++ b/AK/Hex.cpp @@ -15,7 +15,7 @@ namespace AK { -Optional decode_hex(const StringView& input) +Optional decode_hex(StringView input) { if ((input.length() % 2) != 0) return {}; diff --git a/AK/Hex.h b/AK/Hex.h index 7c78befbe80..8c631e45827 100644 --- a/AK/Hex.h +++ b/AK/Hex.h @@ -24,7 +24,7 @@ constexpr u8 decode_hex_digit(char digit) return 255; } -Optional decode_hex(const StringView&); +Optional decode_hex(StringView); String encode_hex(ReadonlyBytes); diff --git a/AK/IPv4Address.h b/AK/IPv4Address.h index 09ea8e82003..3c0f76f6b9e 100644 --- a/AK/IPv4Address.h +++ b/AK/IPv4Address.h @@ -66,7 +66,7 @@ public: octet(SubnetClass::A)); } - static Optional from_string(const StringView& string) + static Optional from_string(StringView string) { if (string.is_null()) return {}; diff --git a/AK/JsonArraySerializer.h b/AK/JsonArraySerializer.h index 38cb744f853..fa0f3086af9 100644 --- a/AK/JsonArraySerializer.h +++ b/AK/JsonArraySerializer.h @@ -39,7 +39,7 @@ public: } #endif - void add(const StringView& value) + void add(StringView value) { begin_item(); (void)m_builder.append('"'); diff --git a/AK/JsonObjectSerializer.h b/AK/JsonObjectSerializer.h index 52831ed2685..804ae09732d 100644 --- a/AK/JsonObjectSerializer.h +++ b/AK/JsonObjectSerializer.h @@ -33,14 +33,14 @@ public: } #ifndef KERNEL - void add(const StringView& key, const JsonValue& value) + void add(StringView key, const JsonValue& value) { begin_item(key); value.serialize(m_builder); } #endif - void add(const StringView& key, const StringView& value) + void add(StringView key, StringView value) { begin_item(key); (void)m_builder.append('"'); @@ -48,7 +48,7 @@ public: (void)m_builder.append('"'); } - void add(const StringView& key, const String& value) + void add(StringView key, const String& value) { begin_item(key); (void)m_builder.append('"'); @@ -56,7 +56,7 @@ public: (void)m_builder.append('"'); } - void add(const StringView& key, const char* value) + void add(StringView key, const char* value) { begin_item(key); (void)m_builder.append('"'); @@ -64,63 +64,63 @@ public: (void)m_builder.append('"'); } - void add(const StringView& key, bool value) + void add(StringView key, bool value) { begin_item(key); (void)m_builder.append(value ? "true" : "false"); } - void add(const StringView& key, int value) + void add(StringView key, int value) { begin_item(key); (void)m_builder.appendff("{}", value); } - void add(const StringView& key, unsigned value) + void add(StringView key, unsigned value) { begin_item(key); (void)m_builder.appendff("{}", value); } - void add(const StringView& key, long value) + void add(StringView key, long value) { begin_item(key); (void)m_builder.appendff("{}", value); } - void add(const StringView& key, long unsigned value) + void add(StringView key, long unsigned value) { begin_item(key); (void)m_builder.appendff("{}", value); } - void add(const StringView& key, long long value) + void add(StringView key, long long value) { begin_item(key); (void)m_builder.appendff("{}", value); } - void add(const StringView& key, long long unsigned value) + void add(StringView key, long long unsigned value) { begin_item(key); (void)m_builder.appendff("{}", value); } #ifndef KERNEL - void add(const StringView& key, double value) + void add(StringView key, double value) { begin_item(key); (void)m_builder.appendff("{}", value); } #endif - JsonArraySerializer add_array(const StringView& key) + JsonArraySerializer add_array(StringView key) { begin_item(key); return JsonArraySerializer(m_builder); } - JsonObjectSerializer add_object(const StringView& key) + JsonObjectSerializer add_object(StringView key) { begin_item(key); return JsonObjectSerializer(m_builder); @@ -134,7 +134,7 @@ public: } private: - void begin_item(const StringView& key) + void begin_item(StringView key) { if (!m_empty) (void)m_builder.append(','); diff --git a/AK/JsonParser.h b/AK/JsonParser.h index 4d4ed19694c..475903f76b7 100644 --- a/AK/JsonParser.h +++ b/AK/JsonParser.h @@ -13,7 +13,7 @@ namespace AK { class JsonParser : private GenericLexer { public: - explicit JsonParser(const StringView& input) + explicit JsonParser(StringView input) : GenericLexer(input) { } diff --git a/AK/JsonPath.h b/AK/JsonPath.h index 0ae3f0f3edb..ab93c2d8ca5 100644 --- a/AK/JsonPath.h +++ b/AK/JsonPath.h @@ -27,7 +27,7 @@ public: { } - JsonPathElement(const StringView& key) + JsonPathElement(StringView key) : m_kind(Kind::Key) , m_key(key) { diff --git a/AK/JsonValue.cpp b/AK/JsonValue.cpp index 439b8f1859c..184649b308d 100644 --- a/AK/JsonValue.cpp +++ b/AK/JsonValue.cpp @@ -228,7 +228,7 @@ void JsonValue::clear() } #ifndef KERNEL -Optional JsonValue::from_string(const StringView& input) +Optional JsonValue::from_string(StringView input) { return JsonParser(input).parse(); } diff --git a/AK/JsonValue.h b/AK/JsonValue.h index 9783b78ac3e..b8b1b0b6d30 100644 --- a/AK/JsonValue.h +++ b/AK/JsonValue.h @@ -30,7 +30,7 @@ public: Object, }; - static Optional from_string(const StringView&); + static Optional from_string(StringView); explicit JsonValue(Type = Type::Null); ~JsonValue() { clear(); } diff --git a/AK/LexicalPath.cpp b/AK/LexicalPath.cpp index 7a4afdf2ecf..7864c13983b 100644 --- a/AK/LexicalPath.cpp +++ b/AK/LexicalPath.cpp @@ -67,7 +67,7 @@ Vector LexicalPath::parts() const return vector; } -bool LexicalPath::has_extension(StringView const& extension) const +bool LexicalPath::has_extension(StringView extension) const { return m_string.ends_with(extension, CaseSensitivity::CaseInsensitive); } @@ -129,7 +129,7 @@ String LexicalPath::absolute_path(String dir_path, String target) return LexicalPath::canonicalized_path(join(dir_path, target).string()); } -String LexicalPath::relative_path(StringView const& a_path, StringView const& a_prefix) +String LexicalPath::relative_path(StringView a_path, StringView a_prefix) { if (!a_path.starts_with('/') || !a_prefix.starts_with('/')) { // FIXME: This should probably VERIFY or return an Optional. @@ -159,7 +159,7 @@ String LexicalPath::relative_path(StringView const& a_path, StringView const& a_ return path; } -LexicalPath LexicalPath::append(StringView const& value) const +LexicalPath LexicalPath::append(StringView value) const { return LexicalPath::join(m_string, value); } diff --git a/AK/LexicalPath.h b/AK/LexicalPath.h index 562adbe83b5..98e11a97c03 100644 --- a/AK/LexicalPath.h +++ b/AK/LexicalPath.h @@ -19,22 +19,22 @@ public: bool is_absolute() const { return !m_string.is_empty() && m_string[0] == '/'; } String const& string() const { return m_string; } - StringView const& dirname() const { return m_dirname; } - StringView const& basename() const { return m_basename; } - StringView const& title() const { return m_title; } - StringView const& extension() const { return m_extension; } + StringView dirname() const { return m_dirname; } + StringView basename() const { return m_basename; } + StringView title() const { return m_title; } + StringView extension() const { return m_extension; } Vector const& parts_view() const { return m_parts; } [[nodiscard]] Vector parts() const; - bool has_extension(StringView const&) const; + bool has_extension(StringView) const; - [[nodiscard]] LexicalPath append(StringView const&) const; + [[nodiscard]] LexicalPath append(StringView) const; [[nodiscard]] LexicalPath parent() const; [[nodiscard]] static String canonicalized_path(String); [[nodiscard]] static String absolute_path(String dir_path, String target); - [[nodiscard]] static String relative_path(StringView const& absolute_path, StringView const& prefix); + [[nodiscard]] static String relative_path(StringView absolute_path, StringView prefix); template [[nodiscard]] static LexicalPath join(StringView first, S&&... rest) diff --git a/AK/MACAddress.h b/AK/MACAddress.h index bcac9c8eecb..32e32c1bf93 100644 --- a/AK/MACAddress.h +++ b/AK/MACAddress.h @@ -58,7 +58,7 @@ public: return String::formatted("{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}", m_data[0], m_data[1], m_data[2], m_data[3], m_data[4], m_data[5]); } - static Optional from_string(const StringView& string) + static Optional from_string(StringView string) { if (string.is_null()) return {}; diff --git a/AK/String.cpp b/AK/String.cpp index a37ab8095a0..a3bb45c5b41 100644 --- a/AK/String.cpp +++ b/AK/String.cpp @@ -31,7 +31,7 @@ bool String::operator==(const String& other) const return *m_impl == *other.m_impl; } -bool String::operator==(const StringView& other) const +bool String::operator==(StringView other) const { if (!m_impl) return !other.m_characters; @@ -202,7 +202,7 @@ template Optional String::to_uint(TrimWhitespace) const; template Optional String::to_uint(TrimWhitespace) const; template Optional String::to_uint(TrimWhitespace) const; -bool String::starts_with(const StringView& str, CaseSensitivity case_sensitivity) const +bool String::starts_with(StringView str, CaseSensitivity case_sensitivity) const { return StringUtils::starts_with(*this, str, case_sensitivity); } @@ -214,7 +214,7 @@ bool String::starts_with(char ch) const return characters()[0] == ch; } -bool String::ends_with(const StringView& str, CaseSensitivity case_sensitivity) const +bool String::ends_with(StringView str, CaseSensitivity case_sensitivity) const { return StringUtils::ends_with(*this, str, case_sensitivity); } @@ -236,7 +236,7 @@ String String::repeated(char ch, size_t count) return *impl; } -String String::repeated(const StringView& string, size_t count) +String String::repeated(StringView string, size_t count) { if (!count || string.is_empty()) return empty(); @@ -327,17 +327,17 @@ String String::roman_number_from(size_t value) return builder.to_string(); } -bool String::matches(const StringView& mask, Vector& mask_spans, CaseSensitivity case_sensitivity) const +bool String::matches(StringView mask, Vector& mask_spans, CaseSensitivity case_sensitivity) const { return StringUtils::matches(*this, mask, case_sensitivity, &mask_spans); } -bool String::matches(const StringView& mask, CaseSensitivity case_sensitivity) const +bool String::matches(StringView mask, CaseSensitivity case_sensitivity) const { return StringUtils::matches(*this, mask, case_sensitivity); } -bool String::contains(const StringView& needle, CaseSensitivity case_sensitivity) const +bool String::contains(StringView needle, CaseSensitivity case_sensitivity) const { return StringUtils::contains(*this, needle, case_sensitivity); } @@ -347,7 +347,7 @@ bool String::contains(char needle, CaseSensitivity case_sensitivity) const return StringUtils::contains(*this, StringView(&needle, 1), case_sensitivity); } -bool String::equals_ignoring_case(const StringView& other) const +bool String::equals_ignoring_case(StringView other) const { return StringUtils::equals_ignoring_case(view(), other); } @@ -361,7 +361,7 @@ String String::reverse() const return reversed_string.to_string(); } -String escape_html_entities(const StringView& html) +String escape_html_entities(StringView html) { StringBuilder builder; for (size_t i = 0; i < html.length(); ++i) { diff --git a/AK/String.h b/AK/String.h index 97d8dab0cc0..065c1e85f32 100644 --- a/AK/String.h +++ b/AK/String.h @@ -43,7 +43,7 @@ public: String() = default; - String(const StringView& view) + String(StringView view) { m_impl = StringImpl::create(view.characters_without_null_termination(), view.length()); } @@ -96,7 +96,7 @@ public: String(const FlyString&); [[nodiscard]] static String repeated(char, size_t count); - [[nodiscard]] static String repeated(const StringView&, size_t count); + [[nodiscard]] static String repeated(StringView, size_t count); [[nodiscard]] static String bijective_base_from(size_t value, unsigned base = 26, StringView map = {}); [[nodiscard]] static String roman_number_from(size_t value); @@ -109,8 +109,8 @@ public: return builder.build(); } - [[nodiscard]] bool matches(const StringView& mask, CaseSensitivity = CaseSensitivity::CaseInsensitive) const; - [[nodiscard]] bool matches(const StringView& mask, Vector&, CaseSensitivity = CaseSensitivity::CaseInsensitive) const; + [[nodiscard]] bool matches(StringView mask, CaseSensitivity = CaseSensitivity::CaseInsensitive) const; + [[nodiscard]] bool matches(StringView mask, Vector&, CaseSensitivity = CaseSensitivity::CaseInsensitive) const; template [[nodiscard]] Optional to_int(TrimWhitespace = TrimWhitespace::Yes) const; @@ -125,7 +125,7 @@ public: [[nodiscard]] bool is_whitespace() const { return StringUtils::is_whitespace(*this); } #ifndef KERNEL - [[nodiscard]] String trim(const StringView& characters, TrimMode mode = TrimMode::Both) const + [[nodiscard]] String trim(StringView characters, TrimMode mode = TrimMode::Both) const { return StringUtils::trim(view(), characters, mode); } @@ -136,9 +136,9 @@ public: } #endif - [[nodiscard]] bool equals_ignoring_case(const StringView&) const; + [[nodiscard]] bool equals_ignoring_case(StringView) const; - [[nodiscard]] bool contains(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const; + [[nodiscard]] bool contains(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; [[nodiscard]] bool contains(char, CaseSensitivity = CaseSensitivity::CaseSensitive) const; [[nodiscard]] Vector split_limit(char separator, size_t limit, bool keep_empty = false) const; @@ -146,12 +146,12 @@ public: [[nodiscard]] Vector split_view(char separator, bool keep_empty = false) const; [[nodiscard]] Optional find(char needle, size_t start = 0) const { return StringUtils::find(*this, needle, start); } - [[nodiscard]] Optional find(StringView const& needle, size_t start = 0) const { return StringUtils::find(*this, needle, start); } + [[nodiscard]] Optional find(StringView needle, size_t start = 0) const { return StringUtils::find(*this, needle, start); } [[nodiscard]] Optional find_last(char needle) const { return StringUtils::find_last(*this, needle); } - // FIXME: Implement find_last(StringView const&) for API symmetry. + // FIXME: Implement find_last(StringView) for API symmetry. Vector find_all(StringView needle) const; using SearchDirection = StringUtils::SearchDirection; - [[nodiscard]] Optional find_any_of(StringView const& needles, SearchDirection direction) const { return StringUtils::find_any_of(*this, needles, direction); } + [[nodiscard]] Optional find_any_of(StringView needles, SearchDirection direction) const { return StringUtils::find_any_of(*this, needles, direction); } [[nodiscard]] String substring(size_t start, size_t length) const; [[nodiscard]] String substring(size_t start) const; @@ -185,16 +185,16 @@ public: [[nodiscard]] constexpr ConstIterator begin() const { return ConstIterator::begin(*this); } [[nodiscard]] constexpr ConstIterator end() const { return ConstIterator::end(*this); } - [[nodiscard]] bool starts_with(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const; - [[nodiscard]] bool ends_with(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const; + [[nodiscard]] bool starts_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; + [[nodiscard]] bool ends_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; [[nodiscard]] bool starts_with(char) const; [[nodiscard]] bool ends_with(char) const; bool operator==(const String&) const; bool operator!=(const String& other) const { return !(*this == other); } - bool operator==(const StringView&) const; - bool operator!=(const StringView& other) const { return !(*this == other); } + bool operator==(StringView) const; + bool operator!=(StringView other) const { return !(*this == other); } bool operator==(const FlyString&) const; bool operator!=(const FlyString& other) const { return !(*this == other); } @@ -285,8 +285,8 @@ public: return { characters(), length() }; } - [[nodiscard]] String replace(const StringView& needle, const StringView& replacement, bool all_occurrences = false) const { return StringUtils::replace(*this, needle, replacement, all_occurrences); } - [[nodiscard]] size_t count(StringView const& needle) const { return StringUtils::count(*this, needle); } + [[nodiscard]] String replace(StringView needle, StringView replacement, bool all_occurrences = false) const { return StringUtils::replace(*this, needle, replacement, all_occurrences); } + [[nodiscard]] size_t count(StringView needle) const { return StringUtils::count(*this, needle); } [[nodiscard]] String reverse() const; template @@ -314,7 +314,7 @@ bool operator>=(const char*, const String&); bool operator>(const char*, const String&); bool operator<=(const char*, const String&); -String escape_html_entities(const StringView& html); +String escape_html_entities(StringView html); InputStream& operator>>(InputStream& stream, String& string); diff --git a/AK/StringBuilder.cpp b/AK/StringBuilder.cpp index f382be467c2..22bcf56389c 100644 --- a/AK/StringBuilder.cpp +++ b/AK/StringBuilder.cpp @@ -38,7 +38,7 @@ StringBuilder::StringBuilder(size_t initial_capacity) m_buffer.ensure_capacity(initial_capacity); } -void StringBuilder::append(StringView const& str) +void StringBuilder::append(StringView str) { if (str.is_empty()) return; @@ -129,7 +129,7 @@ void StringBuilder::append_as_lowercase(char ch) append(ch); } -void StringBuilder::append_escaped_for_json(StringView const& string) +void StringBuilder::append_escaped_for_json(StringView string) { for (auto ch : string) { switch (ch) { diff --git a/AK/StringBuilder.h b/AK/StringBuilder.h index fc7f830dc45..36019dffa7e 100644 --- a/AK/StringBuilder.h +++ b/AK/StringBuilder.h @@ -21,7 +21,7 @@ public: explicit StringBuilder(size_t initial_capacity = inline_capacity); ~StringBuilder() = default; - void append(StringView const&); + void append(StringView); void append(Utf16View const&); void append(Utf32View const&); void append(char); @@ -30,7 +30,7 @@ public: void appendvf(char const*, va_list); void append_as_lowercase(char); - void append_escaped_for_json(StringView const&); + void append_escaped_for_json(StringView); template void appendff(CheckedFormatString&& fmtstr, Parameters const&... parameters) diff --git a/AK/StringUtils.cpp b/AK/StringUtils.cpp index 78d49a48e23..d62499f45e6 100644 --- a/AK/StringUtils.cpp +++ b/AK/StringUtils.cpp @@ -19,7 +19,7 @@ namespace AK { namespace StringUtils { -bool matches(const StringView& str, const StringView& mask, CaseSensitivity case_sensitivity, Vector* match_spans) +bool matches(StringView str, StringView mask, CaseSensitivity case_sensitivity, Vector* match_spans) { auto record_span = [&match_spans](size_t start, size_t length) { if (match_spans) @@ -79,7 +79,7 @@ bool matches(const StringView& str, const StringView& mask, CaseSensitivity case } template -Optional convert_to_int(const StringView& str, TrimWhitespace trim_whitespace) +Optional convert_to_int(StringView str, TrimWhitespace trim_whitespace) { auto string = trim_whitespace == TrimWhitespace::Yes ? str.trim_whitespace() @@ -113,14 +113,14 @@ Optional convert_to_int(const StringView& str, TrimWhitespace trim_whitespace return value; } -template Optional convert_to_int(const StringView& str, TrimWhitespace); -template Optional convert_to_int(const StringView& str, TrimWhitespace); -template Optional convert_to_int(const StringView& str, TrimWhitespace); -template Optional convert_to_int(const StringView& str, TrimWhitespace); -template Optional convert_to_int(const StringView& str, TrimWhitespace); +template Optional convert_to_int(StringView str, TrimWhitespace); +template Optional convert_to_int(StringView str, TrimWhitespace); +template Optional convert_to_int(StringView str, TrimWhitespace); +template Optional convert_to_int(StringView str, TrimWhitespace); +template Optional convert_to_int(StringView str, TrimWhitespace); template -Optional convert_to_uint(const StringView& str, TrimWhitespace trim_whitespace) +Optional convert_to_uint(StringView str, TrimWhitespace trim_whitespace) { auto string = trim_whitespace == TrimWhitespace::Yes ? str.trim_whitespace() @@ -144,16 +144,16 @@ Optional convert_to_uint(const StringView& str, TrimWhitespace trim_whitespac return value; } -template Optional convert_to_uint(const StringView& str, TrimWhitespace); -template Optional convert_to_uint(const StringView& str, TrimWhitespace); -template Optional convert_to_uint(const StringView& str, TrimWhitespace); -template Optional convert_to_uint(const StringView& str, TrimWhitespace); -template Optional convert_to_uint(const StringView& str, TrimWhitespace); -template Optional convert_to_uint(const StringView& str, TrimWhitespace); -template Optional convert_to_uint(const StringView& str, TrimWhitespace); +template Optional convert_to_uint(StringView str, TrimWhitespace); +template Optional convert_to_uint(StringView str, TrimWhitespace); +template Optional convert_to_uint(StringView str, TrimWhitespace); +template Optional convert_to_uint(StringView str, TrimWhitespace); +template Optional convert_to_uint(StringView str, TrimWhitespace); +template Optional convert_to_uint(StringView str, TrimWhitespace); +template Optional convert_to_uint(StringView str, TrimWhitespace); template -Optional convert_to_uint_from_hex(const StringView& str, TrimWhitespace trim_whitespace) +Optional convert_to_uint_from_hex(StringView str, TrimWhitespace trim_whitespace) { auto string = trim_whitespace == TrimWhitespace::Yes ? str.trim_whitespace() @@ -186,12 +186,12 @@ Optional convert_to_uint_from_hex(const StringView& str, TrimWhitespace trim_ return value; } -template Optional convert_to_uint_from_hex(const StringView& str, TrimWhitespace); -template Optional convert_to_uint_from_hex(const StringView& str, TrimWhitespace); -template Optional convert_to_uint_from_hex(const StringView& str, TrimWhitespace); -template Optional convert_to_uint_from_hex(const StringView& str, TrimWhitespace); +template Optional convert_to_uint_from_hex(StringView str, TrimWhitespace); +template Optional convert_to_uint_from_hex(StringView str, TrimWhitespace); +template Optional convert_to_uint_from_hex(StringView str, TrimWhitespace); +template Optional convert_to_uint_from_hex(StringView str, TrimWhitespace); -bool equals_ignoring_case(const StringView& a, const StringView& b) +bool equals_ignoring_case(StringView a, StringView b) { if (a.length() != b.length()) return false; @@ -202,7 +202,7 @@ bool equals_ignoring_case(const StringView& a, const StringView& b) return true; } -bool ends_with(const StringView& str, const StringView& end, CaseSensitivity case_sensitivity) +bool ends_with(StringView str, StringView end, CaseSensitivity case_sensitivity) { if (end.is_empty()) return true; @@ -225,7 +225,7 @@ bool ends_with(const StringView& str, const StringView& end, CaseSensitivity cas return true; } -bool starts_with(const StringView& str, const StringView& start, CaseSensitivity case_sensitivity) +bool starts_with(StringView str, StringView start, CaseSensitivity case_sensitivity) { if (start.is_empty()) return true; @@ -250,7 +250,7 @@ bool starts_with(const StringView& str, const StringView& start, CaseSensitivity return true; } -bool contains(const StringView& str, const StringView& needle, CaseSensitivity case_sensitivity) +bool contains(StringView str, StringView needle, CaseSensitivity case_sensitivity) { if (str.is_null() || needle.is_null() || str.is_empty() || needle.length() > str.length()) return false; @@ -277,12 +277,12 @@ bool contains(const StringView& str, const StringView& needle, CaseSensitivity c return false; } -bool is_whitespace(const StringView& str) +bool is_whitespace(StringView str) { return all_of(str, is_ascii_space); } -StringView trim(const StringView& str, const StringView& characters, TrimMode mode) +StringView trim(StringView str, StringView characters, TrimMode mode) { size_t substring_start = 0; size_t substring_length = str.length(); @@ -311,12 +311,12 @@ StringView trim(const StringView& str, const StringView& characters, TrimMode mo return str.substring_view(substring_start, substring_length); } -StringView trim_whitespace(const StringView& str, TrimMode mode) +StringView trim_whitespace(StringView str, TrimMode mode) { return trim(str, " \n\t\v\f\r", mode); } -Optional find(StringView const& haystack, char needle, size_t start) +Optional find(StringView haystack, char needle, size_t start) { if (start >= haystack.length()) return {}; @@ -327,7 +327,7 @@ Optional find(StringView const& haystack, char needle, size_t start) return {}; } -Optional find(StringView const& haystack, StringView const& needle, size_t start) +Optional find(StringView haystack, StringView needle, size_t start) { if (start > haystack.length()) return {}; @@ -337,7 +337,7 @@ Optional find(StringView const& haystack, StringView const& needle, size return index.has_value() ? (*index + start) : index; } -Optional find_last(StringView const& haystack, char needle) +Optional find_last(StringView haystack, char needle) { for (size_t i = haystack.length(); i > 0; --i) { if (haystack[i - 1] == needle) @@ -346,7 +346,7 @@ Optional find_last(StringView const& haystack, char needle) return {}; } -Vector find_all(StringView const& haystack, StringView const& needle) +Vector find_all(StringView haystack, StringView needle) { Vector positions; size_t current_position = 0; @@ -362,7 +362,7 @@ Vector find_all(StringView const& haystack, StringView const& needle) return positions; } -Optional find_any_of(StringView const& haystack, StringView const& needles, SearchDirection direction) +Optional find_any_of(StringView haystack, StringView needles, SearchDirection direction) { if (haystack.is_empty() || needles.is_empty()) return {}; @@ -380,7 +380,7 @@ Optional find_any_of(StringView const& haystack, StringView const& needl return {}; } -String to_snakecase(const StringView& str) +String to_snakecase(StringView str) { auto should_insert_underscore = [&](auto i, auto current_char) { if (i == 0) @@ -406,7 +406,7 @@ String to_snakecase(const StringView& str) return builder.to_string(); } -String to_titlecase(StringView const& str) +String to_titlecase(StringView str) { StringBuilder builder; bool next_is_upper = true; @@ -422,7 +422,7 @@ String to_titlecase(StringView const& str) return builder.to_string(); } -String replace(StringView const& str, StringView const& needle, StringView const& replacement, bool all_occurrences) +String replace(StringView str, StringView needle, StringView replacement, bool all_occurrences) { if (str.is_empty()) return str; @@ -451,7 +451,7 @@ String replace(StringView const& str, StringView const& needle, StringView const } // TODO: Benchmark against KMP (AK/MemMem.h) and switch over if it's faster for short strings too -size_t count(StringView const& str, StringView const& needle) +size_t count(StringView str, StringView needle) { if (needle.is_empty()) return str.length(); diff --git a/AK/StringUtils.h b/AK/StringUtils.h index dabf4a1fefe..13794c4d0c9 100644 --- a/AK/StringUtils.h +++ b/AK/StringUtils.h @@ -43,36 +43,36 @@ struct MaskSpan { namespace StringUtils { -bool matches(const StringView& str, const StringView& mask, CaseSensitivity = CaseSensitivity::CaseInsensitive, Vector* match_spans = nullptr); +bool matches(StringView str, StringView mask, CaseSensitivity = CaseSensitivity::CaseInsensitive, Vector* match_spans = nullptr); template -Optional convert_to_int(const StringView&, TrimWhitespace = TrimWhitespace::Yes); +Optional convert_to_int(StringView, TrimWhitespace = TrimWhitespace::Yes); template -Optional convert_to_uint(const StringView&, TrimWhitespace = TrimWhitespace::Yes); +Optional convert_to_uint(StringView, TrimWhitespace = TrimWhitespace::Yes); template -Optional convert_to_uint_from_hex(const StringView&, TrimWhitespace = TrimWhitespace::Yes); -bool equals_ignoring_case(const StringView&, const StringView&); -bool ends_with(const StringView& a, const StringView& b, CaseSensitivity); -bool starts_with(const StringView&, const StringView&, CaseSensitivity); -bool contains(const StringView&, const StringView&, CaseSensitivity); -bool is_whitespace(const StringView&); -StringView trim(const StringView& string, const StringView& characters, TrimMode mode); -StringView trim_whitespace(const StringView& string, TrimMode mode); +Optional convert_to_uint_from_hex(StringView, TrimWhitespace = TrimWhitespace::Yes); +bool equals_ignoring_case(StringView, StringView); +bool ends_with(StringView a, StringView b, CaseSensitivity); +bool starts_with(StringView, StringView, CaseSensitivity); +bool contains(StringView, StringView, CaseSensitivity); +bool is_whitespace(StringView); +StringView trim(StringView string, StringView characters, TrimMode mode); +StringView trim_whitespace(StringView string, TrimMode mode); -Optional find(StringView const& haystack, char needle, size_t start = 0); -Optional find(StringView const& haystack, StringView const& needle, size_t start = 0); -Optional find_last(StringView const& haystack, char needle); -Vector find_all(StringView const& haystack, StringView const& needle); +Optional find(StringView haystack, char needle, size_t start = 0); +Optional find(StringView haystack, StringView needle, size_t start = 0); +Optional find_last(StringView haystack, char needle); +Vector find_all(StringView haystack, StringView needle); enum class SearchDirection { Forward, Backward }; -Optional find_any_of(StringView const& haystack, StringView const& needles, SearchDirection); +Optional find_any_of(StringView haystack, StringView needles, SearchDirection); -String to_snakecase(const StringView&); -String to_titlecase(StringView const&); +String to_snakecase(StringView); +String to_titlecase(StringView); -String replace(StringView const&, StringView const& needle, StringView const& replacement, bool all_occurrences = false); -size_t count(StringView const&, StringView const& needle); +String replace(StringView, StringView needle, StringView replacement, bool all_occurrences = false); +size_t count(StringView, StringView needle); } diff --git a/AK/StringView.cpp b/AK/StringView.cpp index 3bd40ac06be..79273bc5c70 100644 --- a/AK/StringView.cpp +++ b/AK/StringView.cpp @@ -56,7 +56,7 @@ Vector StringView::split_view(const char separator, bool keep_empty) return v; } -Vector StringView::split_view(const StringView& separator, bool keep_empty) const +Vector StringView::split_view(StringView separator, bool keep_empty) const { VERIFY(!separator.is_empty()); @@ -129,7 +129,7 @@ bool StringView::starts_with(char ch) const return ch == characters_without_null_termination()[0]; } -bool StringView::starts_with(const StringView& str, CaseSensitivity case_sensitivity) const +bool StringView::starts_with(StringView str, CaseSensitivity case_sensitivity) const { return StringUtils::starts_with(*this, str, case_sensitivity); } @@ -141,17 +141,17 @@ bool StringView::ends_with(char ch) const return ch == characters_without_null_termination()[length() - 1]; } -bool StringView::ends_with(const StringView& str, CaseSensitivity case_sensitivity) const +bool StringView::ends_with(StringView str, CaseSensitivity case_sensitivity) const { return StringUtils::ends_with(*this, str, case_sensitivity); } -bool StringView::matches(const StringView& mask, Vector& mask_spans, CaseSensitivity case_sensitivity) const +bool StringView::matches(StringView mask, Vector& mask_spans, CaseSensitivity case_sensitivity) const { return StringUtils::matches(*this, mask, case_sensitivity, &mask_spans); } -bool StringView::matches(const StringView& mask, CaseSensitivity case_sensitivity) const +bool StringView::matches(StringView mask, CaseSensitivity case_sensitivity) const { return StringUtils::matches(*this, mask, case_sensitivity); } @@ -165,12 +165,12 @@ bool StringView::contains(char needle) const return false; } -bool StringView::contains(const StringView& needle, CaseSensitivity case_sensitivity) const +bool StringView::contains(StringView needle, CaseSensitivity case_sensitivity) const { return StringUtils::contains(*this, needle, case_sensitivity); } -bool StringView::equals_ignoring_case(const StringView& other) const +bool StringView::equals_ignoring_case(StringView other) const { return StringUtils::equals_ignoring_case(*this, other); } @@ -190,7 +190,7 @@ String StringView::to_titlecase_string() const return StringUtils::to_titlecase(*this); } -StringView StringView::substring_view_starting_from_substring(const StringView& substring) const +StringView StringView::substring_view_starting_from_substring(StringView substring) const { const char* remaining_characters = substring.characters_without_null_termination(); VERIFY(remaining_characters >= m_characters); @@ -199,7 +199,7 @@ StringView StringView::substring_view_starting_from_substring(const StringView& return { remaining_characters, remaining_length }; } -StringView StringView::substring_view_starting_after_substring(const StringView& substring) const +StringView StringView::substring_view_starting_after_substring(StringView substring) const { const char* remaining_characters = substring.characters_without_null_termination() + substring.length(); VERIFY(remaining_characters >= m_characters); @@ -249,7 +249,7 @@ bool StringView::operator==(const String& string) const String StringView::to_string() const { return String { *this }; } -String StringView::replace(const StringView& needle, const StringView& replacement, bool all_occurrences) const +String StringView::replace(StringView needle, StringView replacement, bool all_occurrences) const { return StringUtils::replace(*this, needle, replacement, all_occurrences); } diff --git a/AK/StringView.h b/AK/StringView.h index 0ba49a5d545..7a8fdd6edef 100644 --- a/AK/StringView.h +++ b/AK/StringView.h @@ -74,17 +74,17 @@ public: return string_hash(characters_without_null_termination(), length()); } - [[nodiscard]] bool starts_with(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const; - [[nodiscard]] bool ends_with(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const; + [[nodiscard]] bool starts_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; + [[nodiscard]] bool ends_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; [[nodiscard]] bool starts_with(char) const; [[nodiscard]] bool ends_with(char) const; - [[nodiscard]] bool matches(const StringView& mask, CaseSensitivity = CaseSensitivity::CaseInsensitive) const; - [[nodiscard]] bool matches(const StringView& mask, Vector&, CaseSensitivity = CaseSensitivity::CaseInsensitive) const; + [[nodiscard]] bool matches(StringView mask, CaseSensitivity = CaseSensitivity::CaseInsensitive) const; + [[nodiscard]] bool matches(StringView mask, Vector&, CaseSensitivity = CaseSensitivity::CaseInsensitive) const; [[nodiscard]] bool contains(char) const; - [[nodiscard]] bool contains(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive) const; - [[nodiscard]] bool equals_ignoring_case(const StringView& other) const; + [[nodiscard]] bool contains(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; + [[nodiscard]] bool equals_ignoring_case(StringView other) const; - [[nodiscard]] StringView trim(const StringView& characters, TrimMode mode = TrimMode::Both) const { return StringUtils::trim(*this, characters, mode); } + [[nodiscard]] StringView trim(StringView characters, TrimMode mode = TrimMode::Both) const { return StringUtils::trim(*this, characters, mode); } [[nodiscard]] StringView trim_whitespace(TrimMode mode = TrimMode::Both) const { return StringUtils::trim_whitespace(*this, mode); } [[nodiscard]] String to_lowercase_string() const; @@ -92,14 +92,14 @@ public: [[nodiscard]] String to_titlecase_string() const; [[nodiscard]] Optional find(char needle, size_t start = 0) const { return StringUtils::find(*this, needle, start); } - [[nodiscard]] Optional find(StringView const& needle, size_t start = 0) const { return StringUtils::find(*this, needle, start); } + [[nodiscard]] Optional find(StringView needle, size_t start = 0) const { return StringUtils::find(*this, needle, start); } [[nodiscard]] Optional find_last(char needle) const { return StringUtils::find_last(*this, needle); } - // FIXME: Implement find_last(StringView const&) for API symmetry. + // FIXME: Implement find_last(StringView) for API symmetry. [[nodiscard]] Vector find_all(StringView needle) const; using SearchDirection = StringUtils::SearchDirection; - [[nodiscard]] Optional find_any_of(StringView const& needles, SearchDirection direction = SearchDirection::Forward) { return StringUtils::find_any_of(*this, needles, direction); } + [[nodiscard]] Optional find_any_of(StringView needles, SearchDirection direction = SearchDirection::Forward) { return StringUtils::find_any_of(*this, needles, direction); } [[nodiscard]] constexpr StringView substring_view(size_t start, size_t length) const { @@ -114,7 +114,7 @@ public: } [[nodiscard]] Vector split_view(char, bool keep_empty = false) const; - [[nodiscard]] Vector split_view(const StringView&, bool keep_empty = false) const; + [[nodiscard]] Vector split_view(StringView, bool keep_empty = false) const; [[nodiscard]] Vector split_view_if(Function const& predicate, bool keep_empty = false) const; @@ -145,8 +145,8 @@ public: // StringView substr { "oo" }; // // would not work. - [[nodiscard]] StringView substring_view_starting_from_substring(const StringView& substring) const; - [[nodiscard]] StringView substring_view_starting_after_substring(const StringView& substring) const; + [[nodiscard]] StringView substring_view_starting_from_substring(StringView substring) const; + [[nodiscard]] StringView substring_view_starting_after_substring(StringView substring) const; constexpr bool operator==(const char* cstring) const { @@ -172,7 +172,7 @@ public: bool operator==(const String&) const; - constexpr bool operator==(const StringView& other) const + constexpr bool operator==(StringView other) const { if (is_null()) return other.is_null(); @@ -183,12 +183,12 @@ public: return !__builtin_memcmp(m_characters, other.m_characters, m_length); } - constexpr bool operator!=(const StringView& other) const + constexpr bool operator!=(StringView other) const { return !(*this == other); } - bool operator<(const StringView& other) const + bool operator<(StringView other) const { if (int c = __builtin_memcmp(m_characters, other.m_characters, min(m_length, other.m_length))) return c < 0; @@ -199,8 +199,8 @@ public: [[nodiscard]] bool is_whitespace() const { return StringUtils::is_whitespace(*this); } - [[nodiscard]] String replace(const StringView& needle, const StringView& replacement, bool all_occurrences = false) const; - [[nodiscard]] size_t count(StringView const& needle) const { return StringUtils::count(*this, needle); } + [[nodiscard]] String replace(StringView needle, StringView replacement, bool all_occurrences = false) const; + [[nodiscard]] size_t count(StringView needle) const { return StringUtils::count(*this, needle); } template [[nodiscard]] ALWAYS_INLINE constexpr bool is_one_of(Ts&&... strings) const @@ -216,7 +216,7 @@ private: template<> struct Traits : public GenericTraits { - static unsigned hash(const StringView& s) { return s.hash(); } + static unsigned hash(StringView s) { return s.hash(); } }; } diff --git a/AK/URL.cpp b/AK/URL.cpp index 494ea18bebd..dfc68bbd7eb 100644 --- a/AK/URL.cpp +++ b/AK/URL.cpp @@ -16,7 +16,7 @@ namespace AK { // FIXME: It could make sense to force users of URL to use URLParser::parse() explicitly instead of using a constructor. -URL::URL(StringView const& string) +URL::URL(StringView string) : URL(URLParser::parse(string)) { if constexpr (URL_PARSER_DEBUG) { @@ -135,12 +135,12 @@ bool URL::compute_validity() const return true; } -bool URL::scheme_requires_port(StringView const& scheme) +bool URL::scheme_requires_port(StringView scheme) { return (default_port_for_scheme(scheme) != 0); } -u16 URL::default_port_for_scheme(StringView const& scheme) +u16 URL::default_port_for_scheme(StringView scheme) { if (scheme == "http") return 80; @@ -189,7 +189,7 @@ URL URL::create_with_url_or_path(String const& url_or_path) } // https://url.spec.whatwg.org/#special-scheme -bool URL::is_special_scheme(StringView const& scheme) +bool URL::is_special_scheme(StringView scheme) { return scheme.is_one_of("ftp", "file", "http", "https", "ws", "wss"); } @@ -403,7 +403,7 @@ void URL::append_percent_encoded_if_necessary(StringBuilder& builder, u32 code_p builder.append_code_point(code_point); } -String URL::percent_encode(StringView const& input, URL::PercentEncodeSet set) +String URL::percent_encode(StringView input, URL::PercentEncodeSet set) { StringBuilder builder; for (auto code_point : Utf8View(input)) { @@ -412,7 +412,7 @@ String URL::percent_encode(StringView const& input, URL::PercentEncodeSet set) return builder.to_string(); } -String URL::percent_decode(StringView const& input) +String URL::percent_decode(StringView input) { if (!input.contains('%')) return input; diff --git a/AK/URL.h b/AK/URL.h index 7e8d9ac9b28..031be5b0402 100644 --- a/AK/URL.h +++ b/AK/URL.h @@ -37,7 +37,7 @@ public: }; URL() = default; - URL(StringView const&); + URL(StringView); URL(char const* string) : URL(StringView(string)) { @@ -100,12 +100,12 @@ public: static URL create_with_file_protocol(String const& path, String const& fragment = {}) { return create_with_file_scheme(path, fragment); } static URL create_with_data(String mime_type, String payload, bool is_base64 = false) { return URL(move(mime_type), move(payload), is_base64); }; - static bool scheme_requires_port(StringView const&); - static u16 default_port_for_scheme(StringView const&); - static bool is_special_scheme(StringView const&); + static bool scheme_requires_port(StringView); + static u16 default_port_for_scheme(StringView); + static bool is_special_scheme(StringView); - static String percent_encode(StringView const& input, PercentEncodeSet set = PercentEncodeSet::Userinfo); - static String percent_decode(StringView const& input); + static String percent_encode(StringView input, PercentEncodeSet set = PercentEncodeSet::Userinfo); + static String percent_decode(StringView input); bool operator==(URL const& other) const { return equals(other, ExcludeFragment::No); } diff --git a/AK/URLParser.cpp b/AK/URLParser.cpp index 63cf3c449e4..d508aa96dc7 100644 --- a/AK/URLParser.cpp +++ b/AK/URLParser.cpp @@ -30,7 +30,7 @@ static void report_validation_error(SourceLocation const& location = SourceLocat dbgln_if(URL_PARSER_DEBUG, "URLParser::parse: Validation error! {}", location); } -static Optional parse_opaque_host(StringView const& input) +static Optional parse_opaque_host(StringView input) { auto forbidden_host_code_points_excluding_percent = "\0\t\n\r #/:<>?@[\\]^|"sv; for (auto code_point : forbidden_host_code_points_excluding_percent) { @@ -44,7 +44,7 @@ static Optional parse_opaque_host(StringView const& input) return URL::percent_encode(input, URL::PercentEncodeSet::C0Control); } -static Optional parse_ipv4_address(StringView const& input) +static Optional parse_ipv4_address(StringView input) { // FIXME: Implement the correct IPv4 parser as specified by https://url.spec.whatwg.org/#concept-ipv4-parser. return input; @@ -52,7 +52,7 @@ static Optional parse_ipv4_address(StringView const& input) // https://url.spec.whatwg.org/#concept-host-parser // NOTE: This is a very bare-bones implementation. -static Optional parse_host(StringView const& input, bool is_not_special = false) +static Optional parse_host(StringView input, bool is_not_special = false) { if (input.starts_with('[')) { if (!input.ends_with(']')) { @@ -84,7 +84,7 @@ static Optional parse_host(StringView const& input, bool is_not_special return ipv4_host; } -constexpr bool starts_with_windows_drive_letter(StringView const& input) +constexpr bool starts_with_windows_drive_letter(StringView input) { if (input.length() < 2) return false; @@ -95,29 +95,29 @@ constexpr bool starts_with_windows_drive_letter(StringView const& input) return "/\\?#"sv.contains(input[2]); } -constexpr bool is_windows_drive_letter(StringView const& input) +constexpr bool is_windows_drive_letter(StringView input) { return input.length() == 2 && is_ascii_alpha(input[0]) && (input[1] == ':' || input[1] == '|'); } -constexpr bool is_normalized_windows_drive_letter(StringView const& input) +constexpr bool is_normalized_windows_drive_letter(StringView input) { return input.length() == 2 && is_ascii_alpha(input[0]) && input[1] == ':'; } -constexpr bool is_single_dot_path_segment(StringView const& input) +constexpr bool is_single_dot_path_segment(StringView input) { return input == "."sv || input.equals_ignoring_case("%2e"sv); } -constexpr bool is_double_dot_path_segment(StringView const& input) +constexpr bool is_double_dot_path_segment(StringView input) { return input == ".."sv || input.equals_ignoring_case(".%2e"sv) || input.equals_ignoring_case("%2e."sv) || input.equals_ignoring_case("%2e%2e"sv); } // https://fetch.spec.whatwg.org/#data-urls // FIXME: This only loosely follows the spec, as we use the same class for "regular" and data URLs, unlike the spec. -Optional URLParser::parse_data_url(StringView const& raw_input) +Optional URLParser::parse_data_url(StringView raw_input) { dbgln_if(URL_PARSER_DEBUG, "URLParser::parse_data_url: Parsing '{}'.", raw_input); VERIFY(raw_input.starts_with("data:")); @@ -161,7 +161,7 @@ Optional URLParser::parse_data_url(StringView const& raw_input) // NOTE: Since the URL class's member variables contain percent decoded data, we have to deviate from the URL parser specification when setting // some of those values. Because the specification leaves all values percent encoded in their URL data structure, we have to percent decode // everything before setting the member variables. -URL URLParser::parse(StringView const& raw_input, URL const* base_url, Optional url, Optional state_override) +URL URLParser::parse(StringView raw_input, URL const* base_url, Optional url, Optional state_override) { dbgln_if(URL_PARSER_DEBUG, "URLParser::parse: Parsing '{}'", raw_input); if (raw_input.is_empty()) diff --git a/AK/URLParser.h b/AK/URLParser.h index ea296c07c12..99e9dc0805c 100644 --- a/AK/URLParser.h +++ b/AK/URLParser.h @@ -55,10 +55,10 @@ public: VERIFY_NOT_REACHED(); } - static URL parse(StringView const& input, URL const* base_url = nullptr, Optional url = {}, Optional state_override = {}); + static URL parse(StringView input, URL const* base_url = nullptr, Optional url = {}, Optional state_override = {}); private: - static Optional parse_data_url(StringView const& raw_input); + static Optional parse_data_url(StringView raw_input); }; #undef ENUMERATE_STATES diff --git a/AK/UUID.cpp b/AK/UUID.cpp index cc87d7adca3..835da053b42 100644 --- a/AK/UUID.cpp +++ b/AK/UUID.cpp @@ -16,7 +16,7 @@ UUID::UUID(Array uuid_buffer) uuid_buffer.span().copy_to(m_uuid_buffer); } -void UUID::convert_string_view_to_uuid(const StringView& uuid_string_view) +void UUID::convert_string_view_to_uuid(StringView uuid_string_view) { VERIFY(uuid_string_view.length() == 36); auto first_unit = decode_hex(uuid_string_view.substring_view(0, 8)); @@ -36,7 +36,7 @@ void UUID::convert_string_view_to_uuid(const StringView& uuid_string_view) m_uuid_buffer.span().overwrite(10, fifth_unit.value().data(), fifth_unit.value().size()); } -UUID::UUID(const StringView& uuid_string_view) +UUID::UUID(StringView uuid_string_view) { convert_string_view_to_uuid(uuid_string_view); } diff --git a/AK/UUID.h b/AK/UUID.h index fba7da8bdd5..3d694143461 100644 --- a/AK/UUID.h +++ b/AK/UUID.h @@ -17,7 +17,7 @@ class UUID { public: UUID() = default; UUID(Array uuid_buffer); - UUID(const StringView&); + UUID(StringView); ~UUID() = default; bool operator==(const UUID&) const; @@ -31,7 +31,7 @@ public: bool is_zero() const; private: - void convert_string_view_to_uuid(const StringView&); + void convert_string_view_to_uuid(StringView); Array m_uuid_buffer {}; }; diff --git a/AK/Utf16View.cpp b/AK/Utf16View.cpp index 09cd06cf162..3e29368a017 100644 --- a/AK/Utf16View.cpp +++ b/AK/Utf16View.cpp @@ -32,7 +32,7 @@ static Vector to_utf16_impl(UtfViewType const& view) requires(IsSame utf8_to_utf16(StringView const& utf8_view) +Vector utf8_to_utf16(StringView utf8_view) { return to_utf16_impl(Utf8View { utf8_view }); } diff --git a/AK/Utf16View.h b/AK/Utf16View.h index 348ef085e80..5b6fc24e062 100644 --- a/AK/Utf16View.h +++ b/AK/Utf16View.h @@ -16,7 +16,7 @@ namespace AK { -Vector utf8_to_utf16(StringView const&); +Vector utf8_to_utf16(StringView); Vector utf8_to_utf16(Utf8View const&); Vector utf32_to_utf16(Utf32View const&); void code_point_to_utf16(Vector&, u32); diff --git a/AK/Utf8View.h b/AK/Utf8View.h index 18b5a3df4b6..60496deb9a6 100644 --- a/AK/Utf8View.h +++ b/AK/Utf8View.h @@ -74,7 +74,7 @@ public: explicit Utf8View(String&&) = delete; - const StringView& as_string() const { return m_string; } + StringView as_string() const { return m_string; } Utf8CodePointIterator begin() const { return { begin_ptr(), m_string.length() }; } Utf8CodePointIterator end() const { return { end_ptr(), 0 }; } diff --git a/Kernel/CommandLine.cpp b/Kernel/CommandLine.cpp index a586a06657e..6f8b88e74bf 100644 --- a/Kernel/CommandLine.cpp +++ b/Kernel/CommandLine.cpp @@ -86,12 +86,12 @@ UNMAP_AFTER_INIT CommandLine::CommandLine(const String& cmdline_from_bootloader) add_arguments(args); } -Optional CommandLine::lookup(const StringView& key) const +Optional CommandLine::lookup(StringView key) const { return m_params.get(key); } -bool CommandLine::contains(const StringView& key) const +bool CommandLine::contains(StringView key) const { return m_params.contains(key); } diff --git a/Kernel/CommandLine.h b/Kernel/CommandLine.h index 9b3f358760f..6006958feee 100644 --- a/Kernel/CommandLine.h +++ b/Kernel/CommandLine.h @@ -54,8 +54,8 @@ public: }; [[nodiscard]] const String& string() const { return m_string; } - Optional lookup(const StringView& key) const; - [[nodiscard]] bool contains(const StringView& key) const; + Optional lookup(StringView key) const; + [[nodiscard]] bool contains(StringView key) const; [[nodiscard]] bool is_boot_profiling_enabled() const; [[nodiscard]] bool is_ide_enabled() const; diff --git a/Kernel/FileSystem/DevPtsFS.cpp b/Kernel/FileSystem/DevPtsFS.cpp index 422430d126b..ae23695d313 100644 --- a/Kernel/FileSystem/DevPtsFS.cpp +++ b/Kernel/FileSystem/DevPtsFS.cpp @@ -149,7 +149,7 @@ ErrorOr DevPtsFSInode::flush_metadata() return {}; } -ErrorOr DevPtsFSInode::add_child(Inode&, const StringView&, mode_t) +ErrorOr DevPtsFSInode::add_child(Inode&, StringView, mode_t) { return EROFS; } @@ -159,7 +159,7 @@ ErrorOr> DevPtsFSInode::create_child(StringView, mode_t, de return EROFS; } -ErrorOr DevPtsFSInode::remove_child(const StringView&) +ErrorOr DevPtsFSInode::remove_child(StringView) { return EROFS; } diff --git a/Kernel/FileSystem/DevPtsFS.h b/Kernel/FileSystem/DevPtsFS.h index 65a6e92c1f5..94b94e1b4f4 100644 --- a/Kernel/FileSystem/DevPtsFS.h +++ b/Kernel/FileSystem/DevPtsFS.h @@ -54,8 +54,8 @@ private: virtual ErrorOr flush_metadata() override; virtual ErrorOr write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, OpenFileDescription*) override; virtual ErrorOr> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override; - virtual ErrorOr add_child(Inode&, const StringView& name, mode_t) override; - virtual ErrorOr remove_child(const StringView& name) override; + virtual ErrorOr add_child(Inode&, StringView name, mode_t) override; + virtual ErrorOr remove_child(StringView name) override; virtual ErrorOr chmod(mode_t) override; virtual ErrorOr chown(UserID, GroupID) override; diff --git a/Kernel/FileSystem/DevTmpFS.cpp b/Kernel/FileSystem/DevTmpFS.cpp index 2ce31042fbb..26cb558b2d0 100644 --- a/Kernel/FileSystem/DevTmpFS.cpp +++ b/Kernel/FileSystem/DevTmpFS.cpp @@ -85,7 +85,7 @@ ErrorOr> DevTmpFSInode::create_child(StringView, mode_t, de VERIFY_NOT_REACHED(); } -ErrorOr DevTmpFSInode::add_child(Inode&, const StringView&, mode_t) +ErrorOr DevTmpFSInode::add_child(Inode&, StringView, mode_t) { VERIFY_NOT_REACHED(); } @@ -134,7 +134,7 @@ InodeMetadata DevTmpFSInode::metadata() const return metadata; } -ErrorOr DevTmpFSInode::remove_child(const StringView&) +ErrorOr DevTmpFSInode::remove_child(StringView) { VERIFY_NOT_REACHED(); } @@ -233,7 +233,7 @@ ErrorOr> DevTmpFSDirectoryInode::lookup(StringView name) return Error::from_errno(ENOENT); } -ErrorOr DevTmpFSDirectoryInode::remove_child(const StringView& name) +ErrorOr DevTmpFSDirectoryInode::remove_child(StringView name) { MutexLocker locker(m_inode_lock); for (auto& node : m_nodes) { diff --git a/Kernel/FileSystem/DevTmpFS.h b/Kernel/FileSystem/DevTmpFS.h index 837ecb25df4..92e4cfa3a68 100644 --- a/Kernel/FileSystem/DevTmpFS.h +++ b/Kernel/FileSystem/DevTmpFS.h @@ -55,8 +55,8 @@ protected: virtual InodeMetadata metadata() const override final; virtual ErrorOr write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, OpenFileDescription*) override; virtual ErrorOr> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override; - virtual ErrorOr add_child(Inode&, const StringView& name, mode_t) override; - virtual ErrorOr remove_child(const StringView& name) override; + virtual ErrorOr add_child(Inode&, StringView name, mode_t) override; + virtual ErrorOr remove_child(StringView name) override; virtual ErrorOr chmod(mode_t) override; virtual ErrorOr chown(UserID, GroupID) override; virtual ErrorOr truncate(u64) override; @@ -137,7 +137,7 @@ protected: virtual Type node_type() const override { return Type::Directory; } virtual ErrorOr> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override; - virtual ErrorOr remove_child(const StringView& name) override; + virtual ErrorOr remove_child(StringView name) override; virtual ErrorOr traverse_as_directory(Function(FileSystem::DirectoryEntryView const&)>) const override; virtual ErrorOr> lookup(StringView name) override; DevTmpFSDirectoryInode(DevTmpFS&, NonnullOwnPtr name); diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp index ae3be58d914..29505ac1541 100644 --- a/Kernel/FileSystem/Ext2FileSystem.cpp +++ b/Kernel/FileSystem/Ext2FileSystem.cpp @@ -1159,7 +1159,7 @@ ErrorOr> Ext2FSInode::create_child(StringView name, mode_t return fs().create_inode(*this, name, mode, dev, uid, gid); } -ErrorOr Ext2FSInode::add_child(Inode& child, const StringView& name, mode_t mode) +ErrorOr Ext2FSInode::add_child(Inode& child, StringView name, mode_t mode) { MutexLocker locker(m_inode_lock); VERIFY(is_directory()); @@ -1189,7 +1189,7 @@ ErrorOr Ext2FSInode::add_child(Inode& child, const StringView& name, mode_ return {}; } -ErrorOr Ext2FSInode::remove_child(const StringView& name) +ErrorOr Ext2FSInode::remove_child(StringView name) { MutexLocker locker(m_inode_lock); dbgln_if(EXT2_DEBUG, "Ext2FSInode[{}]::remove_child(): Removing '{}'", identifier(), name); diff --git a/Kernel/FileSystem/Ext2FileSystem.h b/Kernel/FileSystem/Ext2FileSystem.h index be28f5aaa8e..59c8fdbd0c4 100644 --- a/Kernel/FileSystem/Ext2FileSystem.h +++ b/Kernel/FileSystem/Ext2FileSystem.h @@ -45,8 +45,8 @@ private: virtual ErrorOr flush_metadata() override; virtual ErrorOr write_bytes(off_t, size_t, const UserOrKernelBuffer& data, OpenFileDescription*) override; virtual ErrorOr> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override; - virtual ErrorOr add_child(Inode& child, const StringView& name, mode_t) override; - virtual ErrorOr remove_child(const StringView& name) override; + virtual ErrorOr add_child(Inode& child, StringView name, mode_t) override; + virtual ErrorOr remove_child(StringView name) override; virtual ErrorOr set_atime(time_t) override; virtual ErrorOr set_ctime(time_t) override; virtual ErrorOr set_mtime(time_t) override; diff --git a/Kernel/FileSystem/FileSystem.cpp b/Kernel/FileSystem/FileSystem.cpp index b98840fd0a8..10eb4f50f4e 100644 --- a/Kernel/FileSystem/FileSystem.cpp +++ b/Kernel/FileSystem/FileSystem.cpp @@ -42,7 +42,7 @@ FileSystem* FileSystem::from_fsid(u32 id) return nullptr; } -FileSystem::DirectoryEntryView::DirectoryEntryView(const StringView& n, InodeIdentifier i, u8 ft) +FileSystem::DirectoryEntryView::DirectoryEntryView(StringView n, InodeIdentifier i, u8 ft) : name(n) , inode(i) , file_type(ft) diff --git a/Kernel/FileSystem/FileSystem.h b/Kernel/FileSystem/FileSystem.h index 9222d8e6aae..6cc2b503300 100644 --- a/Kernel/FileSystem/FileSystem.h +++ b/Kernel/FileSystem/FileSystem.h @@ -46,7 +46,7 @@ public: virtual ErrorOr prepare_to_unmount() { return {}; } struct DirectoryEntryView { - DirectoryEntryView(const StringView& name, InodeIdentifier, u8 file_type); + DirectoryEntryView(StringView name, InodeIdentifier, u8 file_type); StringView name; InodeIdentifier inode; diff --git a/Kernel/FileSystem/ISO9660FileSystem.cpp b/Kernel/FileSystem/ISO9660FileSystem.cpp index aec85af9225..2dbfe034cd3 100644 --- a/Kernel/FileSystem/ISO9660FileSystem.cpp +++ b/Kernel/FileSystem/ISO9660FileSystem.cpp @@ -512,12 +512,12 @@ ErrorOr> ISO9660Inode::create_child(StringView, mode_t, dev return EROFS; } -ErrorOr ISO9660Inode::add_child(Inode&, const StringView&, mode_t) +ErrorOr ISO9660Inode::add_child(Inode&, StringView, mode_t) { return EROFS; } -ErrorOr ISO9660Inode::remove_child(const StringView&) +ErrorOr ISO9660Inode::remove_child(StringView) { return EROFS; } @@ -556,7 +556,7 @@ void ISO9660Inode::one_ref_left() { } -ISO9660Inode::ISO9660Inode(ISO9660FS& fs, ISO::DirectoryRecordHeader const& record, StringView const& name) +ISO9660Inode::ISO9660Inode(ISO9660FS& fs, ISO::DirectoryRecordHeader const& record, StringView name) : Inode(fs, get_inode_index(record, name)) , m_record(record) { @@ -568,7 +568,7 @@ ISO9660Inode::~ISO9660Inode() { } -ErrorOr> ISO9660Inode::try_create_from_directory_record(ISO9660FS& fs, ISO::DirectoryRecordHeader const& record, StringView const& name) +ErrorOr> ISO9660Inode::try_create_from_directory_record(ISO9660FS& fs, ISO::DirectoryRecordHeader const& record, StringView name) { return adopt_nonnull_ref_or_enomem(new (nothrow) ISO9660Inode(fs, record, name)); } @@ -651,7 +651,7 @@ StringView ISO9660Inode::get_normalized_filename(ISO::DirectoryRecordHeader cons return { buffer.data(), filename.length() }; } -InodeIndex ISO9660Inode::get_inode_index(ISO::DirectoryRecordHeader const& record, StringView const& name) +InodeIndex ISO9660Inode::get_inode_index(ISO::DirectoryRecordHeader const& record, StringView name) { if (name.is_null()) { // NOTE: This is the index of the root inode. diff --git a/Kernel/FileSystem/ISO9660FileSystem.h b/Kernel/FileSystem/ISO9660FileSystem.h index 70b17b0e2d0..68d8f291d1b 100644 --- a/Kernel/FileSystem/ISO9660FileSystem.h +++ b/Kernel/FileSystem/ISO9660FileSystem.h @@ -354,8 +354,8 @@ public: virtual ErrorOr flush_metadata() override; virtual ErrorOr write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, OpenFileDescription*) override; virtual ErrorOr> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override; - virtual ErrorOr add_child(Inode&, const StringView& name, mode_t) override; - virtual ErrorOr remove_child(const StringView& name) override; + virtual ErrorOr add_child(Inode&, StringView name, mode_t) override; + virtual ErrorOr remove_child(StringView name) override; virtual ErrorOr chmod(mode_t) override; virtual ErrorOr chown(UserID, GroupID) override; virtual ErrorOr truncate(u64) override; @@ -370,10 +370,10 @@ private: // without any problems, so let's allow it anyway. static constexpr size_t max_file_identifier_length = 256 - sizeof(ISO::DirectoryRecordHeader); - ISO9660Inode(ISO9660FS&, ISO::DirectoryRecordHeader const& record, StringView const& name); - static ErrorOr> try_create_from_directory_record(ISO9660FS&, ISO::DirectoryRecordHeader const& record, StringView const& name); + ISO9660Inode(ISO9660FS&, ISO::DirectoryRecordHeader const& record, StringView name); + static ErrorOr> try_create_from_directory_record(ISO9660FS&, ISO::DirectoryRecordHeader const& record, StringView name); - static InodeIndex get_inode_index(ISO::DirectoryRecordHeader const& record, StringView const& name); + static InodeIndex get_inode_index(ISO::DirectoryRecordHeader const& record, StringView name); static StringView get_normalized_filename(ISO::DirectoryRecordHeader const& record, Bytes buffer); void create_metadata(); diff --git a/Kernel/FileSystem/Inode.h b/Kernel/FileSystem/Inode.h index 68ca3ce8245..6ae9f03b115 100644 --- a/Kernel/FileSystem/Inode.h +++ b/Kernel/FileSystem/Inode.h @@ -57,8 +57,8 @@ public: virtual ErrorOr> lookup(StringView name) = 0; virtual ErrorOr write_bytes(off_t, size_t, const UserOrKernelBuffer& data, OpenFileDescription*) = 0; virtual ErrorOr> create_child(StringView name, mode_t, dev_t, UserID, GroupID) = 0; - virtual ErrorOr add_child(Inode&, const StringView& name, mode_t) = 0; - virtual ErrorOr remove_child(const StringView& name) = 0; + virtual ErrorOr add_child(Inode&, StringView name, mode_t) = 0; + virtual ErrorOr remove_child(StringView name) = 0; virtual ErrorOr chmod(mode_t) = 0; virtual ErrorOr chown(UserID, GroupID) = 0; virtual ErrorOr truncate(u64) { return {}; } diff --git a/Kernel/FileSystem/Plan9FileSystem.cpp b/Kernel/FileSystem/Plan9FileSystem.cpp index c543ada1875..38344986167 100644 --- a/Kernel/FileSystem/Plan9FileSystem.cpp +++ b/Kernel/FileSystem/Plan9FileSystem.cpp @@ -112,7 +112,7 @@ public: class Decoder { public: - explicit Decoder(const StringView& data) + explicit Decoder(StringView data) : m_data(data) { } @@ -144,8 +144,8 @@ public: Message& operator<<(u16); Message& operator<<(u32); Message& operator<<(u64); - Message& operator<<(const StringView&); - void append_data(const StringView&); + Message& operator<<(StringView); + void append_data(StringView); template Message& operator>>(T& t) @@ -228,7 +228,7 @@ ErrorOr Plan9FS::initialize() return {}; } -Plan9FS::ProtocolVersion Plan9FS::parse_protocol_version(const StringView& s) const +Plan9FS::ProtocolVersion Plan9FS::parse_protocol_version(StringView s) const { if (s == "9P2000.L") return ProtocolVersion::v9P2000L; @@ -262,7 +262,7 @@ Plan9FS::Message& Plan9FS::Message::operator<<(u64 number) return append_number(number); } -Plan9FS::Message& Plan9FS::Message::operator<<(const StringView& string) +Plan9FS::Message& Plan9FS::Message::operator<<(StringView string) { *this << static_cast(string.length()); // FIXME: Handle append failure. @@ -270,7 +270,7 @@ Plan9FS::Message& Plan9FS::Message::operator<<(const StringView& string) return *this; } -void Plan9FS::Message::append_data(const StringView& data) +void Plan9FS::Message::append_data(StringView data) { *this << static_cast(data.length()); // FIXME: Handle append failure. @@ -908,13 +908,13 @@ ErrorOr> Plan9FSInode::create_child(StringView, mode_t, dev return ENOTIMPL; } -ErrorOr Plan9FSInode::add_child(Inode&, const StringView&, mode_t) +ErrorOr Plan9FSInode::add_child(Inode&, StringView, mode_t) { // TODO return ENOTIMPL; } -ErrorOr Plan9FSInode::remove_child(const StringView&) +ErrorOr Plan9FSInode::remove_child(StringView) { // TODO return ENOTIMPL; diff --git a/Kernel/FileSystem/Plan9FileSystem.h b/Kernel/FileSystem/Plan9FileSystem.h index 13c7b4fd3b7..df0cf3d9ca5 100644 --- a/Kernel/FileSystem/Plan9FileSystem.h +++ b/Kernel/FileSystem/Plan9FileSystem.h @@ -122,7 +122,7 @@ private: ErrorOr post_message_and_wait_for_a_reply(Message&); ErrorOr post_message_and_explicitly_ignore_reply(Message&); - ProtocolVersion parse_protocol_version(const StringView&) const; + ProtocolVersion parse_protocol_version(StringView) const; size_t adjust_buffer_size(size_t size) const; void thread_main(); @@ -161,8 +161,8 @@ public: virtual ErrorOr traverse_as_directory(Function(FileSystem::DirectoryEntryView const&)>) const override; virtual ErrorOr> lookup(StringView name) override; virtual ErrorOr> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override; - virtual ErrorOr add_child(Inode&, const StringView& name, mode_t) override; - virtual ErrorOr remove_child(const StringView& name) override; + virtual ErrorOr add_child(Inode&, StringView name, mode_t) override; + virtual ErrorOr remove_child(StringView name) override; virtual ErrorOr chmod(mode_t) override; virtual ErrorOr chown(UserID, GroupID) override; virtual ErrorOr truncate(u64) override; diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index bcd5e50371c..05ae501b72f 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -75,7 +75,7 @@ ErrorOr ProcFSInode::flush_metadata() return {}; } -ErrorOr ProcFSInode::add_child(Inode&, const StringView&, mode_t) +ErrorOr ProcFSInode::add_child(Inode&, StringView, mode_t) { return EROFS; } @@ -85,7 +85,7 @@ ErrorOr> ProcFSInode::create_child(StringView, mode_t, dev_ return EROFS; } -ErrorOr ProcFSInode::remove_child(const StringView&) +ErrorOr ProcFSInode::remove_child(StringView) { return EROFS; } diff --git a/Kernel/FileSystem/ProcFS.h b/Kernel/FileSystem/ProcFS.h index 6ed723cf8a0..de4ca65c7a0 100644 --- a/Kernel/FileSystem/ProcFS.h +++ b/Kernel/FileSystem/ProcFS.h @@ -58,8 +58,8 @@ protected: virtual void did_seek(OpenFileDescription&, off_t) = 0; virtual ErrorOr flush_metadata() override final; virtual ErrorOr> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override final; - virtual ErrorOr add_child(Inode&, const StringView& name, mode_t) override final; - virtual ErrorOr remove_child(const StringView& name) override final; + virtual ErrorOr add_child(Inode&, StringView name, mode_t) override final; + virtual ErrorOr remove_child(StringView name) override final; virtual ErrorOr chmod(mode_t) override final; virtual ErrorOr chown(UserID, GroupID) override final; }; diff --git a/Kernel/FileSystem/SysFS.cpp b/Kernel/FileSystem/SysFS.cpp index 3ae80d3a311..66457930cb2 100644 --- a/Kernel/FileSystem/SysFS.cpp +++ b/Kernel/FileSystem/SysFS.cpp @@ -163,12 +163,12 @@ ErrorOr> SysFSInode::create_child(StringView, mode_t, dev_t return EROFS; } -ErrorOr SysFSInode::add_child(Inode&, StringView const&, mode_t) +ErrorOr SysFSInode::add_child(Inode&, StringView, mode_t) { return EROFS; } -ErrorOr SysFSInode::remove_child(StringView const&) +ErrorOr SysFSInode::remove_child(StringView) { return EROFS; } diff --git a/Kernel/FileSystem/SysFS.h b/Kernel/FileSystem/SysFS.h index 2a021a48908..818c035267d 100644 --- a/Kernel/FileSystem/SysFS.h +++ b/Kernel/FileSystem/SysFS.h @@ -141,8 +141,8 @@ protected: virtual InodeMetadata metadata() const override; virtual ErrorOr write_bytes(off_t, size_t, UserOrKernelBuffer const&, OpenFileDescription*) override; virtual ErrorOr> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override; - virtual ErrorOr add_child(Inode&, StringView const& name, mode_t) override; - virtual ErrorOr remove_child(StringView const& name) override; + virtual ErrorOr add_child(Inode&, StringView name, mode_t) override; + virtual ErrorOr remove_child(StringView name) override; virtual ErrorOr chmod(mode_t) override; virtual ErrorOr chown(UserID, GroupID) override; virtual ErrorOr truncate(u64) override; diff --git a/Kernel/FileSystem/TmpFS.cpp b/Kernel/FileSystem/TmpFS.cpp index cdff254276e..587e9505e2a 100644 --- a/Kernel/FileSystem/TmpFS.cpp +++ b/Kernel/FileSystem/TmpFS.cpp @@ -269,7 +269,7 @@ ErrorOr> TmpFSInode::create_child(StringView name, mode_t m return child; } -ErrorOr TmpFSInode::add_child(Inode& child, StringView const& name, mode_t) +ErrorOr TmpFSInode::add_child(Inode& child, StringView name, mode_t) { VERIFY(is_directory()); VERIFY(child.fsid() == fsid()); @@ -289,7 +289,7 @@ ErrorOr TmpFSInode::add_child(Inode& child, StringView const& name, mode_t return {}; } -ErrorOr TmpFSInode::remove_child(StringView const& name) +ErrorOr TmpFSInode::remove_child(StringView name) { MutexLocker locker(m_inode_lock); VERIFY(is_directory()); diff --git a/Kernel/FileSystem/TmpFS.h b/Kernel/FileSystem/TmpFS.h index 43f83ef3a5c..eca20a43e34 100644 --- a/Kernel/FileSystem/TmpFS.h +++ b/Kernel/FileSystem/TmpFS.h @@ -59,8 +59,8 @@ public: virtual ErrorOr flush_metadata() override; virtual ErrorOr write_bytes(off_t, size_t, const UserOrKernelBuffer& buffer, OpenFileDescription*) override; virtual ErrorOr> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override; - virtual ErrorOr add_child(Inode&, const StringView& name, mode_t) override; - virtual ErrorOr remove_child(const StringView& name) override; + virtual ErrorOr add_child(Inode&, StringView name, mode_t) override; + virtual ErrorOr remove_child(StringView name) override; virtual ErrorOr chmod(mode_t) override; virtual ErrorOr chown(UserID, GroupID) override; virtual ErrorOr truncate(u64) override; diff --git a/Kernel/Firmware/ACPI/Definitions.h b/Kernel/Firmware/ACPI/Definitions.h index ee465621443..1531644e326 100644 --- a/Kernel/Firmware/ACPI/Definitions.h +++ b/Kernel/Firmware/ACPI/Definitions.h @@ -328,7 +328,7 @@ class Parser; namespace StaticParsing { Optional find_rsdp(); -Optional find_table(PhysicalAddress rsdp, const StringView& signature); +Optional find_table(PhysicalAddress rsdp, StringView signature); } } diff --git a/Kernel/Firmware/ACPI/Parser.cpp b/Kernel/Firmware/ACPI/Parser.cpp index ef19a8661c8..745af138e86 100644 --- a/Kernel/Firmware/ACPI/Parser.cpp +++ b/Kernel/Firmware/ACPI/Parser.cpp @@ -75,7 +75,7 @@ UNMAP_AFTER_INIT ACPISysFSDirectory::ACPISysFSDirectory(FirmwareSysFSDirectory& { NonnullRefPtrVector components; size_t ssdt_count = 0; - ACPI::Parser::the()->enumerate_static_tables([&](const StringView& signature, PhysicalAddress p_table, size_t length) { + ACPI::Parser::the()->enumerate_static_tables([&](StringView signature, PhysicalAddress p_table, size_t length) { if (signature == "SSDT") { components.append(ACPISysFSComponent::create(String::formatted("{:4s}{}", signature.characters_without_null_termination(), ssdt_count), p_table, length)); ssdt_count++; @@ -96,7 +96,7 @@ UNMAP_AFTER_INIT ACPISysFSDirectory::ACPISysFSDirectory(FirmwareSysFSDirectory& } } -void Parser::enumerate_static_tables(Function callback) +void Parser::enumerate_static_tables(Function callback) { for (auto& p_table : m_sdt_pointers) { auto table = Memory::map_typed(p_table); @@ -104,9 +104,9 @@ void Parser::enumerate_static_tables(Function search_table_in_xsdt(PhysicalAddress xsdt, const StringView& signature); -static Optional search_table_in_rsdt(PhysicalAddress rsdt, const StringView& signature); +static bool match_table_signature(PhysicalAddress table_header, StringView signature); +static Optional search_table_in_xsdt(PhysicalAddress xsdt, StringView signature); +static Optional search_table_in_rsdt(PhysicalAddress rsdt, StringView signature); static bool validate_table(const Structures::SDTHeader&, size_t length); UNMAP_AFTER_INIT void Parser::locate_static_data() @@ -116,7 +116,7 @@ UNMAP_AFTER_INIT void Parser::locate_static_data() process_fadt_data(); } -UNMAP_AFTER_INIT Optional Parser::find_table(const StringView& signature) +UNMAP_AFTER_INIT Optional Parser::find_table(StringView signature) { dbgln_if(ACPI_DEBUG, "ACPI: Calling Find Table method!"); for (auto p_sdt : m_sdt_pointers) { @@ -383,7 +383,7 @@ UNMAP_AFTER_INIT Optional StaticParsing::find_rsdp() return map_bios().find_chunk_starting_with(signature, 16); } -UNMAP_AFTER_INIT Optional StaticParsing::find_table(PhysicalAddress rsdp_address, const StringView& signature) +UNMAP_AFTER_INIT Optional StaticParsing::find_table(PhysicalAddress rsdp_address, StringView signature) { // FIXME: There's no validation of ACPI tables here. Use the checksum to validate the tables. VERIFY(signature.length() == 4); @@ -401,7 +401,7 @@ UNMAP_AFTER_INIT Optional StaticParsing::find_table(PhysicalAdd VERIFY_NOT_REACHED(); } -UNMAP_AFTER_INIT static Optional search_table_in_xsdt(PhysicalAddress xsdt_address, const StringView& signature) +UNMAP_AFTER_INIT static Optional search_table_in_xsdt(PhysicalAddress xsdt_address, StringView signature) { // FIXME: There's no validation of ACPI tables here. Use the checksum to validate the tables. VERIFY(signature.length() == 4); @@ -415,7 +415,7 @@ UNMAP_AFTER_INIT static Optional search_table_in_xsdt(PhysicalA return {}; } -static bool match_table_signature(PhysicalAddress table_header, const StringView& signature) +static bool match_table_signature(PhysicalAddress table_header, StringView signature) { // FIXME: There's no validation of ACPI tables here. Use the checksum to validate the tables. VERIFY(signature.length() == 4); @@ -424,7 +424,7 @@ static bool match_table_signature(PhysicalAddress table_header, const StringView return !strncmp(table->h.sig, signature.characters_without_null_termination(), 4); } -UNMAP_AFTER_INIT static Optional search_table_in_rsdt(PhysicalAddress rsdt_address, const StringView& signature) +UNMAP_AFTER_INIT static Optional search_table_in_rsdt(PhysicalAddress rsdt_address, StringView signature) { // FIXME: There's no validation of ACPI tables here. Use the checksum to validate the tables. VERIFY(signature.length() == 4); diff --git a/Kernel/Firmware/ACPI/Parser.h b/Kernel/Firmware/ACPI/Parser.h index 903d6d5b495..6bb350f7988 100644 --- a/Kernel/Firmware/ACPI/Parser.h +++ b/Kernel/Firmware/ACPI/Parser.h @@ -51,7 +51,7 @@ public: virtual StringView purpose() const override { return "ACPI Parser"sv; } virtual bool handle_irq(const RegisterState&) override; - Optional find_table(const StringView& signature); + Optional find_table(StringView signature); void try_acpi_reboot(); bool can_reboot(); @@ -64,7 +64,7 @@ public: PhysicalAddress main_system_description_table() const { return m_main_system_description_table; } bool is_xsdt_supported() const { return m_xsdt_supported; } - void enumerate_static_tables(Function); + void enumerate_static_tables(Function); virtual bool have_8042() const { diff --git a/Kernel/KBufferBuilder.cpp b/Kernel/KBufferBuilder.cpp index cc944e93031..6e1654f3dd1 100644 --- a/Kernel/KBufferBuilder.cpp +++ b/Kernel/KBufferBuilder.cpp @@ -66,7 +66,7 @@ ErrorOr KBufferBuilder::append_bytes(ReadonlyBytes bytes) return {}; } -ErrorOr KBufferBuilder::append(const StringView& str) +ErrorOr KBufferBuilder::append(StringView str) { if (str.is_empty()) return {}; @@ -97,7 +97,7 @@ ErrorOr KBufferBuilder::append(char ch) return {}; } -ErrorOr KBufferBuilder::append_escaped_for_json(const StringView& string) +ErrorOr KBufferBuilder::append_escaped_for_json(StringView string) { for (auto ch : string) { switch (ch) { diff --git a/Kernel/KBufferBuilder.h b/Kernel/KBufferBuilder.h index e46f4bc462f..e6cded298e1 100644 --- a/Kernel/KBufferBuilder.h +++ b/Kernel/KBufferBuilder.h @@ -24,11 +24,11 @@ public: KBufferBuilder& operator=(KBufferBuilder&&) = default; ~KBufferBuilder() = default; - ErrorOr append(const StringView&); + ErrorOr append(StringView); ErrorOr append(char); ErrorOr append(const char*, int); - ErrorOr append_escaped_for_json(const StringView&); + ErrorOr append_escaped_for_json(StringView); ErrorOr append_bytes(ReadonlyBytes); template diff --git a/Kernel/KLexicalPath.cpp b/Kernel/KLexicalPath.cpp index 8167cdb3f3a..ee5cd22771b 100644 --- a/Kernel/KLexicalPath.cpp +++ b/Kernel/KLexicalPath.cpp @@ -11,12 +11,12 @@ namespace Kernel::KLexicalPath { static StringView const s_single_dot = "."sv; -bool is_absolute(StringView const& path) +bool is_absolute(StringView path) { return !path.is_empty() && path[0] == '/'; } -bool is_canonical(StringView const& path) +bool is_canonical(StringView path) { // FIXME: This can probably be done more efficiently. if (path.is_empty()) @@ -32,7 +32,7 @@ bool is_canonical(StringView const& path) return true; } -StringView basename(StringView const& a_path) +StringView basename(StringView a_path) { if (a_path == "/"sv) return a_path; @@ -49,7 +49,7 @@ StringView basename(StringView const& a_path) return basename; } -StringView dirname(StringView const& path) +StringView dirname(StringView path) { VERIFY(is_canonical(path)); auto slash_index = path.find_last('/'); @@ -57,13 +57,13 @@ StringView dirname(StringView const& path) return path.substring_view(0, *slash_index); } -Vector parts(StringView const& path) +Vector parts(StringView path) { VERIFY(is_canonical(path)); return path.split_view('/'); } -ErrorOr> try_join(StringView const& first, StringView const& second) +ErrorOr> try_join(StringView first, StringView second) { VERIFY(is_canonical(first)); VERIFY(is_canonical(second)); diff --git a/Kernel/KLexicalPath.h b/Kernel/KLexicalPath.h index e2cdc06df87..73c29b2d103 100644 --- a/Kernel/KLexicalPath.h +++ b/Kernel/KLexicalPath.h @@ -11,12 +11,12 @@ namespace Kernel::KLexicalPath { -bool is_absolute(StringView const&); -bool is_canonical(StringView const&); -StringView basename(StringView const&); -StringView dirname(StringView const&); -Vector parts(StringView const&); +bool is_absolute(StringView); +bool is_canonical(StringView); +StringView basename(StringView); +StringView dirname(StringView); +Vector parts(StringView); -ErrorOr> try_join(StringView const&, StringView const&); +ErrorOr> try_join(StringView, StringView); } diff --git a/Kernel/KSyms.cpp b/Kernel/KSyms.cpp index d199e78b03c..702c3177ed5 100644 --- a/Kernel/KSyms.cpp +++ b/Kernel/KSyms.cpp @@ -33,7 +33,7 @@ static u8 parse_hex_digit(char nibble) return 10 + (nibble - 'a'); } -FlatPtr address_for_kernel_symbol(const StringView& name) +FlatPtr address_for_kernel_symbol(StringView name) { for (size_t i = 0; i < s_symbol_count; ++i) { const auto& symbol = s_symbols[i]; diff --git a/Kernel/KSyms.h b/Kernel/KSyms.h index 17712f02704..2bc6699695b 100644 --- a/Kernel/KSyms.h +++ b/Kernel/KSyms.h @@ -20,7 +20,7 @@ enum class PrintToScreen { Yes, }; -FlatPtr address_for_kernel_symbol(const StringView& name); +FlatPtr address_for_kernel_symbol(StringView name); const KernelSymbol* symbolicate_kernel_address(FlatPtr); void load_kernel_symbol_table(); diff --git a/Kernel/Net/NetworkingManagement.cpp b/Kernel/Net/NetworkingManagement.cpp index 64ed1ef2a65..994de753060 100644 --- a/Kernel/Net/NetworkingManagement.cpp +++ b/Kernel/Net/NetworkingManagement.cpp @@ -63,7 +63,7 @@ RefPtr NetworkingManagement::from_ipv4_address(const IPv4Address return m_loopback_adapter; return {}; } -RefPtr NetworkingManagement::lookup_by_name(const StringView& name) const +RefPtr NetworkingManagement::lookup_by_name(StringView name) const { MutexLocker locker(m_lock); RefPtr found_adapter; diff --git a/Kernel/Net/NetworkingManagement.h b/Kernel/Net/NetworkingManagement.h index cec11713cf1..f2feb641fd7 100644 --- a/Kernel/Net/NetworkingManagement.h +++ b/Kernel/Net/NetworkingManagement.h @@ -34,7 +34,7 @@ public: void for_each(Function); RefPtr from_ipv4_address(const IPv4Address&) const; - RefPtr lookup_by_name(const StringView&) const; + RefPtr lookup_by_name(StringView) const; NonnullRefPtr loopback_adapter() const; diff --git a/Kernel/PerformanceEventBuffer.cpp b/Kernel/PerformanceEventBuffer.cpp index 7bf55726fbf..c6561d9ad4e 100644 --- a/Kernel/PerformanceEventBuffer.cpp +++ b/Kernel/PerformanceEventBuffer.cpp @@ -21,7 +21,7 @@ PerformanceEventBuffer::PerformanceEventBuffer(NonnullOwnPtr buffer) { } -NEVER_INLINE ErrorOr PerformanceEventBuffer::append(int type, FlatPtr arg1, FlatPtr arg2, const StringView& arg3, Thread* current_thread) +NEVER_INLINE ErrorOr PerformanceEventBuffer::append(int type, FlatPtr arg1, FlatPtr arg2, StringView arg3, Thread* current_thread) { FlatPtr ebp; asm volatile("movl %%ebp, %%eax" @@ -56,13 +56,13 @@ static Vector raw_backtrace(Fl } ErrorOr PerformanceEventBuffer::append_with_ip_and_bp(ProcessID pid, ThreadID tid, const RegisterState& regs, - int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, const StringView& arg3) + int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, StringView arg3) { return append_with_ip_and_bp(pid, tid, regs.ip(), regs.bp(), type, lost_samples, arg1, arg2, arg3); } ErrorOr PerformanceEventBuffer::append_with_ip_and_bp(ProcessID pid, ThreadID tid, - FlatPtr ip, FlatPtr bp, int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, const StringView& arg3) + FlatPtr ip, FlatPtr bp, int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, StringView arg3) { if (count() >= capacity()) return ENOBUFS; diff --git a/Kernel/PerformanceEventBuffer.h b/Kernel/PerformanceEventBuffer.h index c8b84301390..aa5a21bcb06 100644 --- a/Kernel/PerformanceEventBuffer.h +++ b/Kernel/PerformanceEventBuffer.h @@ -101,11 +101,11 @@ class PerformanceEventBuffer { public: static OwnPtr try_create_with_size(size_t buffer_size); - ErrorOr append(int type, FlatPtr arg1, FlatPtr arg2, const StringView& arg3, Thread* current_thread = Thread::current()); + ErrorOr append(int type, FlatPtr arg1, FlatPtr arg2, StringView arg3, Thread* current_thread = Thread::current()); ErrorOr append_with_ip_and_bp(ProcessID pid, ThreadID tid, FlatPtr eip, FlatPtr ebp, - int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, const StringView& arg3); + int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, StringView arg3); ErrorOr append_with_ip_and_bp(ProcessID pid, ThreadID tid, const RegisterState& regs, - int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, const StringView& arg3); + int type, u32 lost_samples, FlatPtr arg1, FlatPtr arg2, StringView arg3); void clear() { diff --git a/Kernel/TTY/VirtualConsole.cpp b/Kernel/TTY/VirtualConsole.cpp index 453ba36da24..26ec25b7fac 100644 --- a/Kernel/TTY/VirtualConsole.cpp +++ b/Kernel/TTY/VirtualConsole.cpp @@ -328,7 +328,7 @@ void VirtualConsole::beep() dbgln("Beep!1"); } -void VirtualConsole::set_window_title(const StringView&) +void VirtualConsole::set_window_title(StringView) { // Do nothing. } diff --git a/Kernel/TTY/VirtualConsole.h b/Kernel/TTY/VirtualConsole.h index dd7ce2a99be..458fa962352 100644 --- a/Kernel/TTY/VirtualConsole.h +++ b/Kernel/TTY/VirtualConsole.h @@ -97,7 +97,7 @@ private: // ^TerminalClient virtual void beep() override; - virtual void set_window_title(const StringView&) override; + virtual void set_window_title(StringView) override; virtual void set_window_progress(int, int) override; virtual void terminal_did_resize(u16 columns, u16 rows) override; virtual void terminal_history_changed(int) override; @@ -123,7 +123,7 @@ private: void clear(); - void inject_string(const StringView&); + void inject_string(StringView); Cell& cell_at(size_t column, size_t row); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeData.cpp index 01e4d8f2617..2dd422347a3 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeData.cpp @@ -126,7 +126,7 @@ struct UnicodeData { NormalizationProps normalization_props; }; -static Vector parse_code_point_list(StringView const& list) +static Vector parse_code_point_list(StringView list) { Vector code_points; @@ -137,7 +137,7 @@ static Vector parse_code_point_list(StringView const& list) return code_points; } -static CodePointRange parse_code_point_range(StringView const& list) +static CodePointRange parse_code_point_range(StringView list) { CodePointRange code_point_range {}; @@ -532,14 +532,14 @@ u32 simple_lowercase_mapping(u32 code_point); Span special_case_mapping(u32 code_point); bool code_point_has_general_category(u32 code_point, GeneralCategory general_category); -Optional general_category_from_string(StringView const& general_category); +Optional general_category_from_string(StringView general_category); bool code_point_has_property(u32 code_point, Property property); -Optional property_from_string(StringView const& property); +Optional property_from_string(StringView property); bool code_point_has_script(u32 code_point, Script script); bool code_point_has_script_extension(u32 code_point, Script script); -Optional