[Libguestfs] [PATCH v3 15/22] v2v: windows: Convert the Windows-related conversion modules from Str to PCRE.
Pino Toscano
ptoscano at redhat.com
Wed Sep 27 12:38:52 UTC 2017
On Friday, 22 September 2017 09:36:16 CEST Richard W.M. Jones wrote:
> diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml
> index ac2b8180b..fa87ed84a 100644
> --- a/v2v/convert_windows.ml
> +++ b/v2v/convert_windows.ml
> @@ -125,6 +125,7 @@ let convert (g : G.guestfs) inspect source output rcaps =
> ) in
>
> (* Locate and retrieve all uninstallation commands for Parallels Tools *)
> + let prltools_rex = PCRE.compile "(Parallels|Virtuozzo) Tools" in
> let prltools_uninsts =
> let uninsts = ref [] in
>
> @@ -146,8 +147,7 @@ let convert (g : G.guestfs) inspect source output rcaps =
> raise Not_found;
>
> let dispname = g#hivex_value_string valueh in
> - if not (Str.string_match (Str.regexp ".*\\(Parallels\\|Virtuozzo\\) Tools.*")
> - dispname 0) then
> + if not (PCRE.matches prltools_rex dispname) then
TBH I'd simplify here using String.find:
if (String.find dispname "Parallels Tools." = -1) &&
(String.find dispname "Virtuozzo Tools." = -1) then
It should be simpler and faster.
--
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20170927/e7cdfb6d/attachment.sig>
More information about the Libguestfs
mailing list