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: Eduardo Habkost
Subject: Re: [Qemu-devel] [PATCH v3] hw/i386: Deprecate the machines pc-0.10 to pc-1.2
Date: Fri, 14 Jul 2017 12:40:10 -0300
User-agent: Mutt/1.8.0 (2017-02-23)

On Fri, Jul 14, 2017 at 01:41:58AM +0300, Michael S. Tsirkin wrote:
> 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.

That's probably what I will do.  Saving a few bytes in the QEMU
binary is probably not worth the extra ./configure cruft.

-- 
Eduardo



reply via email to

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