Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
5811cdf7
Commit
5811cdf7
authored
Jun 13, 2016
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix possible segfault when parsing .ini files
parent
c9234ddb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
10 deletions
+17
-10
libcaf_core/caf/config_option.hpp
libcaf_core/caf/config_option.hpp
+3
-0
libcaf_core/src/actor_system_config.cpp
libcaf_core/src/actor_system_config.cpp
+2
-10
libcaf_core/src/config_option.cpp
libcaf_core/src/config_option.cpp
+12
-0
No files found.
libcaf_core/caf/config_option.hpp
View file @
5811cdf7
...
@@ -60,6 +60,9 @@ public:
...
@@ -60,6 +60,9 @@ public:
return
explanation_
;
return
explanation_
;
}
}
/// Returns the full name for this config option as "<category>.<long name>".
std
::
string
full_name
()
const
;
/// Returns the held value as string.
/// Returns the held value as string.
virtual
std
::
string
to_string
()
const
=
0
;
virtual
std
::
string
to_string
()
const
=
0
;
...
...
libcaf_core/src/actor_system_config.cpp
View file @
5811cdf7
...
@@ -43,16 +43,8 @@ public:
...
@@ -43,16 +43,8 @@ public:
}
}
void
add_opts
(
options_vector
&
xs
)
{
void
add_opts
(
options_vector
&
xs
)
{
for
(
auto
&
x
:
xs
)
{
for
(
auto
&
x
:
xs
)
std
::
string
key
=
x
->
category
();
sinks_
.
emplace
(
x
->
full_name
(),
x
->
to_sink
());
key
+=
'.'
;
// name can have format "<long>,<short>"; consider only long name
auto
name_begin
=
x
->
name
();
const
char
*
name_end
=
strchr
(
x
->
name
(),
','
);
key
.
insert
(
key
.
end
(),
name_begin
,
name_end
);
//key += x->name();
sinks_
.
emplace
(
std
::
move
(
key
),
x
->
to_sink
());
}
}
}
void
operator
()(
size_t
ln
,
std
::
string
name
,
config_value
&
cv
)
{
void
operator
()(
size_t
ln
,
std
::
string
name
,
config_value
&
cv
)
{
...
...
libcaf_core/src/config_option.cpp
View file @
5811cdf7
...
@@ -43,6 +43,18 @@ config_option::~config_option() {
...
@@ -43,6 +43,18 @@ config_option::~config_option() {
// nop
// nop
}
}
std
::
string
config_option
::
full_name
()
const
{
std
::
string
res
=
category
();
res
+=
'.'
;
auto
name_begin
=
name
();
const
char
*
name_end
=
strchr
(
name
(),
','
);
if
(
name_end
)
res
.
insert
(
res
.
end
(),
name_begin
,
name_end
);
else
res
+=
name
();
return
res
;
}
const
char
*
config_option
::
type_name_visitor
::
operator
()(
const
std
::
string
&
)
const
{
const
char
*
config_option
::
type_name_visitor
::
operator
()(
const
std
::
string
&
)
const
{
return
"a string"
;
return
"a string"
;
}
}
...
...
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