summaryrefslogtreecommitdiffstats
path: root/ocaml/guestfs_c.c
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-04-10 18:25:07 +0100
committerRichard Jones <rjones@redhat.com>2009-04-11 17:04:35 +0100
commitb4d2a01828e5de85e5eee3631f7fe3925a0312ca (patch)
tree6f77ecceccd53a84afce4cecf0fe199ba7707752 /ocaml/guestfs_c.c
parent99f68f259f92eee884c6c7396f61b9c16e2bf354 (diff)
downloadlibguestfs-b4d2a01828e5de85e5eee3631f7fe3925a0312ca.tar.gz
libguestfs-b4d2a01828e5de85e5eee3631f7fe3925a0312ca.tar.xz
libguestfs-b4d2a01828e5de85e5eee3631f7fe3925a0312ca.zip
Added test suite.
Diffstat (limited to 'ocaml/guestfs_c.c')
-rw-r--r--ocaml/guestfs_c.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/ocaml/guestfs_c.c b/ocaml/guestfs_c.c
index 600440c9..291c4308 100644
--- a/ocaml/guestfs_c.c
+++ b/ocaml/guestfs_c.c
@@ -119,3 +119,29 @@ ocaml_guestfs_close (value gv)
CAMLreturn (Val_unit);
}
+
+/* Copy string array value. */
+char **
+ocaml_guestfs_strings_val (value sv)
+{
+ CAMLparam1 (sv);
+ char **r;
+ int i;
+
+ r = malloc (sizeof (char *) * (Wosize_val (sv) + 1));
+ for (i = 0; i < Wosize_val (sv); ++i)
+ r[i] = String_val (Field (sv, i));
+ r[i] = NULL;
+
+ CAMLreturnT (char **, r);
+}
+
+/* Free array of strings. */
+void
+ocaml_guestfs_free_strings (char **argv)
+{
+ /* Don't free the actual strings - they are String_vals on
+ * the OCaml heap.
+ */
+ free (argv);
+}