On 01/27/2016 04:29 PM, zhanghailiang wrote: > Make the helper object_create() public and fix its first > parameter to accept NULL value.
Looks not very nice. Maybe pass a new predicate func for sanity check it better. > > Signed-off-by: zhanghailiang <zhang.zhanghaili...@huawei.com> > Cc: Paolo Bonzini <pbonz...@redhat.com> > --- > v2: > - New patch > --- > include/qemu-common.h | 2 ++ > vl.c | 4 ++-- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/include/qemu-common.h b/include/qemu-common.h > index 22b010c..52cf4fd 100644 > --- a/include/qemu-common.h > +++ b/include/qemu-common.h > @@ -500,4 +500,6 @@ int parse_debug_env(const char *name, int max, int > initial); > const char *qemu_ether_ntoa(const MACAddr *mac); > void page_size_init(void); > > +int object_create(void *opaque, QemuOpts *opts, Error **errp); > + > #endif > diff --git a/vl.c b/vl.c > index f043009..b21335e 100644 > --- a/vl.c > +++ b/vl.c > @@ -2819,7 +2819,7 @@ static bool object_create_delayed(const char *type) > } > > > -static int object_create(void *opaque, QemuOpts *opts, Error **errp) > +int object_create(void *opaque, QemuOpts *opts, Error **errp) > { > Error *err = NULL; > char *type = NULL; > @@ -2842,7 +2842,7 @@ static int object_create(void *opaque, QemuOpts *opts, > Error **errp) > if (err) { > goto out; > } > - if (!type_predicate(type)) { > + if (type_predicate && !type_predicate(type)) { > goto out; > } >