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

Re: [Xen-devel] [PATCH v3 11/15] libxl: refactor libxl_get_memory_target



On Tue, Sep 09, 2014 at 12:39:05PM +0100, Ian Campbell wrote:
> On Tue, 2014-09-09 at 12:36 +0100, Ian Campbell wrote:
> > On Thu, 2014-09-04 at 23:43 +0100, Wei Liu wrote:
> > > +
> > > +    if (!get_target)
> > > +        *out_mem = max_memkb;
> > > +    else
> > > +        *out_mem = target_memkb;
> > 
> > Given that you are only going to return one or the other why do you go
> > to all the effort of reading both and converting them from string to int
> > etc?
> > 
> > Can't you just set the path to read from based on out_target at the top
> > (and maybe set a const char * what for logging purposes) and then the
> > rest of the function just deals with that doing a single conversion etc?
> 
> The caller in the next patch seems to want both values, so it calls this
> function twice, meaning that currently it is reading and parsing both
> values twice.
> 
> Depends on what other callers there are perhaps what you really want is
> a single helper to return both values at the same time, which accepts
> NULL for either of the output pointers.
> 

OK, I will rewrite it to return both values at the same time.

Wei.

> Ian.

_______________________________________________
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®.