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

Christophe Fergeau cfergeau at redhat.com
Mon Mar 11 08:45:03 UTC 2013


On Fri, Mar 08, 2013 at 03:15:35PM +0100, Marc-André Lureau wrote:
> ---
>  src/virt-viewer-util.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
>  src/virt-viewer-util.h |  1 +
>  2 files changed, 50 insertions(+)
> 
> diff --git a/src/virt-viewer-util.c b/src/virt-viewer-util.c
> index f0b1182..344bd13 100644
> --- a/src/virt-viewer-util.c
> +++ b/src/virt-viewer-util.c
> @@ -414,6 +414,55 @@ 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.10 > 1.7...
> + *
> + * String suffix (1.0rc1 etc) are not accepted, and will return 0.

While I agree with Hans that we don't want to try to handle rc1, a, ...
there, this code will also choke on versions like 0.18.13-09abc (which
spice-gtk uses for git snapshots), this might be needed at some point

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20130311/999987fb/attachment.sig>


More information about the virt-tools-list mailing list