[CRIU] [PATCH v2 04/13] protobuf: structure for currently showing
field introduced
Kinsbursky Stanislav
skinsbursky at openvz.org
Mon Aug 6 12:11:16 EDT 2012
From: Stanislav Kinsbursky <skinsbursky at openvz.org>
"depth" variable was moved to field structure.
Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
protobuf.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
-------------- next part --------------
diff --git a/protobuf.c b/protobuf.c
index 869c95d..d4d2e3d 100644
--- a/protobuf.c
+++ b/protobuf.c
@@ -20,10 +20,16 @@
*/
#define PB_PKOBJ_LOCAL_SIZE 1024
+struct pb_pr_field_s {
+ int depth;
+};
+
+typedef struct pb_pr_field_s pb_pr_field_t;
+
struct pb_pr_ctrl_s {
void *arg;
int single_entry;
- int depth;
+ pb_pr_field_t cur;
};
typedef struct pb_pr_ctrl_s pb_pr_ctl_t;
@@ -51,7 +57,7 @@ static void pb_msg_unk(void *obj, pb_pr_ctl_t *ctl)
static inline void print_tabs(pb_pr_ctl_t *ctl)
{
- int counter = ctl->depth;
+ int counter = ctl->cur.depth;
if (!ctl->single_entry)
return;
@@ -72,9 +78,9 @@ static void pb_show_msg(const void *msg, pb_pr_ctl_t *ctl);
static void show_nested_message(void *msg, pb_pr_ctl_t *ctl)
{
print_nested_message_braces(ctl, 0);
- ctl->depth++;
+ ctl->cur.depth++;
pb_show_msg(msg, ctl);
- ctl->depth--;
+ ctl->cur.depth--;
print_nested_message_braces(ctl, 1);
}
@@ -218,7 +224,7 @@ void do_pb_show_plain(int fd, const ProtobufCMessageDescriptor *md,
void (*payload_hadler)(int fd, void *obj, int flags),
int flags)
{
- pb_pr_ctl_t ctl = {NULL, single_entry, 0};
+ pb_pr_ctl_t ctl = {NULL, single_entry};
void (*handle_payload)(int fd, void *obj, int flags);
handle_payload = (payload_hadler) ? : pb_no_payload;
More information about the CRIU
mailing list