[Libguestfs] [PATCH v7 3/6] v2v: cmdline: Factor out global variable.

Richard W.M. Jones rjones at redhat.com
Fri Mar 23 14:36:59 UTC 2018


On Fri, Mar 23, 2018 at 01:19:11PM +0100, Pino Toscano wrote:
> On Thursday, 22 March 2018 16:24:22 CET Richard W.M. Jones wrote:
> > ---
> >  v2v/cmdline.ml | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
> > index 70e9a3c3b..6aecd2aee 100644
> > --- a/v2v/cmdline.ml
> > +++ b/v2v/cmdline.ml
> > @@ -48,6 +48,8 @@ type cmdline = {
> >    root_choice : root_choice;
> >  }
> >  
> > +let ovf_flavours_str = String.concat "|" Create_ovf.ovf_flavours
> > +
> >  let parse_cmdline () =
> >    let compressed = ref false in
> >    let debug_overlays = ref false in
> > @@ -83,7 +85,6 @@ let parse_cmdline () =
> >    let set_vdsm_compat s = vdsm_compat := s in
> >  
> >    let vdsm_ovf_flavour = ref Create_ovf.RHVExportStorageDomain in
> > -  let ovf_flavours_str = String.concat "|" Create_ovf.ovf_flavours in
> >    let set_vdsm_ovf_flavour arg =
> >      vdsm_ovf_flavour := Create_ovf.ovf_flavour_of_string arg in
> 
> Is it really used as global variable?

It's not a massive deal but without this change the definition was
left floating around without any apparent attachment to the other
defns at the top of parse_cmdline.

However you're right that moving it to global scope does mean that
it's always evaluated, every time we run virt-v2v, so I pushed this
but moving it to just before the one place where it's used.

Thanks,

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the Libguestfs mailing list