[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [RFC] virCommandRun return error number



On Thu, Apr 11, 2013 at 10:48:05PM +0800, harryxiyou wrote:
> On Thu, Apr 11, 2013 at 10:26 PM, Eric Blake <eblake 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 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]