From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=44867 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhP04-0007zk-Q3 for qemu-devel@nongnu.org; Mon, 24 Jan 2011 11:10:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PhOzv-0002nz-Js for qemu-devel@nongnu.org; Mon, 24 Jan 2011 11:10:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52742) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PhOzv-0002nm-CM for qemu-devel@nongnu.org; Mon, 24 Jan 2011 11:10:31 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0OGAUrk026460 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 24 Jan 2011 11:10:30 -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> Date: Mon, 24 Jan 2011 17:10:28 +0100 In-Reply-To: <1295883211-18288-2-git-send-email-Jes.Sorensen@redhat.com> (Jes Sorensen's message of "Mon, 24 Jan 2011 16:33:28 +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@redhat.com Cc: kwolf@redhat.com, qemu-devel@nongnu.org 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. > @@ -314,7 +315,7 @@ int64_t strtosz_suffix(const char *nptr, char **end, const char default_suffix) > */ > c = *endptr; > d = c; > - if (isspace(c) || c == '\0' || c == ',') { > + if (qemu_isspace(c) || c == '\0' || c == ',') { > c = 0; > if (default_suffix) { > d = default_suffix; > @@ -361,7 +362,7 @@ int64_t strtosz_suffix(const char *nptr, char **end, const char default_suffix) > */ > if (c != 0) { > endptr++; > - if (!isspace(*endptr) && *endptr != ',' && *endptr != 0) { > + if (!qemu_isspace(*endptr) && *endptr != ',' && *endptr != 0) { > goto fail; > } > }