All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Jes Sorensen <Jes.Sorensen@redhat.com>
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/4] strtosz(): use unsigned char and switch to qemu_isspace()
Date: Mon, 24 Jan 2011 17:40:56 +0100	[thread overview]
Message-ID: <m3sjwi45lz.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <4D3DA4AA.4030503@redhat.com> (Jes Sorensen's message of "Mon, 24 Jan 2011 17:11:22 +0100")

Jes Sorensen <Jes.Sorensen@redhat.com> writes:

> On 01/24/11 17:10, Markus Armbruster wrote:
>> Jes.Sorensen@redhat.com writes:
>> 
>>> From: Jes Sorensen <Jes.Sorensen@redhat.com>
>>>
>>> isspace() behavior is undefined for signed char.
>>>
>>> Bug pointed out by Eric Blake, thanks!
>>>
>>> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
>>> ---
>>>  cutils.c |    7 ++++---
>>>  1 files changed, 4 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/cutils.c b/cutils.c
>>> index 4d2e27c..a067cf4 100644
>>> --- a/cutils.c
>>> +++ b/cutils.c
>>> @@ -294,7 +294,8 @@ int fcntl_setfl(int fd, int flag)
>>>  int64_t strtosz_suffix(const char *nptr, char **end, const char default_suffix)
>>>  {
>>>      int64_t retval = -1;
>>> -    char *endptr, c, d;
>>> +    char *endptr;
>>> +    unsigned char c, d;
>>>      int mul_required = 0;
>>>      double val, mul, integral, fraction;
>>>  
>> 
>> I doubt this hunk is still needed.
>
> It isn't strictly due to qemu_toupper() but it is prettier to match the
> real behavior of pure toupper() anyway.

Frequent casting between signed and unsigned has been shown to cause
headaches in laboratory rats.

  reply	other threads:[~2011-01-24 16:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24 15:33 [Qemu-devel] [PATCH v4 0/4] strtosz() cleanups Jes.Sorensen
2011-01-24 15:33 ` [Qemu-devel] [PATCH 1/4] strtosz(): use unsigned char and switch to qemu_isspace() Jes.Sorensen
2011-01-24 16:10   ` Markus Armbruster
2011-01-24 16:11     ` Jes Sorensen
2011-01-24 16:40       ` Markus Armbruster [this message]
2011-01-24 15:33 ` [Qemu-devel] [PATCH 2/4] strtosz() use qemu_toupper() to simplify switch statement Jes.Sorensen
2011-01-24 15:33 ` [Qemu-devel] [PATCH 3/4] strtosz(): Fix name confusion in use of modf() Jes.Sorensen
2011-01-24 15:33 ` [Qemu-devel] [PATCH 4/4] strtosz(): Use suffix macros in switch() statement Jes.Sorensen
2011-01-24 16:08   ` Markus Armbruster
2011-01-24 16:10     ` Jes Sorensen
2011-01-24 16:39       ` Markus Armbruster
2011-01-24 16:41         ` Jes Sorensen
2011-01-24 17:47           ` Markus Armbruster
2011-01-25  9:19             ` Jes Sorensen
2011-01-25 10:17               ` Markus Armbruster
2011-01-25 11:54                 ` Jes Sorensen
2011-01-24 15:45 ` [Qemu-devel] Re: [PATCH v4 0/4] strtosz() cleanups Kevin Wolf
2011-01-24 17:28   ` Stefan Weil
2011-01-25  9:18     ` Jes Sorensen
2011-01-25 10:14       ` Markus Armbruster
2011-01-25 11:52         ` Jes Sorensen
2011-01-25 13:19           ` 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=m3sjwi45lz.fsf@blackfin.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=Jes.Sorensen@redhat.com \
    --cc=kwolf@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.