From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58024) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpFDN-0000gB-IB for qemu-devel@nongnu.org; Thu, 22 Oct 2015 08:43:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZpFDK-0002t9-Al for qemu-devel@nongnu.org; Thu, 22 Oct 2015 08:43:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51749) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpFDK-0002t5-55 for qemu-devel@nongnu.org; Thu, 22 Oct 2015 08:43:26 -0400 Date: Thu, 22 Oct 2015 13:43:21 +0100 From: "Daniel P. Berrange" Message-ID: <20151022124321.GG9079@redhat.com> References: <1444648509-29179-1-git-send-email-berrange@redhat.com> <1444648509-29179-4-git-send-email-berrange@redhat.com> <1445449978.7681.367.camel@ifi.uio.no> <20151022094330.GD9079@redhat.com> <878u6v6r4d.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <878u6v6r4d.fsf@blackfin.pond.sub.org> Subject: Re: [Qemu-devel] [PATCH v2 03/16] sockets: allow port to be NULL when listening on IP address Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Peter Maydell , QEMU Developers , "Dr. David Alan Gilbert" , Paolo Bonzini , Knut Omang On Thu, Oct 22, 2015 at 02:10:26PM +0200, Markus Armbruster wrote: > Peter Maydell writes: > > > On 22 October 2015 at 10:43, Daniel P. Berrange 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 :|