From: Ian Campbell Subject: Re: [PATCH 19/28] libxl: ocaml: add dominfo_list and dominfo_get Date: Thu, 11 Apr 2013 12:23:44 +0100 Message-ID: <1365679424.8036.82.camel@zakaz.uk.xensource.com> References: <1364222729-6982-1-git-send-email-rob.hoes@citrix.com> <1364222729-6982-20-git-send-email-rob.hoes@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1364222729-6982-20-git-send-email-rob.hoes@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: Rob Hoes Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Mon, 2013-03-25 at 14:45 +0000, Rob Hoes wrote: > +value stub_xl_dominfo_list(value ctx) > +{ > + CAMLparam1(ctx); > + CAMLlocal2(domlist, temp); > + libxl_dominfo *c_domlist; > + int i, nb; > + > + c_domlist = libxl_list_domain(CTX, &nb); > + if (!c_domlist) > + failwith_xl(ERROR_FAIL, "dominfo_list"); > + > + domlist = temp = Val_emptylist; > + for (i = nb - 1; i >= 0; i--) { > + domlist = caml_alloc_small(2, Tag_cons); > + Field(domlist, 0) = Val_int(0); > + Field(domlist, 1) = temp; > + temp = domlist; > + > + Store_field(domlist, 0, Val_dominfo(&c_domlist[i])); Is the preceding "Field(domlist, 0) = Val_int(0);" storing to the same place and therefore redundant? > + } > + > + libxl_dominfo_list_free(c_domlist, nb); > + > + CAMLreturn(domlist); > +}