[libvirt] [PATCH 5/5] Add a qemuMonitorGetMachines() method for query-machines command

Daniel P. Berrange berrange at redhat.com
Mon Aug 20 16:57:08 UTC 2012


On Mon, Aug 20, 2012 at 10:54:47AM -0600, Eric Blake wrote:
> On 08/20/2012 07:49 AM, Daniel P. Berrange wrote:
> > +++ b/tests/qemumonitorjsontest.c
> > @@ -224,6 +224,81 @@ cleanup:
> >  }
> >  
> >  static int
> > +testQemuMonitorJSONGetMachines(const void *data)
> > +{
> > +    virCapsPtr caps = (virCapsPtr)data;
> > +    qemuMonitorTestPtr test = qemuMonitorTestNew(true, caps);
> > +    int ret = -1;
> > +    qemuMonitorMachineInfoPtr *info;
> > +    int ninfo;
> > +    const char *null = NULL;
> 
> Why did you need this?
> 
> 
> > +        if (STRNEQ_NULLABLE(info[i]->alias, (wantalias))) {             \
> > +            virReportError(VIR_ERR_INTERNAL_ERROR,                      \
> > +                           "alias %s is not %s",                        \
> > +                           info[i]->alias, NULLSTR(wantalias));         \
> > +            goto cleanup;                                               \
> > +        }                                                               \
> > +    } while (0)
> > +
> > +    CHECK(0, "pc-1.0", false, null);
> 
> Can't you just s/null/NULL/ and avoid the intermediate variable?

I hit some GCC-wierdness when doing that:

  CC     qemumonitorjsontest-qemumonitorjsontest.o
qemumonitorjsontest.c: In function 'testQemuMonitorJSONGetMachines':
qemumonitorjsontest.c:289:5: error: null argument where non-null required (argument 1) [-Werror=nonnull]
qemumonitorjsontest.c:289:5: error: null argument where non-null required (argument 1) [-Werror=nonnull]
qemumonitorjsontest.c:289:5: error: null argument where non-null required (argument 2) [-Werror=nonnull]
qemumonitorjsontest.c:289:5: error: null argument where non-null required (argument 2) [-Werror=nonnull]
qemumonitorjsontest.c:289:5: error: null argument where non-null required (argument 1) [-Werror=nonnull]
qemumonitorjsontest.c:289:5: error: null argument where non-null required (argument 1) [-Werror=nonnull]
qemumonitorjsontest.c:289:5: error: null argument where non-null required (argument 2) [-Werror=nonnull]
qemumonitorjsontest.c:289:5: error: null argument where non-null required (argument 2) [-Werror=nonnull]
qemumonitorjsontest.c:289:5: error: invalid application of 'sizeof' to a void type [-Werror=pointer-arith]


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list