Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
5082c255
Commit
5082c255
authored
May 06, 2013
by
Mukund Sivaraman
Browse files
[2850] Constify getNamedAddress()
parent
3599c074
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/lib/util/memory_segment.h
View file @
5082c255
...
...
@@ -254,7 +254,7 @@ public:
/// \return An std::pair containing a bool (set to true if the name
/// was found, or false otherwise) and the address associated with
/// the name (which is undefined if the name was not found).
NamedAddressResult
getNamedAddress
(
const
char
*
name
)
{
NamedAddressResult
getNamedAddress
(
const
char
*
name
)
const
{
// This public method implements common validation. The actual
// work specific to the derived segment is delegated to the
// corresponding protected method.
...
...
@@ -296,7 +296,7 @@ protected:
virtual
bool
setNamedAddressImpl
(
const
char
*
name
,
void
*
addr
)
=
0
;
/// \brief Implementation of getNamedAddress beyond common validation.
virtual
NamedAddressResult
getNamedAddressImpl
(
const
char
*
name
)
=
0
;
virtual
NamedAddressResult
getNamedAddressImpl
(
const
char
*
name
)
const
=
0
;
/// \brief Implementation of clearNamedAddress beyond common validation.
virtual
bool
clearNamedAddressImpl
(
const
char
*
name
)
=
0
;
...
...
src/lib/util/memory_segment_local.cc
View file @
5082c255
...
...
@@ -52,8 +52,9 @@ MemorySegmentLocal::allMemoryDeallocated() const {
}
MemorySegment
::
NamedAddressResult
MemorySegmentLocal
::
getNamedAddressImpl
(
const
char
*
name
)
{
std
::
map
<
std
::
string
,
void
*>::
iterator
found
=
named_addrs_
.
find
(
name
);
MemorySegmentLocal
::
getNamedAddressImpl
(
const
char
*
name
)
const
{
std
::
map
<
std
::
string
,
void
*>::
const_iterator
found
=
named_addrs_
.
find
(
name
);
if
(
found
!=
named_addrs_
.
end
())
{
return
(
NamedAddressResult
(
true
,
found
->
second
));
}
...
...
src/lib/util/memory_segment_local.h
View file @
5082c255
...
...
@@ -70,7 +70,7 @@ public:
///
/// There's a small chance this method could throw std::bad_alloc.
/// It should be considered a fatal error.
virtual
NamedAddressResult
getNamedAddressImpl
(
const
char
*
name
);
virtual
NamedAddressResult
getNamedAddressImpl
(
const
char
*
name
)
const
;
/// \brief Local segment version of setNamedAddress.
///
...
...
src/lib/util/memory_segment_mapped.cc
View file @
5082c255
...
...
@@ -280,7 +280,7 @@ MemorySegmentMapped::allMemoryDeallocated() const {
}
MemorySegment
::
NamedAddressResult
MemorySegmentMapped
::
getNamedAddressImpl
(
const
char
*
name
)
{
MemorySegmentMapped
::
getNamedAddressImpl
(
const
char
*
name
)
const
{
offset_ptr
<
void
>*
storage
=
impl_
->
base_sgmt_
->
find
<
offset_ptr
<
void
>
>
(
name
).
first
;
if
(
storage
)
{
...
...
src/lib/util/memory_segment_mapped.h
View file @
5082c255
...
...
@@ -195,7 +195,7 @@ public:
/// \brief Mapped segment version of getNamedAddress.
///
/// This version never throws.
virtual
NamedAddressResult
getNamedAddressImpl
(
const
char
*
name
);
virtual
NamedAddressResult
getNamedAddressImpl
(
const
char
*
name
)
const
;
/// \brief Mapped segment version of clearNamedAddress.
///
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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