Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
a5defd43
Commit
a5defd43
authored
Jun 11, 2018
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove more obsolete STL from message.c++.
parent
b601cf0f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
25 deletions
+7
-25
message.c++
c++/src/capnp/message.c++
+5
-22
message.h
c++/src/capnp/message.h
+2
-3
No files found.
c++/src/capnp/message.c++
View file @
a5defd43
...
@@ -25,9 +25,6 @@
...
@@ -25,9 +25,6 @@
#include "arena.h"
#include "arena.h"
#include "orphan.h"
#include "orphan.h"
#include <stdlib.h>
#include <stdlib.h>
#include <exception>
#include <string>
#include <vector>
#include <errno.h>
#include <errno.h>
namespace
capnp
{
namespace
capnp
{
...
@@ -58,7 +55,7 @@ bool MessageReader::isCanonical() {
...
@@ -58,7 +55,7 @@ bool MessageReader::isCanonical() {
static_assert
(
sizeof
(
_
::
ReaderArena
)
<=
sizeof
(
arenaSpace
),
static_assert
(
sizeof
(
_
::
ReaderArena
)
<=
sizeof
(
arenaSpace
),
"arenaSpace is too small to hold a ReaderArena. Please increase it. This will break "
"arenaSpace is too small to hold a ReaderArena. Please increase it. This will break "
"ABI compatibility."
);
"ABI compatibility."
);
new
(
arena
())
_
::
ReaderArena
(
this
);
kj
::
ctor
(
*
arena
(),
this
);
allocatedArena
=
true
;
allocatedArena
=
true
;
}
}
...
@@ -89,7 +86,7 @@ AnyPointer::Reader MessageReader::getRootInternal() {
...
@@ -89,7 +86,7 @@ AnyPointer::Reader MessageReader::getRootInternal() {
static_assert
(
sizeof
(
_
::
ReaderArena
)
<=
sizeof
(
arenaSpace
),
static_assert
(
sizeof
(
_
::
ReaderArena
)
<=
sizeof
(
arenaSpace
),
"arenaSpace is too small to hold a ReaderArena. Please increase it. This will break "
"arenaSpace is too small to hold a ReaderArena. Please increase it. This will break "
"ABI compatibility."
);
"ABI compatibility."
);
new
(
arena
())
_
::
ReaderArena
(
this
);
kj
::
ctor
(
*
arena
(),
this
);
allocatedArena
=
true
;
allocatedArena
=
true
;
}
}
...
@@ -199,10 +196,6 @@ kj::ArrayPtr<const word> SegmentArrayMessageReader::getSegment(uint id) {
...
@@ -199,10 +196,6 @@ kj::ArrayPtr<const word> SegmentArrayMessageReader::getSegment(uint id) {
// -------------------------------------------------------------------
// -------------------------------------------------------------------
struct
MallocMessageBuilder
::
MoreSegments
{
std
::
vector
<
void
*>
segments
;
};
MallocMessageBuilder
::
MallocMessageBuilder
(
MallocMessageBuilder
::
MallocMessageBuilder
(
uint
firstSegmentWords
,
AllocationStrategy
allocationStrategy
)
uint
firstSegmentWords
,
AllocationStrategy
allocationStrategy
)
:
nextSize
(
firstSegmentWords
),
allocationStrategy
(
allocationStrategy
),
:
nextSize
(
firstSegmentWords
),
allocationStrategy
(
allocationStrategy
),
...
@@ -233,10 +226,8 @@ MallocMessageBuilder::~MallocMessageBuilder() noexcept(false) {
...
@@ -233,10 +226,8 @@ MallocMessageBuilder::~MallocMessageBuilder() noexcept(false) {
}
}
}
}
KJ_IF_MAYBE
(
s
,
moreSegments
)
{
for
(
void
*
ptr
:
moreSegments
)
{
for
(
void
*
ptr
:
s
->
get
()
->
segments
)
{
free
(
ptr
);
free
(
ptr
);
}
}
}
}
}
}
}
...
@@ -273,15 +264,7 @@ kj::ArrayPtr<word> MallocMessageBuilder::allocateSegment(uint minimumSize) {
...
@@ -273,15 +264,7 @@ kj::ArrayPtr<word> MallocMessageBuilder::allocateSegment(uint minimumSize) {
// After the first segment, we want nextSize to equal the total size allocated so far.
// After the first segment, we want nextSize to equal the total size allocated so far.
if
(
allocationStrategy
==
AllocationStrategy
::
GROW_HEURISTICALLY
)
nextSize
=
size
;
if
(
allocationStrategy
==
AllocationStrategy
::
GROW_HEURISTICALLY
)
nextSize
=
size
;
}
else
{
}
else
{
MoreSegments
*
segments
;
moreSegments
.
add
(
result
);
KJ_IF_MAYBE
(
s
,
moreSegments
)
{
segments
=
*
s
;
}
else
{
auto
newSegments
=
kj
::
heap
<
MoreSegments
>
();
segments
=
newSegments
;
moreSegments
=
mv
(
newSegments
);
}
segments
->
segments
.
push_back
(
result
);
if
(
allocationStrategy
==
AllocationStrategy
::
GROW_HEURISTICALLY
)
{
if
(
allocationStrategy
==
AllocationStrategy
::
GROW_HEURISTICALLY
)
{
// set nextSize = min(nextSize+size, MAX_SEGMENT_WORDS)
// set nextSize = min(nextSize+size, MAX_SEGMENT_WORDS)
// while protecting against possible overflow of (nextSize+size)
// while protecting against possible overflow of (nextSize+size)
...
...
c++/src/capnp/message.h
View file @
a5defd43
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include <kj/memory.h>
#include <kj/memory.h>
#include <kj/mutex.h>
#include <kj/mutex.h>
#include <kj/debug.h>
#include <kj/debug.h>
#include <kj/vector.h>
#include "common.h"
#include "common.h"
#include "layout.h"
#include "layout.h"
#include "any.h"
#include "any.h"
...
@@ -387,9 +388,7 @@ private:
...
@@ -387,9 +388,7 @@ private:
bool
returnedFirstSegment
;
bool
returnedFirstSegment
;
void
*
firstSegment
;
void
*
firstSegment
;
kj
::
Vector
<
void
*>
moreSegments
;
struct
MoreSegments
;
kj
::
Maybe
<
kj
::
Own
<
MoreSegments
>>
moreSegments
;
};
};
class
FlatMessageBuilder
:
public
MessageBuilder
{
class
FlatMessageBuilder
:
public
MessageBuilder
{
...
...
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