qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Laszlo Ersek <lersek@redhat.com>, Thomas Huth <thuth@redhat.com>,
	qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>,
	Marcel Apfelbaum <marcel@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>
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	[thread overview]
Message-ID: <20170714154010.GC6020@localhost.localdomain> (raw)
In-Reply-To: <20170714013246-mutt-send-email-mst@kernel.org>

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	other threads:[~2017-07-14 15:40 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-12  8:22 [Qemu-devel] [PATCH v3] hw/i386: Deprecate the machines pc-0.10 to pc-1.2 Thomas Huth
2017-07-12 13:31 ` Gerd Hoffmann
2017-07-12 14:51 ` Eduardo Habkost
2017-07-12 15:17   ` Michael S. Tsirkin
2017-07-12 20:15     ` Eduardo Habkost
2017-07-12 20:31       ` Michael S. Tsirkin
2017-07-12 20:56         ` Eduardo Habkost
2017-07-12 22:27           ` Michael S. Tsirkin
2017-07-13  0:23             ` Laszlo Ersek
2017-07-13  0:45               ` Michael S. Tsirkin
2017-07-13  0:47               ` Michael S. Tsirkin
2017-07-13 15:17               ` Eduardo Habkost
2017-07-13 15:34                 ` Laszlo Ersek
2017-07-13 22:41                 ` Michael S. Tsirkin
2017-07-14 15:40                   ` Eduardo Habkost [this message]
2017-07-13 15:24       ` Eric Blake
2017-07-12 15:45   ` Markus Armbruster
2017-07-12 17:48     ` Eduardo Habkost
2017-07-12 15:04 ` Daniel P. Berrange
2017-07-12 16:00   ` Thomas Huth
2017-07-12 16:12     ` Daniel P. Berrange
2017-07-12 16:23       ` Thomas Huth
2017-07-12 16:32         ` Daniel P. Berrange
2017-07-12 16:23       ` Paolo Bonzini
2017-07-12 16:29         ` Daniel P. Berrange
2017-07-12 20:37           ` Eduardo Habkost
2017-07-13 23:14           ` Michael S. Tsirkin
2017-07-14 16:33             ` Eduardo Habkost
2017-07-12 20:26   ` Eduardo Habkost
2017-07-13  0:30 ` Laszlo Ersek
2017-07-13  0:47   ` Michael S. Tsirkin
2017-07-13  1:02     ` Laszlo Ersek
2017-07-13  1:00 ` Michael S. Tsirkin
2017-07-13 15:20   ` Eduardo Habkost
2017-07-13 23:04     ` Michael S. Tsirkin
2017-07-14  5:37       ` Thomas Huth
2017-07-14  9:50       ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170714154010.GC6020@localhost.localdomain \
    --to=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=lersek@redhat.com \
    --cc=marcel@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).