qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 03/16] sockets: allow port to be NULL when li


From: Daniel P. Berrange
Subject: Re: [Qemu-devel] [PATCH v2 03/16] sockets: allow port to be NULL when listening on IP address
Date: Thu, 22 Oct 2015 13:43:21 +0100
User-agent: Mutt/1.5.24 (2015-08-30)

On Thu, Oct 22, 2015 at 02:10:26PM +0200, Markus Armbruster wrote:
> Peter Maydell <address@hidden> writes:
> 
> > On 22 October 2015 at 10:43, Daniel P. Berrange <address@hidden> wrote:
> >> For reasons I don't understand, it appears that even string
> >> fields which are marked as optional get a 'has_XXX' flag,
> >> to distinguish betweeen a NULL string and an unset string.
> >> I struggle to imagine why we need this. It makes sense for
> >> integer/boolean types, but I would have thought just checking
> >> for NULL was sufficient for string types.
> >
> > I think the argument here is pure consistency. *Every* optional
> > field should be implemented as has_fieldname (bool) plus fieldname
> > (actual value). Special casing string types because we happen
> > to have a special value we can use to indicate 'no string'
> > seems to me like it would cause more confusion than it would
> > be worth.
> 
> Having a has_FOO for pointer-valued FOOs also causes confusion, because
> it begs questions like "does has_FOO imply FOO != NULL?" and "if
> !has_FOO, do I have to worry about freeing FOO?".
> 
> I believe we have these has_FOOs not because someone tried to minimize
> confusion, but due to laziness: it was simpler to blindly generate the
> has_FOO for every FOO.
> 
> Since I don't think distinguishing "pointer argument omitted" from
> "pointer argument is null" makes sense, I want the has_FOO killed for
> pointer FOOs.  Perhaps it's even in the QAPI review queue already, which
> Eric keeps filling faster than I can drain it :)

Yep, Eric just replied to my patch for this to the effect that he's
planning to fix this for 2.6. So we can just do this trivial revert
for 2.5 and fix it properly in 2.6


Regards,
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 :|



reply via email to

[Prev in Thread] Current Thread [Next in Thread]