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
c097d3c7
Commit
c097d3c7
authored
Aug 13, 2012
by
JINMEI Tatuya
Browse files
[2097] introduced the 'next' member; check alignment requirement
parent
6ddaa499
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/lib/datasrc/memory/rdataset.cc
View file @
c097d3c7
...
...
@@ -94,6 +94,10 @@ RdataSet::RdataSet(RRType type_param, size_t rdata_count_param,
// our assumption of the size of RdataSet holds. If it's not the case
// we should use the bare value instead of the class object.
BOOST_STATIC_ASSERT
(
sizeof
(
type
)
==
sizeof
(
uint16_t
));
// Confirm we meet the alignment requirement for RdataEncoder
// ("this + 1" should be safely passed to the encoder).
BOOST_STATIC_ASSERT
(
sizeof
(
RdataSet
)
%
sizeof
(
uint16_t
)
==
0
);
}
}
// namespace memory
...
...
src/lib/datasrc/memory/rdataset.h
View file @
c097d3c7
...
...
@@ -22,6 +22,8 @@
#include <dns/rrset.h>
#include <dns/rrttl.h>
#include <boost/interprocess/offset_ptr.hpp>
#include <stdint.h>
namespace
isc
{
...
...
@@ -38,6 +40,14 @@ public:
static
void
destroy
(
util
::
MemorySegment
&
mem_sgmt
,
dns
::
RRClass
rrclass
,
RdataSet
*
rdataset
);
typedef
boost
::
interprocess
::
offset_ptr
<
RdataSet
>
RdataSetPtr
;
typedef
boost
::
interprocess
::
offset_ptr
<
const
RdataSet
>
ConstRdataSetPtr
;
// Note: the size and order of the members are important. Don't change
// them unless there's strong reason for that and the consequences are
// considered.
RdataSetPtr
next
;
const
dns
::
RRType
type
;
private:
const
uint16_t
sig_rdata_count
:
3
;
...
...
src/lib/datasrc/memory/tests/rdataset_unittest.cc
View file @
c097d3c7
...
...
@@ -63,6 +63,7 @@ TEST_F(RdataSetTest, create) {
// would detect any memory leak)
RdataSet
*
rdataset
=
RdataSet
::
create
(
mem_sgmt_
,
encoder_
,
a_rrset_
,
ConstRRsetPtr
());
EXPECT_FALSE
(
rdataset
->
next
);
// by default the next pointer should be NULL
EXPECT_EQ
(
RRType
::
A
(),
rdataset
->
type
);
EXPECT_EQ
(
RRTTL
(
1076895760
),
restoreTTL
(
rdataset
->
getTTLData
()));
EXPECT_EQ
(
1
,
rdataset
->
getRdataCount
());
...
...
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