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
9bff5f9e
Commit
9bff5f9e
authored
Aug 20, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client/Process, command/all: add `noexcept`
Clarify that those can't throw, preparing for the next commit.
parent
2bf26a2f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
13 deletions
+15
-13
ClientInternal.hxx
src/client/ClientInternal.hxx
+1
-1
ClientProcess.cxx
src/client/ClientProcess.cxx
+2
-2
AllCommands.cxx
src/command/AllCommands.cxx
+10
-8
AllCommands.hxx
src/command/AllCommands.hxx
+2
-2
No files found.
src/client/ClientInternal.hxx
View file @
9bff5f9e
...
...
@@ -35,6 +35,6 @@ extern size_t client_max_command_list_size;
extern
size_t
client_max_output_buffer_size
;
CommandResult
client_process_line
(
Client
&
client
,
char
*
line
);
client_process_line
(
Client
&
client
,
char
*
line
)
noexcept
;
#endif
src/client/ClientProcess.cxx
View file @
9bff5f9e
...
...
@@ -30,7 +30,7 @@
static
CommandResult
client_process_command_list
(
Client
&
client
,
bool
list_ok
,
std
::
list
<
std
::
string
>
&&
list
)
std
::
list
<
std
::
string
>
&&
list
)
noexcept
{
CommandResult
ret
=
CommandResult
::
OK
;
unsigned
num
=
0
;
...
...
@@ -51,7 +51,7 @@ client_process_command_list(Client &client, bool list_ok,
}
CommandResult
client_process_line
(
Client
&
client
,
char
*
line
)
client_process_line
(
Client
&
client
,
char
*
line
)
noexcept
{
CommandResult
ret
;
...
...
src/command/AllCommands.cxx
View file @
9bff5f9e
...
...
@@ -206,9 +206,10 @@ static constexpr struct command commands[] = {
static
constexpr
unsigned
num_commands
=
ARRAY_SIZE
(
commands
);
gcc_pure
static
bool
command_available
(
gcc_unused
const
Partition
&
partition
,
gcc_unused
const
struct
command
*
cmd
)
gcc_unused
const
struct
command
*
cmd
)
noexcept
{
#ifdef ENABLE_SQLITE
if
(
StringIsEqual
(
cmd
->
cmd
,
"sticker"
))
...
...
@@ -235,7 +236,7 @@ command_available(gcc_unused const Partition &partition,
static
CommandResult
PrintAvailableCommands
(
Response
&
r
,
const
Partition
&
partition
,
unsigned
permission
)
unsigned
permission
)
noexcept
{
for
(
unsigned
i
=
0
;
i
<
num_commands
;
++
i
)
{
const
struct
command
*
cmd
=
&
commands
[
i
];
...
...
@@ -249,7 +250,7 @@ PrintAvailableCommands(Response &r, const Partition &partition,
}
static
CommandResult
PrintUnavailableCommands
(
Response
&
r
,
unsigned
permission
)
PrintUnavailableCommands
(
Response
&
r
,
unsigned
permission
)
noexcept
{
for
(
unsigned
i
=
0
;
i
<
num_commands
;
++
i
)
{
const
struct
command
*
cmd
=
&
commands
[
i
];
...
...
@@ -276,7 +277,7 @@ handle_not_commands(Client &client, gcc_unused Request request, Response &r)
}
void
command_init
()
command_init
()
noexcept
{
#ifndef NDEBUG
/* ensure that the command list is sorted */
...
...
@@ -285,8 +286,9 @@ command_init()
#endif
}
gcc_pure
static
const
struct
command
*
command_lookup
(
const
char
*
name
)
command_lookup
(
const
char
*
name
)
noexcept
{
unsigned
a
=
0
,
b
=
num_commands
,
i
;
...
...
@@ -308,7 +310,7 @@ command_lookup(const char *name)
static
bool
command_check_request
(
const
struct
command
*
cmd
,
Response
&
r
,
unsigned
permission
,
Request
args
)
unsigned
permission
,
Request
args
)
noexcept
{
if
(
cmd
->
permission
!=
(
permission
&
cmd
->
permission
))
{
r
.
FormatError
(
ACK_ERROR_PERMISSION
,
...
...
@@ -342,7 +344,7 @@ command_check_request(const struct command *cmd, Response &r,
static
const
struct
command
*
command_checked_lookup
(
Response
&
r
,
unsigned
permission
,
const
char
*
cmd_name
,
Request
args
)
const
char
*
cmd_name
,
Request
args
)
noexcept
{
const
struct
command
*
cmd
=
command_lookup
(
cmd_name
);
if
(
cmd
==
nullptr
)
{
...
...
@@ -360,7 +362,7 @@ command_checked_lookup(Response &r, unsigned permission,
}
CommandResult
command_process
(
Client
&
client
,
unsigned
num
,
char
*
line
)
command_process
(
Client
&
client
,
unsigned
num
,
char
*
line
)
noexcept
try
{
Response
r
(
client
,
num
);
...
...
src/command/AllCommands.hxx
View file @
9bff5f9e
...
...
@@ -25,9 +25,9 @@
class
Client
;
void
command_init
();
command_init
()
noexcept
;
CommandResult
command_process
(
Client
&
client
,
unsigned
num
,
char
*
line
);
command_process
(
Client
&
client
,
unsigned
num
,
char
*
line
)
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