Received: from [140.186.70.92] (port=47185 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhPTP-0006lp-Rp for qemu-devel@nongnu.org; Mon, 24 Jan 2011 11:41:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PhPTO-0003H0-Pw for qemu-devel@nongnu.org; Mon, 24 Jan 2011 11:40:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36284) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PhPTO-0003Gr-Dm for qemu-devel@nongnu.org; Mon, 24 Jan 2011 11:40:58 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0OGevjd032541 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 24 Jan 2011 11:40:57 -0500 From: Markus Armbruster Subject: Re: [Qemu-devel] [PATCH 1/4] strtosz(): use unsigned char and switch to qemu_isspace() References: <1295883211-18288-1-git-send-email-Jes.Sorensen@redhat.com> <1295883211-18288-2-git-send-email-Jes.Sorensen@redhat.com> <4D3DA4AA.4030503@redhat.com> Date: Mon, 24 Jan 2011 17:40:56 +0100 In-Reply-To: <4D3DA4AA.4030503@redhat.com> (Jes Sorensen's message of "Mon, 24 Jan 2011 17:11:22 +0100") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jes Sorensen Cc: kwolf@redhat.com, qemu-devel@nongnu.org Jes Sorensen writes: > On 01/24/11 17:10, Markus Armbruster wrote: >> Jes.Sorensen@redhat.com writes: >> >>> From: Jes Sorensen >>> >>> isspace() behavior is undefined for signed char. >>> >>> Bug pointed out by Eric Blake, thanks! >>> >>> Signed-off-by: Jes Sorensen >>> --- >>> 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.