From patchwork Mon Jan 31 15:28:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 81169 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9192EB70E9 for ; Tue, 1 Feb 2011 03:10:22 +1100 (EST) Received: from localhost ([127.0.0.1]:55033 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pjvm2-0006GM-Pk for incoming@patchwork.ozlabs.org; Mon, 31 Jan 2011 10:34:38 -0500 Received: from [140.186.70.92] (port=42760 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PjvfL-0002Se-OF for qemu-devel@nongnu.org; Mon, 31 Jan 2011 10:27:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PjvfI-0003MS-Dn for qemu-devel@nongnu.org; Mon, 31 Jan 2011 10:27:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:21119) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PjvfI-0003MB-2q for qemu-devel@nongnu.org; Mon, 31 Jan 2011 10:27:40 -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 p0VFRc3x024111 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 31 Jan 2011 10:27:38 -0500 Received: from dhcp-5-188.str.redhat.com (dhcp-5-175.str.redhat.com [10.32.5.175]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p0VFRZ1x012144; Mon, 31 Jan 2011 10:27:37 -0500 From: Kevin Wolf To: anthony@codemonkey.ws Date: Mon, 31 Jan 2011 16:28:49 +0100 Message-Id: <1296487756-12553-2-git-send-email-kwolf@redhat.com> In-Reply-To: <1296487756-12553-1-git-send-email-kwolf@redhat.com> References: <1296487756-12553-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 01/28] strtosz(): use unsigned char and switch to qemu_isspace() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jes Sorensen isspace() behavior is undefined for signed char. Bug pointed out by Eric Blake, thanks! Signed-off-by: Jes Sorensen Signed-off-by: Kevin Wolf --- 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; @@ -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; } }