[CRIU] [PATCH] protobuf: simplify plain show logic

Kinsbursky Stanislav skinsbursky at openvz.org
Thu Jul 19 05:49:47 EDT 2012


From: Stanislav Kinsbursky <skinsbursky at openvz.org>

__pb_show_msg() is redundant.

Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
 include/protobuf.h |    1 -
 protobuf.c         |   13 ++++---------
 2 files changed, 4 insertions(+), 10 deletions(-)
-------------- next part --------------
diff --git a/include/protobuf.h b/include/protobuf.h
index cf9c449..2818ae4 100644
--- a/include/protobuf.h
+++ b/include/protobuf.h
@@ -58,7 +58,6 @@ extern int pb_write_object_with_header(int fd, void *obj,
 
 #include <google/protobuf-c/protobuf-c.h>
 
-extern void pb_show_msg(const void *msg, const void *msg_desc);
 extern void do_pb_show_plain(int fd, const ProtobufCMessageDescriptor *d,
 		pb_unpack_t unpack, pb_free_t free);
 
diff --git a/protobuf.c b/protobuf.c
index 544f181..ff6c937 100644
--- a/protobuf.c
+++ b/protobuf.c
@@ -42,12 +42,12 @@ static void pb_msg_unk(void *obj, void *arg)
 	pr_msg("unknown object %p\n", obj);
 }
 
-static void __pb_show_msg(const void *msg, const ProtobufCMessageDescriptor *md);
+static void pb_show_msg(const void *msg, const ProtobufCMessageDescriptor *md);
 
 static void show_nested_message(void *msg, void *md)
 {
 	pr_msg("[ ");
-	__pb_show_msg(msg, md);
+	pb_show_msg(msg, md);
 	pr_msg(" ] ");
 }
 
@@ -132,7 +132,7 @@ static void pb_show_field(const ProtobufCFieldDescriptor *fd, void *where,
 	pr_msg(" ");
 }
 
-static void __pb_show_msg(const void *msg, const ProtobufCMessageDescriptor *md)
+static void pb_show_msg(const void *msg, const ProtobufCMessageDescriptor *md)
 {
 	int i;
 
@@ -158,12 +158,6 @@ static void __pb_show_msg(const void *msg, const ProtobufCMessageDescriptor *md)
 	}
 }
 
-void pb_show_msg(const void *msg, const void *msg_desc)
-{
-	__pb_show_msg(msg, msg_desc);
-	pr_msg("\n");
-}
-
 void do_pb_show_plain(int fd, const ProtobufCMessageDescriptor *md,
 		pb_unpack_t unpack, pb_free_t free)
 {
@@ -174,6 +168,7 @@ void do_pb_show_plain(int fd, const ProtobufCMessageDescriptor *md,
 			break;
 
 		pb_show_msg(obj, md);
+		pr_msg("\n");
 		free(obj, NULL);
 	}
 }


More information about the CRIU mailing list