Re: [Qemu-devel] [PATCH 1/2] qemu-opts: introduce a function to compare option names

2012-07-27 Thread Peter Maydell
On 27 July 2012 08:44, Markus Armbruster wrote: > The implementation is too longwinded for my taste :) > > static unsigned char opt_canon_ch(char ch) > { > if (ch >= 'A' && ch <= 'Z') { > return 'a' + (ch - 'A'); > } else if (ch == '_') { > return '-'; > } > > retur

Re: [Qemu-devel] [PATCH 1/2] qemu-opts: introduce a function to compare option names

2012-07-27 Thread Markus Armbruster
Anthony Liguori writes: > 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. Fails to explain the important part, namely the actual change to option comparison! > Signed-off-by: Anth

Re: [Qemu-devel] [PATCH 1/2] qemu-opts: introduce a function to compare option names

2012-07-25 Thread Anthony Liguori
Peter Maydell writes: > On 25 July 2012 17:25, 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. >> >> Signed-off-by: Anthony Liguori >> --- >> qemu-opt

Re: [Qemu-devel] [PATCH 1/2] qemu-opts: introduce a function to compare option names

2012-07-25 Thread Peter Maydell
On 25 July 2012 18:33, Anthony Liguori wrote: > Peter Maydell writes: >> This is not in line with the return value that the C library >> strcmp() would return. C99 7.21.4 says "The sign of a nonzero >> value returned by the comparison functions memcmp, strcmp, >> and strncmp is determined by the

Re: [Qemu-devel] [PATCH 1/2] qemu-opts: introduce a function to compare option names

2012-07-25 Thread Anthony Liguori
Eric Blake writes: > On 07/25/2012 10:45 AM, Eric Blake wrote: >> 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. >> >>>

Re: [Qemu-devel] [PATCH 1/2] qemu-opts: introduce a function to compare option names

2012-07-25 Thread Peter Maydell
On 25 July 2012 17:25, 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. > > Signed-off-by: Anthony Liguori > --- > qemu-option.c | 53

Re: [Qemu-devel] [PATCH 1/2] qemu-opts: introduce a function to compare option names

2012-07-25 Thread Eric Blake
On 07/25/2012 10:45 AM, Eric Blake wrote: > 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. > >> >> +static int opt_tolower(int

Re: [Qemu-devel] [PATCH 1/2] qemu-opts: introduce a function to compare option names

2012-07-25 Thread Eric Blake
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 counterpoin

[Qemu-devel] [PATCH 1/2] qemu-opts: introduce a function to compare option names

2012-07-25 Thread Anthony Liguori
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. Signed-off-by: Anthony Liguori --- qemu-option.c | 53 + qemu-option.h |2 ++ 2