search for: uppercase_ascii

Displaying 20 results from an estimated 51 matches for "uppercase_ascii".

2016 Dec 08
4
[PATCH] generator: Share Common_utils code.
..... (*</stdlib>*) and creates generator/common_utils.ml and generator/common_utils.mli from that. The effect is we only need to write utility functions once. As with other tools, we still have generator-specific utility functions in generator/utils.ml. Also in this change: - Use String.uppercase_ascii and String.lowercase_ascii in place of deprecated String.uppercase/String.lowercase. - Implement String.capitalize_ascii to replace deprecated String.capitalize. - Move isspace, isdigit, isxdigit functions to Char module. --- .gitignore | 3 + dib/utils.ml |...
2015 Oct 06
0
[PATCH 3/5] mllib: Add (Char|String).(lower|upper)case_ascii functions.
...- a/mllib/common_utils.ml +++ b/mllib/common_utils.ml @@ -22,10 +22,23 @@ open Common_gettext.Gettext module Char = struct include Char + + let lowercase_ascii c = + if (c >= 'A' && c <= 'Z') + then unsafe_chr (code c + 32) + else c + + let uppercase_ascii c = + if (c >= 'a' && c <= 'z') + then unsafe_chr (code c - 32) + else c end module String = struct include String + + let lowercase_ascii s = map Char.lowercase_ascii s + let uppercase_ascii s = map Char.uppercase_ascii s end let (//)...
2015 Oct 07
1
Re: [PATCH 3/5] mllib: Add (Char|String).(lower|upper)case_ascii functions.
...gt; @@ -22,10 +22,23 @@ open Common_gettext.Gettext > > module Char = struct > include Char > + > + let lowercase_ascii c = > + if (c >= 'A' && c <= 'Z') > + then unsafe_chr (code c + 32) > + else c > + > + let uppercase_ascii c = > + if (c >= 'a' && c <= 'z') > + then unsafe_chr (code c - 32) > + else c > end > > module String = struct > include String > + > + let lowercase_ascii s = map Char.lowercase_ascii s > + let uppercase_asc...
2016 Aug 25
1
[PATCH] mllib: Add String.map function for OCaml < 4.00.0.
...ct include String + let map f s = + let len = String.length s in + let b = Bytes.create len in + for i = 0 to len-1 do + Bytes.unsafe_set b i (f (unsafe_get s i)) + done; + Bytes.to_string b + let lowercase_ascii s = map Char.lowercase_ascii s let uppercase_ascii s = map Char.uppercase_ascii s diff --git a/mllib/common_utils.mli b/mllib/common_utils.mli index 4959de6..de95f9d 100644 --- a/mllib/common_utils.mli +++ b/mllib/common_utils.mli @@ -49,6 +49,8 @@ module String : sig val sub : string -> int -> int -> string val unsafe_get : st...
2016 Aug 25
1
[PATCH 1.32] mllib: Add String.map function for OCaml < 4.00.0.
Same patch as just posted, but this is the modified version required for the stable-1.32 branch. Rich.
2017 Mar 10
2
[PATCH 1/2] daemon: generate cleanup handlers for structs
...y the local variable at the end of the current scope. + */ + +#ifndef GUESTFS_DAEMON_STRUCTS_CLEANUPS_H_ +#define GUESTFS_DAEMON_STRUCTS_CLEANUPS_H_ + +#ifdef HAVE_ATTRIBUTE_CLEANUP +"; + + List.iter ( + fun { s_name = name } -> + pr "#define CLEANUP_FREE_%s \\\n" (String.uppercase_ascii name); + pr " __attribute__((cleanup(cleanup_free_int_%s)))\n" name; + pr "#define CLEANUP_FREE_%s_LIST \\\n" (String.uppercase_ascii name); + pr " __attribute__((cleanup(cleanup_free_int_%s_list)))\n" name + ) structs; + + pr "#else /* !HAVE_AT...
2018 May 03
1
[PATCH] daemon: fix memory allocation and leaks in OCaml stubs
...6898..265f0a475 100644 --- a/generator/daemon.ml +++ b/generator/daemon.ml @@ -605,16 +605,18 @@ let generate_daemon_caml_stubs () = (* Implement code for returning structs and struct lists. *) let emit_return_struct typ = let struc = Structs.lookup_struct typ in + let uc_typ = String.uppercase_ascii typ in pr "/* Implement RStruct (%S, _). */\n" typ; pr "static guestfs_int_%s *\n" typ; pr "return_%s (value retv)\n" typ; pr "{\n"; - pr " guestfs_int_%s *ret;\n" typ; + pr " CLEANUP_FREE_%s guestfs_int_%s *ret = NU...
2015 Oct 06
10
[PATCH 0/5] mllib: Hide bad String functions and miscellaneous refactoring.
Hide/prevent the use of bad string functions like String.lowercase. These are replaced by safe functions that won't break UTF-8 strings. Other miscellaneous refactoring. Rich.
2016 Oct 03
1
Re: [PATCH 2/3] v2v: linux: check also kernel config for modules
...(* What kernel/kernel-like packages are installed on the current guest? *) > let installed_kernels : kernel_info list = > let rex_ko = Str.regexp ".*\\.k?o\\(\\.xz\\)?$" in > + let check_config version feature = > + let prefix = "^CONFIG_" ^ String.uppercase_ascii feature ^ "=" in > + let lines = g#grep ~extended:true prefix ("/boot/config-" ^ version) in This could fail if the config file doesn't exist or has an unexpected name. I don't think we should fail in that case. I think what we should do is put the config file...
2019 Jun 03
1
[libnbd PATCH] generator: Add #define witnesses for all API
...rator/generator b/generator/generator index db7c10f..7d0ea3f 100755 --- a/generator/generator +++ b/generator/generator @@ -2712,6 +2712,12 @@ let print_extern name args ret = print_call name args ret; pr ";\n" +let print_extern_and_define name args ret = + let name_upper = String.uppercase_ascii name in + print_extern name args ret; + pr "#define LIBNBD_HAVE_NBD_%s 1\n" name_upper; + pr "\n" + let generate_include_libnbd_h () = generate_header CStyle; @@ -2729,14 +2735,23 @@ let generate_include_libnbd_h () = List.iter (fun (n, i) -> pr "#define LIBNB...
2016 Aug 26
1
Re: [PATCH v2 5/7] v2v: linux: check also kernel config for modules
...(* What kernel/kernel-like packages are installed on the current guest? *) > let installed_kernels : kernel_info list = > let rex_ko = Str.regexp ".*\\.k?o\\(\\.xz\\)?$" in > + let check_config version feature = > + let prefix = "^CONFIG_" ^ String.uppercase_ascii feature ^ "=" in > + let lines = g#grep ~extended:true prefix ("/boot/config-" ^ version) in > + let lines = Array.to_list lines in > + match lines with > + | [] -> false > + | line :: _ -> > + let kind = snd (String.split...
2017 Oct 04
0
[PATCH 2/9] ocaml: Replace pattern matching { field = field } with { field }.
...char * let generate_action_header { name = shortname; style = ret, args, optargs as style; - deprecated_by = deprecated_by } = + deprecated_by } = pr "#define GUESTFS_HAVE_%s 1\n" (String.uppercase_ascii shortname); if optargs <> [] then ( @@ -705,7 +705,7 @@ extern GUESTFS_DLL_PUBLIC void *guestfs_next_private (guestfs_h *g, const char * in let generate_all_headers = List.iter ( - fun ({ name = name; style = ret, args, _ } as f) -> + fun ({ name; style = ret, args, _...
2019 Jun 27
3
[libnbd PATCH] generator: Add support for namespace constants
...-----------------------------------------------*) (* Helper functions. *) @@ -2908,6 +2915,25 @@ let print_extern_and_define name args ret = pr "#define LIBNBD_HAVE_NBD_%s 1\n" name_upper; pr "\n" +let print_ns_ctxt ns ns_upper ctxt consts = + let ctxt_upper = String.uppercase_ascii ctxt in + pr "#define LIBNBD_CONTEXT_%s_%s \"%s:%s\"\n" + ns_upper ctxt_upper ns ctxt; + pr "\n"; + pr "/* \"%s:%s\" context related constants */\n" ns ctxt; + List.iter (fun (n, i) -> pr "#define LIBNBD_%-30s %d\n" n i) consts +...
2017 Jul 14
0
[PATCH 07/27] daemon: Reimplement ‘is_dir’, ‘is_file’ and ‘is_symlink’ APIs in OCaml.
...--git a/generator/daemon.ml b/generator/daemon.ml index 3ffe91537..ef6086bfe 100644 --- a/generator/daemon.ml +++ b/generator/daemon.ml @@ -577,6 +577,7 @@ return_string_list (value retv) List.iter ( fun ({ name = name; style = ret, args, optargs } as f) -> + let uc_name = String.uppercase_ascii name in let ocaml_function = match f.impl with | OCaml f -> f @@ -625,8 +626,8 @@ return_string_list (value retv) let uc_n = String.uppercase_ascii n in (* optargs are all passed as [None|Some _] *) - pr " if ((optargs_bitmask &...
2016 Sep 27
8
[PATCH 0/3] v2v: further bits of Debian/Ubuntu guests supports
Hi, this series adds a couple bits more in v2v to convert Debian/Ubuntu (and derived) guests. The series does not complete the support (see known issues below), but all the patches here should be fit for review and inclusion. The series does not enable the conversion, yet. Known issues: * currently tested with simple local guest images, hence needs testing with real guests on
2017 Mar 06
7
[PATCH 0/6] Various Coverity fixes #2
Hi, this patch series fixes few more issues discovered by Coverity. Thanks, Pino Toscano (6): tail: check the return value pf guestfs_set_pgroup daemon: btrfs: check end_stringsbuf return values everywhere java: use cleanup handlers for structs (lists) as return values lib: qemu: improve handling of FILE* p2v: check more return values p2v: fix possible close(-1) issue cat/tail.c
2016 Oct 03
4
[PATCH v2 0/3] v2v: further bits of Debian/Ubuntu guests supports
Hi, this series adds a couple bits more in v2v to convert Debian/Ubuntu (and derived) guests. The series does not complete the support (see known issues below), but all the patches here should be fit for review and inclusion. The series does not enable the conversion, yet. Known issues: * currently tested with simple local guest images, hence needs testing with real guests on
2016 Aug 26
0
[PATCH v2 5/7] v2v: linux: check also kernel config for modules
...pect source rcaps = (* What kernel/kernel-like packages are installed on the current guest? *) let installed_kernels : kernel_info list = let rex_ko = Str.regexp ".*\\.k?o\\(\\.xz\\)?$" in + let check_config version feature = + let prefix = "^CONFIG_" ^ String.uppercase_ascii feature ^ "=" in + let lines = g#grep ~extended:true prefix ("/boot/config-" ^ version) in + let lines = Array.to_list lines in + match lines with + | [] -> false + | line :: _ -> + let kind = snd (String.split "=" line) in +...
2016 Sep 27
0
[PATCH 2/3] v2v: linux: check also kernel config for modules
...family bootloader = (* What kernel/kernel-like packages are installed on the current guest? *) let installed_kernels : kernel_info list = let rex_ko = Str.regexp ".*\\.k?o\\(\\.xz\\)?$" in + let check_config version feature = + let prefix = "^CONFIG_" ^ String.uppercase_ascii feature ^ "=" in + let lines = g#grep ~extended:true prefix ("/boot/config-" ^ version) in + let lines = Array.to_list lines in + match lines with + | [] -> false + | line :: _ -> + let kind = snd (String.split "=" line) in +...
2016 Oct 03
0
[PATCH v2 3/3] v2v: linux: check also kernel config for modules
...nstalled on the current guest? *) let installed_kernels : kernel_info list = let rex_ko = Str.regexp ".*\\.k?o\\(\\.xz\\)?$" in + let check_config version feature = function + | None -> false + | Some config -> + let prefix = "^CONFIG_" ^ String.uppercase_ascii feature ^ "=" in + let lines = g#grep ~extended:true prefix config in + let lines = Array.to_list lines in + match lines with + | [] -> false + | line :: _ -> + let kind = snd (String.split "=" line) in + (match kind wit...