Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
f2b9785a
Commit
f2b9785a
authored
Nov 04, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
filter/chain: pass std::string_view to filter_chain_append()
parent
eeaec99c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
8 deletions
+11
-8
LoadChain.cxx
src/filter/LoadChain.cxx
+6
-4
ChainFilterPlugin.cxx
src/filter/plugins/ChainFilterPlugin.cxx
+3
-3
ChainFilterPlugin.hxx
src/filter/plugins/ChainFilterPlugin.hxx
+2
-1
No files found.
src/filter/LoadChain.cxx
View file @
f2b9785a
...
...
@@ -27,10 +27,13 @@
static
void
filter_chain_append_new
(
PreparedFilter
&
chain
,
FilterFactory
&
factory
,
const
char
*
template_name
)
std
::
string_view
template_name
)
{
filter_chain_append
(
chain
,
template_name
,
factory
.
MakeFilter
(
template_name
));
/* unfortunately, MakeFilter() wants a
null-terminated string, so we need to
copy it here */
factory
.
MakeFilter
(
std
::
string
(
template_name
).
c_str
()));
}
void
...
...
@@ -42,7 +45,6 @@ filter_chain_parse(PreparedFilter &chain,
if
(
i
.
empty
())
continue
;
const
std
::
string
name
(
i
);
filter_chain_append_new
(
chain
,
factory
,
name
.
c_str
());
filter_chain_append_new
(
chain
,
factory
,
i
);
}
}
src/filter/plugins/ChainFilterPlugin.cxx
View file @
f2b9785a
...
...
@@ -76,7 +76,7 @@ class PreparedChainFilter final : public PreparedFilter {
const
std
::
string
name
;
std
::
unique_ptr
<
PreparedFilter
>
filter
;
Child
(
const
char
*
_name
,
Child
(
std
::
string_view
_name
,
std
::
unique_ptr
<
PreparedFilter
>
_filter
)
:
name
(
_name
),
filter
(
std
::
move
(
_filter
))
{}
...
...
@@ -89,7 +89,7 @@ class PreparedChainFilter final : public PreparedFilter {
std
::
list
<
Child
>
children
;
public
:
void
Append
(
const
char
*
name
,
void
Append
(
std
::
string_view
name
,
std
::
unique_ptr
<
PreparedFilter
>
filter
)
noexcept
{
children
.
emplace_back
(
name
,
std
::
move
(
filter
));
}
...
...
@@ -175,7 +175,7 @@ filter_chain_new() noexcept
}
void
filter_chain_append
(
PreparedFilter
&
_chain
,
const
char
*
name
,
filter_chain_append
(
PreparedFilter
&
_chain
,
std
::
string_view
name
,
std
::
unique_ptr
<
PreparedFilter
>
filter
)
noexcept
{
auto
&
chain
=
(
PreparedChainFilter
&
)
_chain
;
...
...
src/filter/plugins/ChainFilterPlugin.hxx
View file @
f2b9785a
...
...
@@ -28,6 +28,7 @@
#define MPD_FILTER_CHAIN_HXX
#include <memory>
#include <string_view>
class
PreparedFilter
;
...
...
@@ -45,7 +46,7 @@ filter_chain_new() noexcept;
* @param filter the filter to be appended to #chain
*/
void
filter_chain_append
(
PreparedFilter
&
chain
,
const
char
*
name
,
filter_chain_append
(
PreparedFilter
&
chain
,
std
::
string_view
name
,
std
::
unique_ptr
<
PreparedFilter
>
filter
)
noexcept
;
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment