[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v4 26/27] libxl: ocaml: use CAMLlocal1 macro rather than value-type in auto-generated C-code



Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx>
Acked-by: David Scott <dave.scott@xxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/ocaml/libs/xl/genwrap.py |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/libs/xl/genwrap.py b/tools/ocaml/libs/xl/genwrap.py
index 5c478e1..5e43831 100644
--- a/tools/ocaml/libs/xl/genwrap.py
+++ b/tools/ocaml/libs/xl/genwrap.py
@@ -356,7 +356,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)
@@ -406,7 +406,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))
         
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.