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
9c685021
Commit
9c685021
authored
Aug 09, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/UriExtract: uri_get_scheme() returns StringView
Reduce overhead by not duplicating the string.
parent
40a28808
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
PlaylistRegistry.cxx
src/playlist/PlaylistRegistry.cxx
+1
-1
UriExtract.cxx
src/util/UriExtract.cxx
+3
-3
UriExtract.hxx
src/util/UriExtract.hxx
+2
-2
No files found.
src/playlist/PlaylistRegistry.cxx
View file @
9c685021
...
...
@@ -123,7 +123,7 @@ playlist_list_open_uri_scheme(const char *uri, Mutex &mutex,
if
(
playlist_plugins_enabled
[
i
]
&&
plugin
->
open_uri
!=
nullptr
&&
plugin
->
schemes
!=
nullptr
&&
StringArrayContainsCase
(
plugin
->
schemes
,
scheme
.
c_str
()
))
{
StringArrayContainsCase
(
plugin
->
schemes
,
scheme
))
{
auto
playlist
=
plugin
->
open_uri
(
uri
,
mutex
);
if
(
playlist
)
return
playlist
;
...
...
src/util/UriExtract.cxx
View file @
9c685021
...
...
@@ -85,14 +85,14 @@ uri_has_scheme(const char *uri) noexcept
return
strstr
(
uri
,
"://"
)
!=
nullptr
;
}
std
::
string
StringView
uri_get_scheme
(
const
char
*
uri
)
noexcept
{
const
char
*
end
=
strstr
(
uri
,
"://"
);
if
(
end
==
nullptr
)
end
=
uri
;
return
nullptr
;
return
std
::
string
(
uri
,
end
)
;
return
{
uri
,
end
}
;
}
const
char
*
...
...
src/util/UriExtract.hxx
View file @
9c685021
...
...
@@ -32,7 +32,7 @@
#include "Compiler.h"
#include <string>
struct
StringView
;
/**
* Checks whether the specified URI has a scheme in the form
...
...
@@ -46,7 +46,7 @@ uri_has_scheme(const char *uri) noexcept;
* Returns the scheme name of the specified URI, or an empty string.
*/
gcc_pure
std
::
string
StringView
uri_get_scheme
(
const
char
*
uri
)
noexcept
;
/**
...
...
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