Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
701c0d6d
Commit
701c0d6d
authored
Jun 27, 2011
by
Jelte Jansen
Browse files
[trac1004] clean up if-statement and don't use json for copy
parent
d57f30ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/lib/cc/data.h
View file @
701c0d6d
...
...
@@ -479,7 +479,7 @@ public:
return
(
true
);
}
using
Element
::
setValue
;
bool
setValue
(
std
::
map
<
std
::
string
,
ConstElementPtr
>&
v
)
{
bool
setValue
(
const
std
::
map
<
std
::
string
,
ConstElementPtr
>&
v
)
{
m
=
v
;
return
(
true
);
}
...
...
src/lib/config/ccsession.cc
View file @
701c0d6d
...
...
@@ -271,18 +271,21 @@ getRelatedLoggers(ConstElementPtr loggers) {
std
::
string
cur_name
=
cur_logger
->
get
(
"name"
)
->
stringValue
();
// if name is '*', or starts with '*.', replace * with root
// logger name
if
(
cur_name
.
length
()
>
0
&&
cur_name
[
0
]
==
'*'
&&
!
(
cur_name
.
length
()
>
1
&&
cur_name
[
1
]
!=
'.'
))
{
if
(
cur_name
==
"*"
||
cur_name
.
length
()
>
1
&&
cur_name
[
0
]
==
'*'
&&
cur_name
[
1
]
==
'.'
)
{
cur_name
=
root_name
+
cur_name
.
substr
(
1
);
// now add it to the result list, but only if a logger with
// that name was not configured explicitely
if
(
our_names
.
find
(
cur_name
)
==
our_names
.
end
())
{
// we substitute the name here already, but as
// we are dealing with consts, we copy the data
// there's no direct copy (yet), but we can use JSON
ElementPtr
new_logger
=
isc
::
data
::
Element
::
fromJSON
(
cur_logger
->
str
());
ConstElementPtr
new_name
=
Element
::
create
(
cur_name
);
new_logger
->
set
(
"name"
,
new_name
);
ElementPtr
new_logger
(
Element
::
createMap
());
// since we'll only be updating one first-level element,
// and we return as const again, a shallow map copy is
// enough
new_logger
->
setValue
(
cur_logger
->
mapValue
());
new_logger
->
set
(
"name"
,
Element
::
create
(
cur_name
));
result
->
add
(
new_logger
);
}
}
...
...
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