summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarol Kosek <krkk@serenityos.org>2022-12-18 19:52:25 +0100
committerAndreas Kling <kling@serenityos.org>2022-12-20 10:58:54 +0100
commit697d6ffb1dd5b3e101dac71c025548af99497b4f (patch)
treec2a0f22efdd95684ebdc3072df158521397b488b
parentce2ed7615ad0e604ddae20c1585fabd98c2294c6 (diff)
downloadserenity-697d6ffb1dd5b3e101dac71c025548af99497b4f.zip
LibDiff: Make Diff::generate_only_additions take text as StringView
-rw-r--r--Userland/Libraries/LibDiff/Format.cpp4
-rw-r--r--Userland/Libraries/LibDiff/Format.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibDiff/Format.cpp b/Userland/Libraries/LibDiff/Format.cpp
index 7956777325..2d8f607960 100644
--- a/Userland/Libraries/LibDiff/Format.cpp
+++ b/Userland/Libraries/LibDiff/Format.cpp
@@ -10,9 +10,9 @@
#include <AK/Vector.h>
namespace Diff {
-DeprecatedString generate_only_additions(DeprecatedString const& text)
+DeprecatedString generate_only_additions(StringView text)
{
- auto lines = text.split('\n', SplitBehavior::KeepEmpty);
+ auto lines = text.split_view('\n', SplitBehavior::KeepEmpty);
StringBuilder builder;
builder.appendff("@@ -0,0 +1,{} @@\n", lines.size());
for (auto const& line : lines) {
diff --git a/Userland/Libraries/LibDiff/Format.h b/Userland/Libraries/LibDiff/Format.h
index 88d90efeb4..c8740eef08 100644
--- a/Userland/Libraries/LibDiff/Format.h
+++ b/Userland/Libraries/LibDiff/Format.h
@@ -9,5 +9,5 @@
#include <AK/DeprecatedString.h>
namespace Diff {
-DeprecatedString generate_only_additions(DeprecatedString const&);
+DeprecatedString generate_only_additions(StringView);
};