[CRIU] [PATCH 1/3] show: Sanitze repeated fields showing routine
Cyrill Gorcunov
gorcunov at gmail.com
Thu Jul 10 12:20:04 PDT 2014
On Thu, Jul 10, 2014 at 05:08:34PM +0400, Pavel Emelyanov wrote:
> The existing code is quite strange -- it makes the first show outside
> of the loop, and check for the return code. I see no reasons for such
> loop breakage and the return code from show callbacks is always 0.
>
> Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
> ---
> protobuf.c | 21 +++++----------------
> 1 file changed, 5 insertions(+), 16 deletions(-)
>
> diff --git a/protobuf.c b/protobuf.c
> index 96f19e9..e7a4e64 100644
> --- a/protobuf.c
> +++ b/protobuf.c
> @@ -351,7 +351,6 @@ static void pb_show_repeated(const ProtobufCFieldDescriptor *fd, pb_pr_ctl_t *ct
> {
> pb_pr_field_t *field = &ctl->cur;
> unsigned long counter;
> - int done;
>
> if (nr_fields == 0) {
> pr_msg("<empty>");
> @@ -362,29 +361,19 @@ static void pb_show_repeated(const ProtobufCFieldDescriptor *fd, pb_pr_ctl_t *ct
> void *p = field->data;
>
> field->count = nr_fields;
> - field->data = (void *)(*(long *)p);
> - done = show(field);
> - if (done)
> - return;
> -
Once you dropped pr_msg(":") -- we no longer see
this separator for repeated fields.
Before this patch
xmm_space: 0:0xff:0:0:0x67616c66:0x54445a00:0x45525f4d:0x43455845:0:0xffffff00:0xffff:0:0xff00:0xffff0000:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0xff000000:0xff0000:0:0:0:0:0:0:0:0:0:0:0:0
After this patch
xmm_space: 00xff000x67616c660x54445a000x45525f4d0x4345584500xffffff000xffff00xff000xffff00000000000000000000000000000000000000000xff0000000xff0000000000000000
Nak.
More information about the CRIU
mailing list