From: Rob Hoes Date: Wed, 6 Nov 2013 17:50:04 +0000 (+0000) Subject: libxl: ocaml: use CAMLlocal1 macro rather than value-type in auto-generated C-code X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~6013 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b376f74e504c1258045e1ef97af1ae42cb267842;p=xen.git libxl: ocaml: use CAMLlocal1 macro rather than value-type in auto-generated C-code Signed-off-by: Rob Hoes Acked-by: David Scott Acked-by: Ian Campbell --- diff --git a/tools/ocaml/libs/xl/genwrap.py b/tools/ocaml/libs/xl/genwrap.py index 0bb636ae61..f5d2224c26 100644 --- a/tools/ocaml/libs/xl/genwrap.py +++ b/tools/ocaml/libs/xl/genwrap.py @@ -353,7 +353,7 @@ def ocaml_Val(ty, o, c, indent="", parent = None): elif isinstance(ty, idl.Array): s += "{\n" s += "\t int i;\n" - s += "\t value array_elem;\n" + s += "\t CAMLlocal1(array_elem);\n" s += "\t %s = caml_alloc(%s,0);\n" % (o, parent + ty.lenvar.name) s += "\t for(i=0; i<%s; i++) {\n" % (parent + ty.lenvar.name) s += "\t %s\n" % ocaml_Val(ty.elem_type, "array_elem", c + "[i]", "", parent=parent) @@ -403,7 +403,7 @@ def ocaml_Val(ty, o, c, indent="", parent = None): fn = "anon_field" else: fn = "%s_field" % ty.rawname - s += "\tvalue %s;\n" % fn + s += "\tCAMLlocal1(%s);\n" % fn s += "\n" s += "\t%s = caml_alloc_tuple(%d);\n" % (o, len(ty.fields))