Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
ee9d9bdb
Commit
ee9d9bdb
authored
Oct 17, 2013
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show: Compact output of zeroes in long repeated fields
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
1b3da3a1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
protobuf.c
protobuf.c
+14
-3
No files found.
protobuf.c
View file @
ee9d9bdb
...
...
@@ -59,6 +59,16 @@ static int pb_msg_int64x(pb_pr_field_t *field)
return
0
;
}
static
int
pb_msg_int64x_r
(
pb_pr_field_t
*
field
)
{
long
val
=
*
(
long
*
)
field
->
data
;
if
(
val
)
pr_msg
(
"%#016lx"
,
val
);
else
pr_msg
(
"0"
);
return
0
;
}
static
int
pb_msg_string
(
pb_pr_field_t
*
field
)
{
pr_msg
(
"
\"
%s
\"
"
,
*
(
char
**
)
field
->
data
);
...
...
@@ -294,7 +304,7 @@ static int pb_field_show_pretty(const ProtobufCFieldDescriptor *fd, pb_pr_ctl_t
return
0
;
}
static
pb_pr_show_t
get_pb_show_function
(
int
type
)
static
pb_pr_show_t
get_pb_show_function
(
int
type
,
int
label
)
{
switch
(
type
)
{
case
PROTOBUF_C_TYPE_INT32
:
...
...
@@ -308,7 +318,8 @@ static pb_pr_show_t get_pb_show_function(int type)
case
PROTOBUF_C_TYPE_FIXED32
:
case
PROTOBUF_C_TYPE_UINT64
:
case
PROTOBUF_C_TYPE_FIXED64
:
return
pb_msg_int64x
;
return
(
label
==
PROTOBUF_C_LABEL_REPEATED
?
pb_msg_int64x_r
:
pb_msg_int64x
);
case
PROTOBUF_C_TYPE_STRING
:
return
pb_msg_string
;
case
PROTOBUF_C_TYPE_MESSAGE
:
...
...
@@ -332,7 +343,7 @@ static pb_pr_show_t get_show_function(const ProtobufCFieldDescriptor *fd, pb_pr_
{
if
(
pb_field_show_pretty
(
fd
,
ctl
))
return
pb_show_pretty
;
return
get_pb_show_function
(
fd
->
type
);
return
get_pb_show_function
(
fd
->
type
,
fd
->
label
);
}
static
void
pb_show_repeated
(
pb_pr_ctl_t
*
ctl
,
int
nr_fields
,
pb_pr_show_t
show
,
...
...
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