[CRIU] [PATCH 08/11] protobuf: field showing routine split

Kinsbursky Stanislav skinsbursky at openvz.org
Tue Jul 31 10:39:48 EDT 2012


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(-)

diff --git a/protobuf.c b/protobuf.c
index ce7923d..0a65fcd 100644
--- a/protobuf.c
+++ b/protobuf.c
@@ -179,20 +179,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 do_show_field(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;
@@ -208,6 +199,19 @@ static void pb_show_field(const ProtobufCFieldDescriptor *fd,
 		pr_msg(" ");
 }
 
+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);
+
+	do_show_field(ctl, nr_fields, show, pb_show_prepare_field_context(fd, ctl));
+}
+
 static int pb_optional_field_present(const ProtobufCFieldDescriptor *field,
 				    void *msg)
 {



More information about the CRIU mailing list