From: Wei Liu Subject: Re: [PATCH V5 20/32] libxl IDL: generate code to parse libxl__json_object to libxl_FOO struct Date: Sun, 1 Jun 2014 18:43:53 +0100 Message-ID: <20140601174353.GA25584@zion.uk.xensource.com> References: <1400018054-26038-1-git-send-email-wei.liu2@citrix.com> <1400018054-26038-21-git-send-email-wei.liu2@citrix.com> <1400592902.6946.53.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1400592902.6946.53.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: ian.jackson@eu.citrix.com, Wei Liu , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Tue, May 20, 2014 at 02:35:02PM +0100, Ian Campbell wrote: > On Tue, 2014-05-13 at 22:54 +0100, Wei Liu wrote: > > libxl_FOO_parse_json functions are generated. > > > > Note that these functions are used to parse libxl__json_object to > > libxl__FOO struct. They don't consume JSON string. > > > > Signed-off-by: Wei Liu > > I eyeballed this again and the only query I have is this: > > + if (libxl__json_map_get("enable", o, JSON_STRING)) { > + x = libxl__json_map_get("enable", o, JSON_STRING); > > These two get calls are a bit redundant. > > Looking at the code generator I don't think it forces this on you and > you could arrange instead for: > x = libxl__json_map_get("enable", o, JSON_STRING); > if (x) { > ... > > Perhaps you need to save x in a new local parent so you can restore it > in that case. > saved_parent = x; > x = libxl__json_map_get("enable", o, JSON_STRING); > if (x) { > ... > } > x = saved_parent; > Done. Wei.