[libvirt] [RFC] virCommandRun return error number
Daniel P. Berrange
berrange at redhat.com
Thu Apr 11 14:59:32 UTC 2013
On Thu, Apr 11, 2013 at 10:48:05PM +0800, harryxiyou wrote:
> On Thu, Apr 11, 2013 at 10:26 PM, Eric Blake <eblake at redhat.com> wrote:
>
> Hi Eric,
>
> [...]
> > Not necessary. virCommand is DESIGNED for streamlined usage, so that it
> > is much easier to read how the command is constructed without being
> > distracted by error checking in the caller every step of the way. As a
> > virCommandPtr has no semantic impact until it is run, it is sufficient
> > to delay error checking until the caller is actually ready to run the
> > command. Therefore, we wrote virCommandRun() to specifically check for
> > NULL, and report an error at that time, so that the caller need not
> > worry about virCommandNew* returning NULL.
> >
> > No bug here.
> >
>
> ACK.
> However, we really need not do the following stuffs. It may affect
> efficiencies. Maybe i have thought more about this matter.
The question of efficiency is irrelevant in this context. We are
explicitly choosing to prioritize reliability and readability of
the code here.
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