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

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Libguestfs mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to