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
9bcbd1cd
Commit
9bcbd1cd
authored
Nov 12, 2013
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove some redundant null checks.
parent
74bf54b9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
layout.c++
c++/src/capnp/layout.c++
+5
-5
No files found.
c++/src/capnp/layout.c++
View file @
9bcbd1cd
...
...
@@ -1614,7 +1614,7 @@ struct WireHelpers {
// readStructPointer(), etc. because they do type checking whereas here we want to accept any
// valid pointer.
if
(
src
==
nullptr
||
src
->
isNull
())
{
if
(
src
->
isNull
())
{
useDefault
:
memset
(
dst
,
0
,
sizeof
(
*
dst
));
return
{
dstSegment
,
nullptr
};
...
...
@@ -1825,7 +1825,7 @@ struct WireHelpers {
static
KJ_ALWAYS_INLINE
(
StructReader
readStructOrCapDescPointer
(
WirePointer
::
Kind
kind
,
SegmentReader
*
segment
,
const
WirePointer
*
ref
,
const
word
*
refTarget
,
const
word
*
defaultValue
,
int
nestingLimit
))
{
if
(
ref
==
nullptr
||
ref
->
isNull
())
{
if
(
ref
->
isNull
())
{
useDefault
:
if
(
defaultValue
==
nullptr
||
reinterpret_cast
<
const
WirePointer
*>
(
defaultValue
)
->
isNull
())
{
...
...
@@ -1877,7 +1877,7 @@ struct WireHelpers {
static
KJ_ALWAYS_INLINE
(
ListReader
readListPointer
(
SegmentReader
*
segment
,
const
WirePointer
*
ref
,
const
word
*
refTarget
,
const
word
*
defaultValue
,
FieldSize
expectedElementSize
,
int
nestingLimit
))
{
if
(
ref
==
nullptr
||
ref
->
isNull
())
{
if
(
ref
->
isNull
())
{
useDefault
:
if
(
defaultValue
==
nullptr
||
reinterpret_cast
<
const
WirePointer
*>
(
defaultValue
)
->
isNull
())
{
...
...
@@ -2021,7 +2021,7 @@ struct WireHelpers {
static
KJ_ALWAYS_INLINE
(
Text
::
Reader
readTextPointer
(
SegmentReader
*
segment
,
const
WirePointer
*
ref
,
const
word
*
refTarget
,
const
void
*
defaultValue
,
ByteCount
defaultSize
))
{
if
(
ref
==
nullptr
||
ref
->
isNull
())
{
if
(
ref
->
isNull
())
{
useDefault
:
if
(
defaultValue
==
nullptr
)
defaultValue
=
""
;
return
Text
::
Reader
(
reinterpret_cast
<
const
char
*>
(
defaultValue
),
defaultSize
/
BYTES
);
...
...
@@ -2075,7 +2075,7 @@ struct WireHelpers {
static
KJ_ALWAYS_INLINE
(
Data
::
Reader
readDataPointer
(
SegmentReader
*
segment
,
const
WirePointer
*
ref
,
const
word
*
refTarget
,
const
void
*
defaultValue
,
ByteCount
defaultSize
))
{
if
(
ref
==
nullptr
||
ref
->
isNull
())
{
if
(
ref
->
isNull
())
{
useDefault
:
return
Data
::
Reader
(
reinterpret_cast
<
const
byte
*>
(
defaultValue
),
defaultSize
/
BYTES
);
}
else
{
...
...
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