From patchwork Tue Aug 23 21:06:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Hobbs X-Patchwork-Id: 111184 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 A3E6CB6F57 for ; Wed, 24 Aug 2011 07:17:29 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DF5F8280C0; Tue, 23 Aug 2011 23:12:10 +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 PJmGL-wmkzGp; Tue, 23 Aug 2011 23:12:10 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5B323280CF; Tue, 23 Aug 2011 23:10:30 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id ABCB128095 for ; Tue, 23 Aug 2011 23:09:56 +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 DBWxoee1wXYz for ; Tue, 23 Aug 2011 23:09:41 +0200 (CEST) X-policyd-weight: passed - too many local DNS-errors in dnsbl.njabl.org lookups Received: from smtp145.dfw.emailsrvr.com (smtp145.dfw.emailsrvr.com [67.192.241.145]) by theia.denx.de (Postfix) with ESMTPS id C7F4E280A8 for ; Tue, 23 Aug 2011 23:08:46 +0200 (CEST) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp24.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 035AF18032A; Tue, 23 Aug 2011 17:07:43 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp24.relay.dfw1a.emailsrvr.com (Authenticated sender: jason.hobbs-AT-calxeda.com) with ESMTPSA id B2BA418059C; Tue, 23 Aug 2011 17:07:41 -0400 (EDT) Received: by jhobbs-laptop (sSMTP sendmail emulation); Tue, 23 Aug 2011 16:07:35 -0500 From: "Jason Hobbs" To: u-boot@lists.denx.de Date: Tue, 23 Aug 2011 16:06:52 -0500 Message-Id: <1314133621-6488-5-git-send-email-jason.hobbs@calxeda.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1314133621-6488-1-git-send-email-jason.hobbs@calxeda.com> References: <1314133621-6488-1-git-send-email-jason.hobbs@calxeda.com> Subject: [U-Boot] [PATCH v4 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 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)