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
eeaaea80
Commit
eeaaea80
authored
Jul 17, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config/Data: FindBlock() throws on error
parent
15c36bae
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
Data.cxx
src/config/Data.cxx
+3
-3
Data.hxx
src/config/Data.hxx
+4
-1
No files found.
src/config/Data.cxx
View file @
eeaaea80
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
#include "Data.hxx"
#include "Data.hxx"
#include "Param.hxx"
#include "Param.hxx"
#include "Block.hxx"
#include "Block.hxx"
#include "
system/Fatal
Error.hxx"
#include "
util/Runtime
Error.hxx"
#include "util/StringAPI.hxx"
#include "util/StringAPI.hxx"
void
void
...
@@ -40,13 +40,13 @@ ConfigData::Clear()
...
@@ -40,13 +40,13 @@ ConfigData::Clear()
const
ConfigBlock
*
const
ConfigBlock
*
ConfigData
::
FindBlock
(
ConfigBlockOption
option
,
ConfigData
::
FindBlock
(
ConfigBlockOption
option
,
const
char
*
key
,
const
char
*
value
)
const
noexcept
const
char
*
key
,
const
char
*
value
)
const
{
{
for
(
const
auto
*
block
=
GetBlock
(
option
);
for
(
const
auto
*
block
=
GetBlock
(
option
);
block
!=
nullptr
;
block
=
block
->
next
)
{
block
!=
nullptr
;
block
=
block
->
next
)
{
const
char
*
value2
=
block
->
GetBlockValue
(
key
);
const
char
*
value2
=
block
->
GetBlockValue
(
key
);
if
(
value2
==
nullptr
)
if
(
value2
==
nullptr
)
FormatFatal
Error
(
"block without '%s' in line %d"
,
throw
FormatRuntime
Error
(
"block without '%s' in line %d"
,
key
,
block
->
line
);
key
,
block
->
line
);
if
(
StringIsEqual
(
value2
,
value
))
if
(
StringIsEqual
(
value2
,
value
))
...
...
src/config/Data.hxx
View file @
eeaaea80
...
@@ -43,9 +43,12 @@ struct ConfigData {
...
@@ -43,9 +43,12 @@ struct ConfigData {
return
blocks
[
size_t
(
option
)];
return
blocks
[
size_t
(
option
)];
}
}
/**
* Throws if a block doesn't have the specified (mandatory) key.
*/
gcc_pure
gcc_pure
const
ConfigBlock
*
FindBlock
(
ConfigBlockOption
option
,
const
ConfigBlock
*
FindBlock
(
ConfigBlockOption
option
,
const
char
*
key
,
const
char
*
value
)
const
noexcept
;
const
char
*
key
,
const
char
*
value
)
const
;
};
};
#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