From: Ian Campbell Subject: Re: [PATCH v2-resend 18/30] libxl: ocaml: use the "string option" type for IDL strings Date: Wed, 28 Aug 2013 11:41:58 +0100 Message-ID: <1377686518.29147.75.camel@kazak.uk.xensource.com> References: <1377168678-25492-1-git-send-email-rob.hoes@citrix.com> <1377168678-25492-19-git-send-email-rob.hoes@citrix.com> <21020.58737.153432.432094@mariner.uk.xensource.com> <1377678609.29147.71.camel@kazak.uk.xensource.com> <21021.53777.29231.304547@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <21021.53777.29231.304547@mariner.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 Jackson Cc: Rob Hoes , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Wed, 2013-08-28 at 11:33 +0100, Ian Jackson wrote: > Ian Campbell writes ("Re: [Xen-devel] [PATCH v2-resend 18/30] libxl: ocaml: use the "string option" type for IDL strings"): > > On Tue, 2013-08-27 at 18:44 +0100, Ian Jackson wrote: > > > Can you point me to the existing code this replaces ? I was looking > > > for "Val_string" and "String_val" but couldn't find them. I think if > > > that code is missing it deserves a note in the commit message at least > > > (and then surely this new code is currently unused?) > > > > - "char *": ("string", "%(c)s = dup_String_val(%(o)s)", "caml_copy_string(%(c)s)"), > > + "char *": ("string option", "%(c)s = String_option_val(%(o)s)", "Val_string_option(%(c)s)"), > > > > So it is replacing uses of dup_String_val (existing function in > > tools/ocaml/libs/xl/xenlight_stubs.c) and caml_copy_string (which is an > > ocaml provided primitive) with newly defined String_option_val and > > Val_string_option which wrap those original function with the Some/None > > semantics. > > I was looking for "String_val", for example. Am I wrote to be looking > for that ? The diff snippet I quoted uses dup_String_val not String_val, so yes I think so. The second and third elements of the tuple are the marshal/unmarshal code for the type. Ian.