[virt-tools-list] [PATCH virt-viewer 2/4] Add virt_viewer_compare_version()

Marc-André Lureau mlureau at redhat.com
Fri Mar 8 12:35:25 UTC 2013



----- Mensaje original -----
> Hi,
> 
> On 03/07/2013 08:55 PM, Marc-André Lureau wrote:
> > ---
> >   src/virt-viewer-util.c | 54
> >   ++++++++++++++++++++++++++++++++++++++++++++++++++
> >   src/virt-viewer-util.h |  1 +
> >   2 files changed, 55 insertions(+)
> >
> > diff --git a/src/virt-viewer-util.c b/src/virt-viewer-util.c
> > index f0b1182..a32138c 100644
> > --- a/src/virt-viewer-util.c
> > +++ b/src/virt-viewer-util.c
> > @@ -414,6 +414,60 @@ spice_hotkey_to_gtk_accelerator(const gchar
> > *key)
> >       return accel;
> >   }
> >
> > +/**
> > + * virt_viewer_compare_version:
> > + * @s1: a version-like string
> > + * @s2: a version-like string
> > + *
> > + * Compare two version-like strings: 1.1 > 1.0, 1.0.1 > 1.0, 1.0c
> > >
> > + * 1.0a, but 1.0rc < 1.0 for example.
> 
> Ugh, no lets not do that please. Example if I read the above comment
> and
> the code correctly then 1.0a < 1.0 which will surprise some people.

We are not trying to be generic. We are just trying to fit with virt-viewer visioning.

Since string suffix is quite common, especially the "rc" case, the function is fine too.

Now if we never use string suffix, then that shouldn't change the result of this function.




More information about the virt-tools-list mailing list