qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Luiz Capitulino <lcapitulino@redhat.com>,
	qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/2] qemu-opts: introduce a function to compare option names
Date: Wed, 25 Jul 2012 10:45:02 -0600	[thread overview]
Message-ID: <5010228E.7070704@redhat.com> (raw)
In-Reply-To: <1343233543-18561-2-git-send-email-aliguori@us.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 1319 bytes --]

On 07/25/2012 10:25 AM, Anthony Liguori wrote:
> We don't use the standard C functions for conversion because we don't want to
> depend on the user's locale.  All option names in QEMU are en_US in plain ASCII.

[Wondering if I should bring up the US 'canceled' vs. UK 'cancelled' as
a counterpoint to the claim of everything being en_US, but then again, I
didn't find any use of 'cancelled' as an option in qapi-schema.json.]

> 
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> ---
>  qemu-option.c |   53 +++++++++++++++++++++++++++++++++++++++++++++--------
>  qemu-option.h |    2 ++
>  2 files changed, 47 insertions(+), 8 deletions(-)
> 
> diff --git a/qemu-option.c b/qemu-option.c
> index 8334190..6494c99 100644
> --- a/qemu-option.c
> +++ b/qemu-option.c
> @@ -89,6 +89,43 @@ const char *get_opt_value(char *buf, int buf_size, const char *p)
>      return p;
>  }
>  
> +static int opt_tolower(int ch)
> +{
> +    if (ch >= 'A' && ch <= 'Z') {
> +        return 'a' + (ch - 'A');
> +    } else if (ch == '_') {
> +        return '-';

Slick - making case-insensitive comparison also fold '-' and '_' together :)

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]

  reply	other threads:[~2012-07-25 16:45 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-25 16:25 [Qemu-devel] [PATCH 0/2] Allow '-' or '_' for all QemuOpts Anthony Liguori
2012-07-25 16:25 ` [Qemu-devel] [PATCH 1/2] qemu-opts: introduce a function to compare option names Anthony Liguori
2012-07-25 16:45   ` Eric Blake [this message]
2012-07-25 16:46     ` Eric Blake
2012-07-25 17:34       ` Anthony Liguori
2012-07-25 16:53   ` Peter Maydell
2012-07-25 17:33     ` Anthony Liguori
2012-07-25 18:31       ` Peter Maydell
2012-07-27  7:44   ` Markus Armbruster
2012-07-27 11:14     ` Peter Maydell
2012-07-25 16:25 ` [Qemu-devel] [PATCH 2/2] qemu-config: convert all QemuOpts to use dashes instead of underscores Anthony Liguori
2012-07-25 17:32   ` Luiz Capitulino
2012-07-25 18:20     ` Anthony Liguori
2012-07-25 18:58       ` Peter Maydell
2012-07-25 19:02         ` Luiz Capitulino
2012-07-25 19:02           ` Peter Maydell
2012-07-25 19:09             ` [Qemu-devel] Changing qemu's -help output Luiz Capitulino
2012-07-25 21:21               ` [Qemu-devel] [libvirt] " Eric Blake
2012-07-27  7:45       ` [Qemu-devel] [PATCH 2/2] qemu-config: convert all QemuOpts to use dashes instead of underscores Markus Armbruster
2012-07-27 11:10   ` Andreas Färber
2012-07-25 17:34 ` [Qemu-devel] [PATCH 0/2] Allow '-' or '_' for all QemuOpts Luiz Capitulino
2012-07-27  8:39 ` Markus Armbruster

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=5010228E.7070704@redhat.com \
    --to=eblake@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=armbru@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).