On Fri, 2014-05-30 at 16:45 -0300, Eduardo Habkost wrote: > On Mon, May 26, 2014 at 03:40:58PM +0300, Marcel Apfelbaum wrote: > > Make machine's QemuOpts QOM properties of machine. The properties > > are automatically filled in. This opens the possiblity to create > > opts per machine rather than global. > > > > Signed-off-by: Marcel Apfelbaum <marce...@redhat.com> > > --- > > hw/core/machine.c | 256 > > ++++++++++++++++++++++++++++++++++++++++++++++++++++ > > include/hw/boards.h | 6 +- > > vl.c | 10 +- > > 3 files changed, 266 insertions(+), 6 deletions(-) > > > > diff --git a/hw/core/machine.c b/hw/core/machine.c > > index d3ffef7..dbcf2a1 100644 > > --- a/hw/core/machine.c > > +++ b/hw/core/machine.c > > @@ -11,6 +11,260 @@ > > */ > > > > #include "hw/boards.h" > > +#include "qapi/visitor.h" > > + > > +static char *machine_get_accel(Object *obj, Error **errp) > > +{ > > + MachineState *ms = MACHINE(obj); > > + return g_strdup(ms->accel); > > +} > > + > > +static void machine_set_accel(Object *obj, const char *value, Error **errp) > > +{ > > + MachineState *ms = MACHINE(obj); > > + ms->accel = g_strdup(value); > > +} > > You are not freeing the old value here and on the other string setters. It seems to be the caller responsibility. > > (Do we have some existing common wrapper to automatically free the old > value and set the new one, or every setter should duplicate the same > free/strdup logic?) We don't have yet, from what I know, and this is for the moment the QMP way to handle string attributes.
Thanks, Marcel >