From patchwork Wed Aug 28 14:47:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 19569 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f199.google.com (mail-gh0-f199.google.com [209.85.160.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1CF0125E58 for ; Wed, 28 Aug 2013 14:48:13 +0000 (UTC) Received: by mail-gh0-f199.google.com with SMTP id g14sf6489299ghb.6 for ; Wed, 28 Aug 2013 07:48:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=ZcvPpbbb+8/yt9U4KgJHsyaSzX0Jm4cv5C1Xme91RSI=; b=LLoMfavaJZX/MCA5cg2vVHTlb9KJvlwBe08D0+96G/W8RAKRDN24rtj5E8AfNHmNSz bHhhVCjq2+cFL6rjqonHt6nlNuwcTh8LCZ9j4gOM2Iek7abbHG3jXMkT0ImPOvtoEV6j yWuzR5jFSQSSQ9rFA1k93IPasx1Vr0x4gpu5jZMs6aasKy/jc4P9BgLa9AvnuhHxZoS3 d8ZEekqHZ5hy4KPcLxsNeRQi8TRI8uphGakTKVuOBepXxhDwSlYlC4maAKzIRtn2hIw0 74hy8wrRUMqQn9eeRKichho7IqzJ6rRvEhhx7k3D8/OvDubc/2r4ocQ7KftwRpAKrt66 m8DA== X-Received: by 10.236.14.100 with SMTP id c64mr10177008yhc.38.1377701292883; Wed, 28 Aug 2013 07:48:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.108.7 with SMTP id hg7ls367212qeb.95.gmail; Wed, 28 Aug 2013 07:48:12 -0700 (PDT) X-Received: by 10.58.97.138 with SMTP id ea10mr299286veb.38.1377701292759; Wed, 28 Aug 2013 07:48:12 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id do3si6611036vcb.48.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 28 Aug 2013 07:48:12 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id db10so4447995veb.28 for ; Wed, 28 Aug 2013 07:48:12 -0700 (PDT) X-Gm-Message-State: ALoCoQlqh0igSpBiRSIAhlMp9D8Z+97/gMGoNUC1zHt4rd6jQDZxbcfTXqjzT3QUJH9LVkwkKe78 X-Received: by 10.58.155.68 with SMTP id vu4mr13848386veb.21.1377701292683; Wed, 28 Aug 2013 07:48:12 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp359937vcz; Wed, 28 Aug 2013 07:48:12 -0700 (PDT) X-Received: by 10.194.120.68 with SMTP id la4mr12536719wjb.33.1377701291637; Wed, 28 Aug 2013 07:48:11 -0700 (PDT) Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by mx.google.com with ESMTPS id bn9si1814351wib.69.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 28 Aug 2013 07:48:11 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.177 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.212.177; Received: by mail-wi0-f177.google.com with SMTP id hi5so1366809wib.4 for ; Wed, 28 Aug 2013 07:48:11 -0700 (PDT) X-Received: by 10.194.83.74 with SMTP id o10mr310685wjy.95.1377701290929; Wed, 28 Aug 2013 07:48:10 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id a8sm5590498wie.6.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 28 Aug 2013 07:48:09 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Cc: stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, patches@linaro.org, andre.przywara@linaro.org, Julien Grall Subject: [PATCH V1 06/29] xen: Add new string function Date: Wed, 28 Aug 2013 15:47:20 +0100 Message-Id: <1377701263-3319-7-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1377701263-3319-1-git-send-email-julien.grall@linaro.org> References: <1377701263-3319-1-git-send-email-julien.grall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add strcasecmp. The code is copied from Linux. Signed-off-by: Julien Grall Acked-by: Ian Campbell --- Changes in v2: - Remove kbasename --- xen/common/string.c | 15 +++++++++++++++ xen/include/xen/string.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/xen/common/string.c b/xen/common/string.c index db9d9d5..9a5a4ba 100644 --- a/xen/common/string.c +++ b/xen/common/string.c @@ -41,6 +41,21 @@ int strnicmp(const char *s1, const char *s2, size_t len) } #endif +#ifndef __HAVE_ARCH_STRCASECMP +int strcasecmp(const char *s1, const char *s2) +{ + int c1, c2; + + do + { + c1 = tolower(*s1++); + c2 = tolower(*s2++); + } while ( c1 == c2 && c1 != 0 ); + + return c1 - c2; +} +#endif + #ifndef __HAVE_ARCH_STRLCPY /** * strlcpy - Copy a %NUL terminated string into a sized buffer diff --git a/xen/include/xen/string.h b/xen/include/xen/string.h index f26b994..f35934e 100644 --- a/xen/include/xen/string.h +++ b/xen/include/xen/string.h @@ -43,6 +43,9 @@ extern int strncmp(const char *,const char *,__kernel_size_t); #ifndef __HAVE_ARCH_STRNICMP extern int strnicmp(const char *, const char *, __kernel_size_t); #endif +#ifndef __HAVE_ARCH_STRCASECMP +extern int strcasecmp(const char *, const char *); +#endif #ifndef __HAVE_ARCH_STRCHR extern char * strchr(const char *,int); #endif