diff options
author | Robin Burchell <robin+git@viroteck.net> | 2019-06-02 12:26:28 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-06-02 12:55:51 +0200 |
commit | 7bce096afdf182216c9da4c94765e12662188c98 (patch) | |
tree | b29607bbf3ad02d151f7a4ad7ca920636aaefb74 /LibCore | |
parent | b55b6cd7fcaa8518e4901d4ec5bd0a9da5b28fc0 (diff) | |
download | serenity-7bce096afdf182216c9da4c94765e12662188c98.zip |
Take StringView in more places
We should work towards a pattern where we take StringView as function
arguments, and store String as member, to push the String construction
to the last possible moment.
Diffstat (limited to 'LibCore')
-rw-r--r-- | LibCore/CDirIterator.cpp | 2 | ||||
-rw-r--r-- | LibCore/CDirIterator.h | 2 | ||||
-rw-r--r-- | LibCore/CFile.cpp | 2 | ||||
-rw-r--r-- | LibCore/CFile.h | 4 |
4 files changed, 5 insertions, 5 deletions
diff --git a/LibCore/CDirIterator.cpp b/LibCore/CDirIterator.cpp index aa64ea8b71..d76d52970d 100644 --- a/LibCore/CDirIterator.cpp +++ b/LibCore/CDirIterator.cpp @@ -1,7 +1,7 @@ #include "CDirIterator.h" #include <cerrno> -CDirIterator::CDirIterator(const String& path, Flags flags) +CDirIterator::CDirIterator(const StringView& path, Flags flags) : m_flags(flags) { m_dir = opendir(path.characters()); diff --git a/LibCore/CDirIterator.h b/LibCore/CDirIterator.h index 72920c2c1f..1d3395ef13 100644 --- a/LibCore/CDirIterator.h +++ b/LibCore/CDirIterator.h @@ -11,7 +11,7 @@ public: SkipDots = 0x1, }; - CDirIterator(const String& path, Flags = Flags::NoFlags); + CDirIterator(const StringView& path, Flags = Flags::NoFlags); ~CDirIterator(); bool has_error() const { return m_error != 0; } diff --git a/LibCore/CFile.cpp b/LibCore/CFile.cpp index 44813e1c97..ce686ec416 100644 --- a/LibCore/CFile.cpp +++ b/LibCore/CFile.cpp @@ -3,7 +3,7 @@ #include <stdio.h> #include <unistd.h> -CFile::CFile(const String& filename) +CFile::CFile(const StringView& filename) : m_filename(filename) { } diff --git a/LibCore/CFile.h b/LibCore/CFile.h index fab396ac55..de051b3084 100644 --- a/LibCore/CFile.h +++ b/LibCore/CFile.h @@ -6,11 +6,11 @@ class CFile final : public CIODevice { public: CFile() {} - explicit CFile(const String&); + explicit CFile(const StringView&); virtual ~CFile() override; String filename() const { return m_filename; } - void set_filename(const String& filename) { m_filename = filename; } + void set_filename(const StringView& filename) { m_filename = filename; } virtual bool open(CIODevice::OpenMode) override; |