Commit 87015121 authored by Max Kellermann's avatar Max Kellermann

util/SplitString: convert parameter to std::string_view

parent ae4fd576
......@@ -591,7 +591,7 @@ UpnpDatabase::Visit(const DatabaseSelection &selection,
{
DatabaseVisitorHelper helper(CheckSelection(selection), visit_song);
auto vpath = SplitString(selection.uri.c_str(), '/');
auto vpath = SplitString(selection.uri, '/');
if (vpath.empty()) {
for (const auto &server : discovery->GetDirectories()) {
if (visit_directory) {
......
/*
* Copyright (C) 2013-2016 Max Kellermann <max.kellermann@gmail.com>
* Copyright 2013-2020 Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -32,13 +32,14 @@
#include "StringStrip.hxx"
std::forward_list<std::string>
SplitString(const char *s, char separator, bool strip) noexcept
SplitString(std::string_view _s, char separator, bool strip) noexcept
{
StringView s(_s);
if (strip)
s = StripLeft(s);
s.StripLeft();
std::forward_list<std::string> list;
if (*s == 0)
if (s.empty())
return list;
auto i = list.before_begin();
......
/*
* Copyright (C) 2013-2016 Max Kellermann <max.kellermann@gmail.com>
* Copyright 2013-2020 Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -32,6 +32,7 @@
#include <forward_list>
#include <string>
#include <string_view>
/**
* Split a string at a certain separator character into sub strings
......@@ -44,6 +45,6 @@
* (and not a list with an empty string).
*/
std::forward_list<std::string>
SplitString(const char *s, char separator, bool strip=true) noexcept;
SplitString(std::string_view s, char separator, bool strip=true) noexcept;
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment