qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3] hw/i386: Deprecate the machines pc-0.10 to p


From: Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH v3] hw/i386: Deprecate the machines pc-0.10 to pc-1.2
Date: Fri, 14 Jul 2017 01:41:58 +0300

On Thu, Jul 13, 2017 at 12:17:40PM -0300, Eduardo Habkost wrote:
> > > Oh right. So you need to find dots and split at these points.
> > > Something like the below? Completely untested.
> > > 
> > > int mstcmp(const char *s1, const char *s2)
> > > {
> > >   const char *e1, *e2;
> > >   int l1, l2, c;
> > > 
> > >   do {
> > >           e1 = strchr(s1, '.');
> > >           e2 = strchr(s2, '.');
> > > 
> > >           l1 = e1 ? e1 - s1 + 1 : strlen(s1);
> > >           l2 = e2 ? e2 - s2 + 1 : strlen(s2);
> > > 
> > >           /* compare numerically: shorter strings give smaller numbers */
> > >           if (l1 != l2) {
> > >                   break;
> > >           }
> > >           c = strncmp(s1, s2, l1);
> > >           if (c) {
> > >                   return c;
> > >           }
> > >           s1 += l1;
> > >           s2 += l1;
> > >   } while (l1);
> > > 
> > >   return l1 - l2;
> > > }
> 
> I believe copying strverscmp() from gnulib as-is is better than
> reimplementing a subset of it.

I would then probably copy it unconditionally.

> 
> -- 
> Eduardo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]