From patchwork Wed Aug 31 15:37:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Hobbs X-Patchwork-Id: 112584 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 70864B6F7C for ; Thu, 1 Sep 2011 01:39:04 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 73D8228111; Wed, 31 Aug 2011 17:38:53 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5+DuHoIlNi3e; Wed, 31 Aug 2011 17:38:53 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7DE2C2811C; Wed, 31 Aug 2011 17:38:19 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B8F98280E6 for ; Wed, 31 Aug 2011 17:38:13 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ntBHDHjOx9No for ; Wed, 31 Aug 2011 17:38:13 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from smtp205.dfw.emailsrvr.com (smtp205.dfw.emailsrvr.com [67.192.241.205]) by theia.denx.de (Postfix) with ESMTPS id 515DD280E9 for ; Wed, 31 Aug 2011 17:38:10 +0200 (CEST) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp10.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id D26FC1B86A0; Wed, 31 Aug 2011 11:38:07 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp10.relay.dfw1a.emailsrvr.com (Authenticated sender: jason.hobbs-AT-calxeda.com) with ESMTPSA id B82FB1B84C5; Wed, 31 Aug 2011 11:38:06 -0400 (EDT) Received: by jhobbs-laptop (sSMTP sendmail emulation); Wed, 31 Aug 2011 10:37:50 -0500 From: "Jason Hobbs" To: u-boot@lists.denx.de Date: Wed, 31 Aug 2011 10:37:25 -0500 Message-Id: <1314805054-16250-5-git-send-email-jason.hobbs@calxeda.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1314805054-16250-1-git-send-email-jason.hobbs@calxeda.com> References: <1314805054-16250-1-git-send-email-jason.hobbs@calxeda.com> Subject: [U-Boot] [PATCH v5 04/13] Add isblank X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Existing ctype checks are implemented using a 256 byte lookup table, allowing each character to be in any of 8 character classes. Since there are 8 existing character classes without the blank class, I implemented isblank without using the lookup table. Since there are only two blank characters - tab and space - this is a more reasonable approach than doubling the size of the lookup table to accommodate one more class. Signed-off-by: Jason Hobbs --- new in v4 changes in v5: - none include/linux/ctype.h | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/include/linux/ctype.h b/include/linux/ctype.h index 6dec944..42f9305 100644 --- a/include/linux/ctype.h +++ b/include/linux/ctype.h @@ -31,6 +31,12 @@ extern const unsigned char _ctype[]; #define isupper(c) ((__ismask(c)&(_U)) != 0) #define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0) +/* + * Rather than doubling the size of the _ctype lookup table to hold a 'blank' + * flag, just check for space or tab. + */ +#define isblank(c) (c == ' ' || c == '\t') + #define isascii(c) (((unsigned char)(c))<=0x7f) #define toascii(c) (((unsigned char)(c))&0x7f)