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

Re: [Xen-devel] [PATCH v6 11/18] libxl/gentypes.py: don't generate default values



On Tue, Jun 10, 2014 at 04:54:26PM +0100, Ian Campbell wrote:
[...]
> > > > IIRC with this line Enumeration type doesn't have a default value.
> > >            ^out (per your other mail)
> > > 
> > > It should be None, which I think is set by the following Type.__init__.
> > > 
> > 
> > Yes, it's None if it's not explicitly set.
> > 
> > If I make get_init_val function return 0 when it encounters None then I
> > don't need this hunk anymore.
> 
> I think it should return None in this case and then you use
>       if init_val:
>           s += "if (%s != %s) {\n" % (fexpr, init_val)
>       else: 
>           s += "if (%s) {\n" % (fexpr)
> 
> as discussed previously. Or maybe you could make get_init_val return the
> complete appropriate expression and call it get_default_expr (or
> something better than that)
> 

Oh I was talking nonsense in my previous email. get_init_val is in fact
returning the expression and your suggestion to change it to
get_default_expr is good. Anyway, I will figure this out.  Sorry for the
confusion.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.