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
9a164668
Commit
9a164668
authored
Mar 13, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/UriExtract: migrate uri_get_scheme() to std::string_view
parent
6876d160
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
UriExtract.cxx
src/util/UriExtract.cxx
+7
-7
UriExtract.hxx
src/util/UriExtract.hxx
+3
-3
No files found.
src/util/UriExtract.cxx
View file @
9a164668
...
...
@@ -82,17 +82,17 @@ uri_after_scheme(const char *uri) noexcept
bool
uri_has_scheme
(
const
char
*
uri
)
noexcept
{
return
!
uri_get_scheme
(
uri
).
IsNull
();
return
!
uri_get_scheme
(
uri
).
empty
();
}
StringV
iew
uri_get_scheme
(
const
char
*
uri
)
noexcept
std
::
string_v
iew
uri_get_scheme
(
std
::
string_view
uri
)
noexcept
{
const
char
*
end
=
strstr
(
uri
,
"://"
);
if
(
end
==
nullptr
)
return
nullptr
;
auto
end
=
uri
.
find
(
"://"
);
if
(
end
==
std
::
string_view
::
npos
)
return
{}
;
return
{
uri
,
end
}
;
return
uri
.
substr
(
0
,
end
)
;
}
bool
...
...
src/util/UriExtract.hxx
View file @
9a164668
...
...
@@ -32,7 +32,7 @@
#include "Compiler.h"
struct
StringView
;
#include <string_view>
/**
* Checks whether the specified URI has a scheme in the form
...
...
@@ -46,8 +46,8 @@ uri_has_scheme(const char *uri) noexcept;
* Returns the scheme name of the specified URI, or an empty string.
*/
gcc_pure
StringV
iew
uri_get_scheme
(
const
char
*
uri
)
noexcept
;
std
::
string_v
iew
uri_get_scheme
(
std
::
string_view
uri
)
noexcept
;
gcc_pure
bool
...
...
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