search for: iteri

Displaying 20 results from an estimated 133 matches for "iteri".

Did you mean: iter
2009 Sep 11
3
[PATCH] generator.ml: Fix string list memory leak
...t; int %s;\n" n | Int n -> pr " int %s;\n" n ) (snd style); @@ -6364,6 +6364,20 @@ and generate_fish_cmds () = generate_c_call_args ~handle:"g" style; pr ";\n"; + (* XXX: There must be a cleaner way to write this *) + iteri ( + fun i -> + function + | StringList name | DeviceList name -> + pr " char **%s_i = %s;\n" name name; + pr " while(*%s_i) {\n" name; + pr " free(*%s_i);\n" name; + pr "...
2013 Nov 06
2
Re: Problem using virt-sysprep with RBD images
...7;root/libguestfs-1.25.6/builder' ocamlfind ocamlopt -g -warn-error CDEFLMPSUVYZX -package str,unix -I ../src/.libs -I ../ocaml -I ../mllib -package gettext-stub -c builder.ml -o builder.cmx File "builder.ml", line 53, characters 4-14: Error: Unbound value List.iteri make[2]: *** [builder.cmx] Error 2 make[2]: Leaving directory `/root/libguestfs-1.25.6/builder' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/root/libguestfs-1.25.6' make: *** [all] Error 2 Can you provide some assistance resolving this compile error...
2014 Oct 10
0
[PATCH 3/3] builder: use the JSON module
...tf_int64 key = function - | None -> () - | Some n -> - printf " \"%s\": \"%Ld\",\n" key n in - let json_optional_printf_stringlist key = function - | None -> () - | Some l -> - printf " \"%s\": [" key; - iteri ( - fun i alias -> - printf " \"%s\"%s" alias (trailing_comma i (List.length l)) - ) l; - printf " ],\n" in - let print_notes = function - | [] -> () - | notes -> - printf " \"notes\": {\n"; - i...
2013 Nov 06
0
Re: Problem using virt-sysprep with RBD images
...5.6/builder' > ocamlfind ocamlopt -g -warn-error CDEFLMPSUVYZX -package str,unix -I > ../src/.libs -I ../ocaml -I ../mllib -package gettext-stub -c builder.ml -o > builder.cmx > File "builder.ml", line 53, characters 4-14: > Error: Unbound value List.iteri > make[2]: *** [builder.cmx] Error 2 > make[2]: Leaving directory `/root/libguestfs-1.25.6/builder' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/root/libguestfs-1.25.6' > make: *** [all] Error 2 Hmm, this is actually another bug :...
2017 Oct 08
0
[PATCH v2 1/4] common/mlstdutils: Extend the List module.
...ns on lists which are not provided by the standard library. As with Char and String, let's extend List to add these new functions to a List pseudo-module (really Std_utils.List, but called List when you ‘open Std_utils’). The initial exported functions are all List functions from OCaml 3.11 + iteri + mapi. We can add other functions as needed. --- common/mlstdutils/std_utils.ml | 4 ++++ common/mlstdutils/std_utils.mli | 47 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/common/mlstdutils/std_utils.ml b/common/...
2017 Nov 07
1
Re: [PATCH v2 1/4] common/mlstdutils: Extend the List module.
...ided by > the standard library. As with Char and String, let's extend List to > add these new functions to a List pseudo-module (really > Std_utils.List, but called List when you ‘open Std_utils’). > > The initial exported functions are all List functions from OCaml 3.11 > + iteri + mapi. We can add other functions as needed. > --- My worry about this is that: - OCaml does not have OOTB support for conditional code depending on the version - the interface of the List module would get "frozen" this way, and overrides the module in the standard library then...
2020 Sep 06
0
[libnbd PATCH 3/3] ocaml: Typesafe returns for REnum/RFlags
...erences this type. + *) + pr "static value __attribute__ ((unused))\n"; + pr "Val_%s (int i)\n" enum_prefix; + pr "{\n"; + pr " CAMLparam0 ();\n"; + pr " CAMLlocal1 (rv);\n"; + pr "\n"; + pr " switch (i) {\n"; + List.iteri ( + fun i (enum, _) -> + pr " case LIBNBD_%s_%s: rv = Val_int (%d); break;\n" enum_prefix enum i + ) enums; + (* Possible if newer libnbd returns value not present in older compilation *) + pr " default: abort ();\n"; + pr " }\n"; + pr "\n&quo...
2020 Sep 07
4
[libnbd PATCH v2 0/3] Improve type-safety of ocaml/golang getters
Well, the golang changes (patch 1 and 2/3 of v1) were already committed, all that was left was the OCaml changes. I'm a lot happier with how things turned out with an UNKNOWN constructor in the OCaml variants. Eric Blake (3): tests: Enhance coverage of enum/flag range checking ocaml: Support unknown values for Enum/Flags ocaml: Typesafe returns for REnum/RFlags
2020 Sep 07
0
[libnbd PATCH v2 3/3] ocaml: Typesafe returns for REnum/RFlags
...%s.t. */\n" enum_prefix; + pr "static value\n"; + pr "Val_%s (int i)\n" enum_prefix; + pr "{\n"; + pr " CAMLparam0 ();\n"; + pr " CAMLlocal1 (rv);\n"; + pr "\n"; + pr " switch (i) {\n"; + List.iteri ( + fun i (enum, _) -> + pr " case LIBNBD_%s_%s: rv = Val_int (%d); break;\n" enum_prefix enum i + ) enums; + pr " default:\n"; + pr " rv = caml_alloc (1, 0); /* UNKNOWN of int */\n"; + pr " Store_field (rv, 0, Val_int...
2014 Jan 16
0
[PATCH 3/3] builder: add a JSON output for --list
..._int64 key value = + match value with + | None -> () + | Some n -> + printf " \"%s\": \"%Ld\",\n" key n in + + printf "{\n"; + printf " \"version\": %d,\n" 1; + printf " \"sources\": [\n"; + iteri ( + fun i (source, fingerprint) -> + printf " {\n"; + printf " \"uri\": \"%s\",\n" source; + printf " \"fingerprint\": \"%s\"\n" fingerprint; + printf " }%s\n" (trailing_comma i (List.l...
2009 Aug 17
1
two more warning-avoidance patches
...t test_name cmd = fun i str -> pr " const char *%s_%d = \"%s\";\n" n i (c_quote str); ) strs; - pr " const char *%s[] = {\n" n; + pr " const char *const %s[] = {\n" n; iteri ( fun i _ -> pr " %s_%d,\n" n i ) strs; @@ -5912,7 +5912,7 @@ and generate_test_command_call ?(expect_error = false) ?test test_name cmd = | FileIn _, arg | FileOut _, arg -> pr ", \"%s\"" (c_quote arg)...
2017 May 04
1
[PATCH] perl: drop %guestfs_introspection stuff
...-> pr "[ '%s', 'int', %d ]" n i - | Int64 n -> pr "[ '%s', 'int64', %d ]" n i - | Pointer (t, n) -> pr "[ '%s', 'pointer(%s)', %d ]" n t i - in - pr " args => [\n"; - iteri (fun i arg -> - pr " "; - pr_type i arg; - pr ",\n" - ) args; - pr " ],\n"; - if optargs <> [] then ( - pr " optargs => {\n"; - iteri (fun i arg -> - pr " %s =>...
2014 Oct 10
4
[PATCH 1/3] Move JSON to mllib
Move the simple OCaml JSON writer to mllib, so that can be enhanced and used also outside v2v. --- mllib/JSON.ml | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ mllib/JSON.mli | 26 ++++++++++++++++++++++++++ mllib/Makefile.am | 5 ++++- po/POTFILES-ml | 2 +- v2v/JSON.ml | 53 ----------------------------------------------------- v2v/JSON.mli
2019 Feb 25
0
[PATCH 3/3] v2v: add -o json output mode
...| BusSlotRemovable { s_removable_type = Floppy } -> + let floppy = [ + "type", JSON.String "floppy"; + "dev", JSON.String (drive_prefix ^ drive_name i); + ] in + + List.push_back removables (JSON.Dict floppy) + in + + Array.iteri (iter_bus "virtio" "vd") target_buses.target_virtio_blk_bus; + Array.iteri (iter_bus "ide" "hd") target_buses.target_ide_bus; + Array.iteri (iter_bus "scsi" "sd") target_buses.target_scsi_bus; + Array.iteri (iter_bus "floppy&...
2019 Mar 29
0
[PATCH v2 3/3] v2v: add -o json output mode
...| BusSlotRemovable { s_removable_type = Floppy } -> + let floppy = [ + "type", JSON.String "floppy"; + "dev", JSON.String (drive_prefix ^ drive_name i); + ] in + + List.push_back removables (JSON.Dict floppy) + in + + Array.iteri (iter_bus "virtio" "vd") target_buses.target_virtio_blk_bus; + Array.iteri (iter_bus "ide" "hd") target_buses.target_ide_bus; + Array.iteri (iter_bus "scsi" "sd") target_buses.target_scsi_bus; + Array.iteri (iter_bus "floppy&...
2018 Feb 18
0
[PATCH 2/3] v2v: ovf: Create OVF more aligned with the standard
...["ovf:Envelope"; "Content"; "Section"] in + try find_node_by_attr sections ("xsi:type", "ovf:VirtualHardwareSection_Type") + with Not_found -> assert false in (* Iterate over the disks, adding them to the OVF document. *) List.iteri ( @@ -489,7 +523,12 @@ and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids ovf = let is_bootable_drive = i == 0 in let boot_order = i+1 in - let fileref = sprintf "%s/%s" image_uuid vol_uuid in + let fileref = + if rhv_export_fla...
2013 Nov 06
3
Re: Problem using virt-sysprep with RBD images
...; > ocamlfind ocamlopt -g -warn-error CDEFLMPSUVYZX -package str,unix -I > > ../src/.libs -I ../ocaml -I ../mllib -package gettext-stub -c builder.ml-o > > builder.cmx > > File "builder.ml", line 53, characters 4-14: > > Error: Unbound value List.iteri > > make[2]: *** [builder.cmx] Error 2 > > make[2]: Leaving directory `/root/libguestfs-1.25.6/builder' > > make[1]: *** [all-recursive] Error 1 > > make[1]: Leaving directory `/root/libguestfs-1.25.6' > > make: *** [all] Error 2 > > H...
2014 May 26
2
[PATCH] builder: support aliases for images (RHBZ#1098718).
...s_json ~sources index = | None -> () | Some n -> printf " \"%s\": \"%Ld\",\n" key n in + let json_optional_printf_stringlist key = function + | None -> () + | Some l -> + printf " \"%s\": [" key; + iteri ( + fun i alias -> + printf " \"%s\"%s" alias (trailing_comma i (List.length l)) + ) l; + printf " ],\n" in let print_notes = function | [] -> () | notes -> @@ -156,6 +171,7 @@ and list_entries_json ~sources index =...
2016 Dec 08
4
[PATCH] generator: Share Common_utils code.
...et, args, optargs as style; deprecated_by = deprecated_by } = - pr "#define GUESTFS_HAVE_%s 1\n" (String.uppercase shortname); + pr "#define GUESTFS_HAVE_%s 1\n" (String.uppercase_ascii shortname); if optargs <> [] then ( iteri ( fun i argt -> - let uc_shortname = String.uppercase shortname in + let uc_shortname = String.uppercase_ascii shortname in let n = name_of_optargt argt in - let uc_n = String.uppercase n in + let uc_n = String.uppercase_ascii n in...
2017 Mar 03
1
[PATCH] erlang: Rename 'message' to something less generic.
...erl_interface. c_function = c_function; c_optarg_prefix = c_optarg_prefix } -> pr "\n"; pr "ETERM *\n"; - pr "run_%s (ETERM *message)\n" name; + pr "run_%s (ETERM *args_tuple)\n" name; pr "{\n"; iteri ( @@ -546,11 +546,11 @@ instead of erl_interface. #include \"actions.h\" ETERM * -dispatch (ETERM *message) +dispatch (ETERM *args_tuple) { ETERM *fun; - fun = ERL_TUPLE_ELEMENT (message, 0); + fun = ERL_TUPLE_ELEMENT (args_tuple, 0); /* XXX We should use gperf here....