From patchwork Sat Nov 3 21:45:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 196957 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 084CB2C00C8 for ; Sun, 4 Nov 2012 08:46:53 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DBF474A49D; Sat, 3 Nov 2012 22:45:51 +0100 (CET) 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 jNbpeJ3irjAW; Sat, 3 Nov 2012 22:45:51 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 24F1B4A44E; Sat, 3 Nov 2012 22:45:39 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6392E4A436 for ; Sat, 3 Nov 2012 22:45:35 +0100 (CET) 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 qRElt0YEnjBD for ; Sat, 3 Nov 2012 22:45:32 +0100 (CET) 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 mail-wg0-f74.google.com (mail-wg0-f74.google.com [74.125.82.74]) by theia.denx.de (Postfix) with ESMTPS id A2F594A421 for ; Sat, 3 Nov 2012 22:45:30 +0100 (CET) Received: by mail-wg0-f74.google.com with SMTP id dt11so291685wgb.3 for ; Sat, 03 Nov 2012 14:45:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=E+DWBvBNOCrPfAYWNrJj7M5Oh12nTrK2WDpS/H0qOk8=; b=WZNSZezc2O2W1KQxdUGnzGuvtrDlzg9fLzyahlhs3pZWUxeAUlXLZug5rh4I4TGevO wD8Qnz0Uk3dk2ITazYxuwMfqPL2MDZYD48cUKeCaplsk/6PtMRIuBfgYo8hvIAZlLXdu Irye9UX6/r94YYr0OmbfXSmKHyf0xclFSShsjnhZS2BUSxMHtT+fsFGNfOKAHUuvi0YC 0HtKnfbMr8sV6hwxxtXHNf9U0uOpcV0aR+p76/DjrE2Uh/VUmI1KqW85OOQc/Ydh161b n1kV7aQUcZwvdHllmRlYJ6vQa3WrJ1O7cznwIN5Of+ZZqixsI+zvYY3TtHVdEJCi799L BFug== Received: by 10.14.204.201 with SMTP id h49mr5854492eeo.5.1351979129437; Sat, 03 Nov 2012 14:45:29 -0700 (PDT) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id u8si2321881een.1.2012.11.03.14.45.29 (version=TLSv1/SSLv3 cipher=AES128-SHA); Sat, 03 Nov 2012 14:45:29 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by hpza10.eem.corp.google.com (Postfix) with ESMTP id 15D0320004E; Sat, 3 Nov 2012 14:45:29 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 6FE821618EB; Sat, 3 Nov 2012 14:45:28 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Sat, 3 Nov 2012 14:45:21 -0700 Message-Id: <1351979121-3769-3-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1351979121-3769-1-git-send-email-sjg@chromium.org> References: <1351979121-3769-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQn1j8/2VJB9urd8dX0wUTy+bXbCcxDWE6l+CmO4y65HO0mygEFhBId8iGV1MNIECDTJk1xTv3aPGgJGi/Pgn5sJRlSiO3ap+W2i+LMSTTicRJ+zFojlu5ERiY2OmcBwsKayGVZZSQdklifM4LVqE4XwYxHlG1KhWj8qvPeTaL/X3kqy98uBGrbyK5Awx5AsNQ5b5DSG Cc: Tom Rini Subject: [U-Boot] [PATCH 3/3] Add stricmp() and strnicmp() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 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 strnicmp() is present but disabled. Make it available and define stricmp() also. There is a only a small performance penalty to having stricmp() call strnicmp(), so do this instead of a standalone function, to save code space. BRANCH=none Signed-off-by: Simon Glass --- include/linux/string.h | 4 ++++ lib/string.c | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/linux/string.h b/include/linux/string.h index 9a8cbc2..77fd1e9 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -20,6 +20,10 @@ extern __kernel_size_t strspn(const char *,const char *); */ #include +int strnicmp(const char *s1, const char *s2, size_t len); + +int stricmp(const char *s1, const char *s2); + #ifndef __HAVE_ARCH_STRCPY extern char * strcpy(char *,const char *); #endif diff --git a/lib/string.c b/lib/string.c index c3ad055..f73df3f 100644 --- a/lib/string.c +++ b/lib/string.c @@ -21,7 +21,6 @@ #include -#if 0 /* not used - was: #ifndef __HAVE_ARCH_STRNICMP */ /** * strnicmp - Case insensitive, length-limited string comparison * @s1: One string @@ -52,7 +51,16 @@ int strnicmp(const char *s1, const char *s2, size_t len) } return (int)c1 - (int)c2; } -#endif + +/** + * stricmp - Case insensitive string comparison + * @s1: One string + * @s2: The other string + */ +int stricmp(const char *s1, const char *s2) +{ + return strnicmp(s1, s2, -1U); +} char * ___strtok;