Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
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
protobuf
Commits
a1b286e2
Commit
a1b286e2
authored
Feb 16, 2019
by
Markov Vladislav
Committed by
Adam Cozzette
Mar 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify string_values_ vector in default_value_objectwriter
parent
8bdecd74
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
6 deletions
+3
-6
default_value_objectwriter.cc
...ogle/protobuf/util/internal/default_value_objectwriter.cc
+2
-5
default_value_objectwriter.h
...oogle/protobuf/util/internal/default_value_objectwriter.h
+1
-1
No files found.
src/google/protobuf/util/internal/default_value_objectwriter.cc
View file @
a1b286e2
...
...
@@ -71,9 +71,6 @@ DefaultValueObjectWriter::DefaultValueObjectWriter(
ow_
(
ow
)
{}
DefaultValueObjectWriter
::~
DefaultValueObjectWriter
()
{
for
(
int
i
=
0
;
i
<
string_values_
.
size
();
++
i
)
{
delete
string_values_
[
i
];
}
if
(
own_typeinfo_
)
{
delete
typeinfo_
;
}
...
...
@@ -156,7 +153,7 @@ DefaultValueObjectWriter* DefaultValueObjectWriter::RenderString(
}
else
{
// Since StringPiece is essentially a pointer, takes a copy of "value" to
// avoid ownership issues.
string_values_
.
push
_back
(
new
string
(
value
));
string_values_
.
emplace
_back
(
new
string
(
value
));
RenderDataPiece
(
name
,
DataPiece
(
*
string_values_
.
back
(),
true
));
}
return
this
;
...
...
@@ -169,7 +166,7 @@ DefaultValueObjectWriter* DefaultValueObjectWriter::RenderBytes(
}
else
{
// Since StringPiece is essentially a pointer, takes a copy of "value" to
// avoid ownership issues.
string_values_
.
push_back
(
new
string
(
value
.
ToString
()
));
string_values_
.
emplace_back
(
new
string
(
value
));
RenderDataPiece
(
name
,
DataPiece
(
*
string_values_
.
back
(),
false
,
true
));
}
return
this
;
...
...
src/google/protobuf/util/internal/default_value_objectwriter.h
View file @
a1b286e2
...
...
@@ -299,7 +299,7 @@ class PROTOBUF_EXPORT DefaultValueObjectWriter : public ObjectWriter {
// google::protobuf::Type of the root message type.
const
google
::
protobuf
::
Type
&
type_
;
// Holds copies of strings passed to RenderString.
std
::
vector
<
std
::
string
*
>
string_values_
;
std
::
vector
<
std
::
unique_ptr
<
std
::
string
>
>
string_values_
;
// The current Node. Owned by its parents.
Node
*
current_
;
...
...
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