From: Ian Jackson Subject: Re: [PATCH 2/6] libxl_json: Introduce libxl__json_object_to_yajl_gen. Date: Tue, 31 Jul 2012 15:19:41 +0100 Message-ID: <20503.59773.650177.831439@mariner.uk.xensource.com> References: <1343235857-15870-1-git-send-email-anthony.perard@citrix.com> <1343235857-15870-3-git-send-email-anthony.perard@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1343235857-15870-3-git-send-email-anthony.perard@citrix.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: Anthony PERARD Cc: Ian Campbell , Xen Devel List-Id: xen-devel@lists.xenproject.org Anthony PERARD writes ("[PATCH 2/6] libxl_json: Introduce libxl__json_object_to_yajl_gen."): > This function converts a libxl__json_object to yajl by calling every > yajl_gen_* function on a preallocated yajl_gen hand. I'm slightly concerned at the amount of boilerplateish code we're introducing here. Forgive my utter ignorance but is there not some more automatic way of handling all this ? At least it looks reasonably generic so if there is no better way to do it then fine. I have some more detailed comments: ... > +yajl_status libxl__json_object_to_yajl_gen(libxl__gc *gc, > + yajl_gen hand, > + libxl__json_object *obj) > +{ > + int index = 0; > + yajl_status rc; > + > + if (obj == NULL) > + return -1; Is this an expected situation ? Surely we should crash if we pass NULL rather than silently inventing an error code ? > + default: > + return -1; When might this occur ? Ian.