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
02c68c5c
Commit
02c68c5c
authored
Jan 21, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net/HostParser: add `noexcept`
parent
b02fee73
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
HostParser.cxx
src/net/HostParser.cxx
+6
-6
HostParser.hxx
src/net/HostParser.hxx
+2
-2
No files found.
src/net/HostParser.cxx
View file @
02c68c5c
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
#include <string.h>
#include <string.h>
static
inline
bool
static
inline
bool
IsValidHostnameChar
(
char
ch
)
IsValidHostnameChar
(
char
ch
)
noexcept
{
{
return
IsAlphaNumericASCII
(
ch
)
||
return
IsAlphaNumericASCII
(
ch
)
||
ch
==
'-'
||
ch
==
'.'
||
ch
==
'-'
||
ch
==
'.'
||
...
@@ -44,14 +44,14 @@ IsValidHostnameChar(char ch)
...
@@ -44,14 +44,14 @@ IsValidHostnameChar(char ch)
}
}
static
inline
bool
static
inline
bool
IsValidScopeChar
(
char
ch
)
IsValidScopeChar
(
char
ch
)
noexcept
{
{
return
IsAlphaNumericASCII
(
ch
)
||
return
IsAlphaNumericASCII
(
ch
)
||
ch
==
'-'
||
ch
==
'_'
;
ch
==
'-'
||
ch
==
'_'
;
}
}
static
const
char
*
static
const
char
*
FindScopeEnd
(
const
char
*
p
)
FindScopeEnd
(
const
char
*
p
)
noexcept
{
{
if
(
*
p
==
'%'
&&
IsValidScopeChar
(
p
[
1
]))
{
if
(
*
p
==
'%'
&&
IsValidScopeChar
(
p
[
1
]))
{
p
+=
2
;
p
+=
2
;
...
@@ -63,7 +63,7 @@ FindScopeEnd(const char *p)
...
@@ -63,7 +63,7 @@ FindScopeEnd(const char *p)
}
}
static
inline
bool
static
inline
bool
IsValidIPv6Char
(
char
ch
)
IsValidIPv6Char
(
char
ch
)
noexcept
{
{
return
IsDigitASCII
(
ch
)
||
return
IsDigitASCII
(
ch
)
||
(
ch
>=
'a'
&&
ch
<=
'f'
)
||
(
ch
>=
'a'
&&
ch
<=
'f'
)
||
...
@@ -72,7 +72,7 @@ IsValidIPv6Char(char ch)
...
@@ -72,7 +72,7 @@ IsValidIPv6Char(char ch)
}
}
static
const
char
*
static
const
char
*
FindIPv6End
(
const
char
*
p
)
FindIPv6End
(
const
char
*
p
)
noexcept
{
{
while
(
IsValidIPv6Char
(
*
p
))
while
(
IsValidIPv6Char
(
*
p
))
++
p
;
++
p
;
...
@@ -84,7 +84,7 @@ FindIPv6End(const char *p)
...
@@ -84,7 +84,7 @@ FindIPv6End(const char *p)
}
}
ExtractHostResult
ExtractHostResult
ExtractHost
(
const
char
*
src
)
ExtractHost
(
const
char
*
src
)
noexcept
{
{
ExtractHostResult
result
{
nullptr
,
src
};
ExtractHostResult
result
{
nullptr
,
src
};
const
char
*
hostname
;
const
char
*
hostname
;
...
...
src/net/HostParser.hxx
View file @
02c68c5c
...
@@ -57,7 +57,7 @@ struct ExtractHostResult {
...
@@ -57,7 +57,7 @@ struct ExtractHostResult {
*/
*/
const
char
*
end
;
const
char
*
end
;
constexpr
bool
HasFailed
()
const
{
constexpr
bool
HasFailed
()
const
noexcept
{
return
host
==
nullptr
;
return
host
==
nullptr
;
}
}
};
};
...
@@ -71,6 +71,6 @@ struct ExtractHostResult {
...
@@ -71,6 +71,6 @@ struct ExtractHostResult {
*/
*/
gcc_pure
gcc_pure
ExtractHostResult
ExtractHostResult
ExtractHost
(
const
char
*
src
);
ExtractHost
(
const
char
*
src
)
noexcept
;
#endif
#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