From nobody Mon Feb 9 02:28:48 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1619015123; cv=none; d=zohomail.com; s=zohoarc; b=BD886bVX8Xa84lMAHVrHjQUQamxQR7CGzgZx/jgdUOHev4r6JkIlElh6po0GJ7//Ph9jl9xM/a5vWNjc/+abRT6Nxtfzta6IZJei7uUlx8Iaygkso9Sc0qak3Hx1kidTRQ75GKOGYSKzes4M1ExnKQPfsw/xOQxTE8PtENJPSEs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619015123; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8QhvMzXM/i87KvTemiF5H1HaQ7XQjeqnJIEG17bkRhM=; b=AiqiTmLLnRj3nScBtVOnYkwGQF3RfawFYBsGlloa9TyyWSmaLxLNCC2OGXql/n//936NTJO7KuEsKbcgE4sfKG3pQtUugDhq7mX+Opw9Z4LwnEwdIwffigxp6JlAFwNQxWH1DusSfJfUcfBFcl4YXZlsxYbl8SWUuNJw02vRwW4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1619015123872596.3856211420924; Wed, 21 Apr 2021 07:25:23 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114686.218611 (Exim 4.92) (envelope-from ) id 1lZDmv-00037R-Lc; Wed, 21 Apr 2021 14:25:09 +0000 Received: by outflank-mailman (output) from mailman id 114686.218611; Wed, 21 Apr 2021 14:25:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDmv-00037J-IS; Wed, 21 Apr 2021 14:25:09 +0000 Received: by outflank-mailman (input) for mailman id 114686; Wed, 21 Apr 2021 14:25:08 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDmu-000378-A7 for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:25:08 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 8a525680-f73b-4ea2-836a-3110f4070247; Wed, 21 Apr 2021 14:25:07 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id CCAD0B4CD; Wed, 21 Apr 2021 14:25:06 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8a525680-f73b-4ea2-836a-3110f4070247 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619015106; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8QhvMzXM/i87KvTemiF5H1HaQ7XQjeqnJIEG17bkRhM=; b=pUfnmEZN0+1UKyLaoepXW/lcPsD83VUY7OWw8pkI3d/HBH5tRxqb27rTjwHmGFMEWGoWA8 ghEJ+kQzKpkyGqRv6GdKe8JWHTSDgWWYGEmshycVHVLC4ARpbu0YRSWUmmU8k4dAHKdhLk BX0X3sNdyWsht9zTxQwweYBbir4OG30= Subject: [PATCH v2 15/20] lib: move strstr() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <8a44fe36-be00-cfcb-2597-b14b4d4e500c@suse.com> Date: Wed, 21 Apr 2021 16:25:06 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -131,27 +131,6 @@ char * strsep(char **s, const char *ct) } #endif =20 -#ifndef __HAVE_ARCH_STRSTR -/** - * strstr - Find the first substring in a %NUL terminated string - * @s1: The string to be searched - * @s2: The string to search for - */ -char *(strstr)(const char *s1, const char *s2) -{ - size_t l1, l2 =3D strlen(s2); - - if (!l2) - return (char *)s1; - - for (l1 =3D strlen(s1); l1 >=3D l2; --l1, ++s1) - if (!memcmp(s1, s2, l2)) - return (char *)s1; - - return NULL; -} -#endif - /* * Local variables: * mode: C --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -22,6 +22,7 @@ lib-y +=3D strlen.o lib-y +=3D strncmp.o lib-y +=3D strnlen.o lib-y +=3D strrchr.o +lib-y +=3D strstr.o lib-$(CONFIG_X86) +=3D xxhash32.o lib-$(CONFIG_X86) +=3D xxhash64.o =20 --- /dev/null +++ b/xen/lib/strstr.c @@ -0,0 +1,34 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include + +/** + * strstr - Find the first substring in a %NUL terminated string + * @s1: The string to be searched + * @s2: The string to search for + */ +char *(strstr)(const char *s1, const char *s2) +{ + size_t l1, l2 =3D strlen(s2); + + if (!l2) + return (char *)s1; + + for (l1 =3D strlen(s1); l1 >=3D l2; --l1, ++s1) + if (!memcmp(s1, s2, l2)) + return (char *)s1; + + return NULL; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */