[CRIU] [PATCH v3 08/12] protobuf: field showing routine split
Kinsbursky Stanislav
skinsbursky at openvz.org
Mon Aug 13 09:59:40 EDT 2012
From: Stanislav Kinsbursky <skinsbursky at openvz.org>
Will be usefull later with "pretty" show support.
Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
protobuf.c | 26 +++++++++++++++-----------
1 files changed, 15 insertions(+), 11 deletions(-)
-------------- next part --------------
diff --git a/protobuf.c b/protobuf.c
index f856718..a48c5d1 100644
--- a/protobuf.c
+++ b/protobuf.c
@@ -296,20 +296,11 @@ static pb_pr_show_t get_pb_show_function(int type)
return pb_msg_unk;
}
-static void pb_show_field(const ProtobufCFieldDescriptor *fd,
- unsigned long nr_fields, pb_pr_ctl_t *ctl)
+static void pb_show_repeated(pb_pr_ctl_t *ctl, int nr_fields, pb_pr_show_t show,
+ size_t fsize)
{
- pb_pr_show_t show;
pb_pr_field_t *field = &ctl->cur;
unsigned long counter;
- size_t fsize;
-
- print_tabs(ctl);
-
- pr_msg("%s: ", fd->name);
-
- fsize = pb_show_prepare_field_context(fd, ctl);
- show = get_pb_show_function(fd->type);
show(field->data, ctl);
field->data += fsize;
@@ -318,6 +309,19 @@ static void pb_show_field(const ProtobufCFieldDescriptor *fd,
pr_msg(":");
show(field->data, ctl);
}
+}
+
+static void pb_show_field(const ProtobufCFieldDescriptor *fd,
+ int nr_fields, pb_pr_ctl_t *ctl)
+{
+ pb_pr_show_t show;
+
+ print_tabs(ctl);
+ pr_msg("%s: ", fd->name);
+
+ show = get_pb_show_function(fd->type);
+
+ pb_show_repeated(ctl, nr_fields, show, pb_show_prepare_field_context(fd, ctl));
if (ctl->single_entry)
pr_msg("\n");
More information about the CRIU
mailing list