From: Ian Campbell Subject: Re: [PATCH v5 03/12] libxl: ocaml: event management Date: Fri, 29 Nov 2013 08:40:38 +0000 Message-ID: <1385714438.23632.27.camel@dagon.hellion.org.uk> References: <1385488371-28875-1-git-send-email-rob.hoes@citrix.com> <1385488371-28875-4-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: <1385488371-28875-4-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: ian.jackson@citrix.com, dave.scott@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Tue, 2013-11-26 at 17:52 +0000, Rob Hoes wrote: > > +void async_callback(libxl_ctx *ctx, int rc, void *for_callback) > +{ > + CAMLparam0(); > + CAMLlocal1(error); > + int *task = (int *) for_callback; You don't seem to use this anywhere. > + static value *func = NULL; > + > + if (func == NULL) { > + /* First time around, lookup by name */ > + func = caml_named_value("libxl_async_callback"); > + } > + > + if (rc == 0) > + error = Val_none; > + else > + error = Val_some(Val_error(rc)); > + > + caml_callback2(*func, error, (value) for_callback); Is this cast OK or should you be declaring a CAMLlocal for this value? Ian.