summaryrefslogtreecommitdiff
path: root/src/command/OtherCommands.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2019-06-06 12:02:55 +0200
committerMax Kellermann <max@musicpd.org>2019-06-06 13:00:53 +0200
commit548aa00111e781c6b31e9a2486306d607081b1ec (patch)
treef44be7fd991040473082f1b2431c06c8e4c7aeb4 /src/command/OtherCommands.cxx
parent76eb550011312cf5c096c86e7920decfe139b63d (diff)
tag/Handler: pass StringView to OnTag() and OnPair()
Eliminates a number of allocations, because callers don't need to copy the strings to a newly allocated buffer only to null-terminate them. And most callers don't need to have a null-terminated string.
Diffstat (limited to 'src/command/OtherCommands.cxx')
-rw-r--r--src/command/OtherCommands.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/command/OtherCommands.cxx b/src/command/OtherCommands.cxx
index fe9978b1e..4ae7f6b2c 100644
--- a/src/command/OtherCommands.cxx
+++ b/src/command/OtherCommands.cxx
@@ -38,6 +38,7 @@
#include "time/ChronoUtil.hxx"
#include "util/UriUtil.hxx"
#include "util/StringAPI.hxx"
+#include "util/StringView.hxx"
#include "fs/AllocatedPath.hxx"
#include "Stats.hxx"
#include "PlaylistFile.hxx"
@@ -147,7 +148,7 @@ public:
explicit PrintTagHandler(Response &_response) noexcept
:NullTagHandler(WANT_TAG), response(_response) {}
- void OnTag(TagType type, const char *value) noexcept override {
+ void OnTag(TagType type, StringView value) noexcept override {
if (response.GetClient().tag_mask.Test(type))
tag_print(response, type, value);
}