<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 8/11/2016 9:54 PM, Martin Kletzander
wrote:<br>
</div>
<blockquote cite="mid:20160811135459.GD5667@wheatley" type="cite">On
Thu, Aug 11, 2016 at 10:46:28AM +0100, Daniel P. Berrange wrote:
<br>
<blockquote type="cite">On Thu, Aug 11, 2016 at 05:39:06PM +0800,
Xian Han Yu wrote:
<br>
<blockquote type="cite">
<br>
<br>
On 8/11/2016 5:00 PM, Daniel P. Berrange wrote:
<br>
> On Thu, Aug 11, 2016 at 10:55:44AM +0200, Andrea
Bolognani wrote:
<br>
> > On Thu, 2016-08-11 at 14:48 +0800, Xian Han Yu
wrote:
<br>
> > > > The default is not OFF, though, it's
ABSENT :)
<br>
> > > > In fact, as far as I can tell, OFF isn't
ever used explicitly
<br>
> > > > either for assignment or comparison. And
false is plain wrong
<br>
> > > > from a datatype point of view.
<br>
> > > How about we change all three occurrences as
boris list above
<br>
> > > into VIR_TRISTATE_SWITCH_ABSENT.
<br>
> > Sure, that's exactly what I suggested :)
<br>
> IMHO, we should just do what Michael suggested right at
the start of this
<br>
> thread and use {0}, instead of manually initializing
each field to
<br>
> 0, or a constant hiding the 0.
<br>
<br>
That maybe change back again in the future, if this struct add
a new member
<br>
or current member need to be not zero-initialized.
<br>
</blockquote>
<br>
Lets do what makes sense now, not in some hypothetical future
that may
<br>
never happen.
<br>
<br>
</blockquote>
<br>
{0} will initialize the whole struct to zeroes as if you did
<br>
<br>
memset(&s, 0, sizeof(s));
<br>
<br>
and structures in libvirt are designed so that all zeroes are
defaults
<br>
unless there are virStructNew() functions that properly initialize
the
<br>
non-zero values. So this will work as long as this structure is
not the
<br>
exception (in which case we need to redo all the initializations
<br>
anyway). That's why {0} is the nicest solution, IMHO.
<br>
</blockquote>
<br>
OK, I understand, we will change these three initializations to {0}.<br>
<br>
Regards,
<br>
Xian Han<br>
<br>
<blockquote cite="mid:20160811135459.GD5667@wheatley" type="cite">
<br>
Martin (not Michal ;) )
<br>
<br>
<blockquote type="cite">Regards,
<br>
Daniel
<br>
--
<br>
|: <a class="moz-txt-link-freetext" href="http://berrange.com">http://berrange.com</a> -o-
<a class="moz-txt-link-freetext" href="http://www.flickr.com/photos/dberrange/">http://www.flickr.com/photos/dberrange/</a> :|
<br>
|: <a class="moz-txt-link-freetext" href="http://libvirt.org">http://libvirt.org</a> -o-
<a class="moz-txt-link-freetext" href="http://virt-manager.org">http://virt-manager.org</a> :|
<br>
|: <a class="moz-txt-link-freetext" href="http://autobuild.org">http://autobuild.org</a> -o-
<a class="moz-txt-link-freetext" href="http://search.cpan.org/~danberr/">http://search.cpan.org/~danberr/</a> :|
<br>
|: <a class="moz-txt-link-freetext" href="http://entangle-photo.org">http://entangle-photo.org</a> -o-
<a class="moz-txt-link-freetext" href="http://live.gnome.org/gtk-vnc">http://live.gnome.org/gtk-vnc</a> :|
<br>
<br>
--
<br>
libvir-list mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:libvir-list@redhat.com">libvir-list@redhat.com</a>
<br>
<a class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/libvir-list">https://www.redhat.com/mailman/listinfo/libvir-list</a>
<br>
</blockquote>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">--
libvir-list mailing list
<a class="moz-txt-link-abbreviated" href="mailto:libvir-list@redhat.com">libvir-list@redhat.com</a>
<a class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/libvir-list">https://www.redhat.com/mailman/listinfo/libvir-list</a></pre>
</blockquote>
<br>
</body>
</html>