On Mon, Nov 30, 2015 at 02:00:28PM +0100, Paolo Bonzini wrote:
> > +/* init dump state with specific status */
> > +static void dump_state_prepare(DumpState *s, DumpStatus status)
> > +{
> > + bzero(s, sizeof(*s));
> > + s->status = status;
>
> Either use memcpy, or
>
> s = (DumpState) { .status = status };
>
> The latter is C99 and it's quite common in QEMU.
Thanks to let me know this. :) Will use it in v4.
>
> > +}
> > +
> > +static DumpState *dump_state_get_global(void)
>
> No need for dump_state_get_global, just use a static variable. Then you
> can use &dump_state in qmp_dump_guest_memory.
Ok.
>
> > +{
> > + static DumpState state;
>
> You can also initialize it together with the definition, using
>
> static DumpState state = { .status = DUMP_STATUS_NONE };
>
Yes. Thanks.
Peter