Message ID | 20240202155825.314567-25-masahiroy@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-50084-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp527672dyc; Fri, 2 Feb 2024 08:06:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IGS5/H92fxb6f3/+WDtB+V9EtjhcKyBzHK6Xm9RBFocDtVrQQMTEqlqbXOzMvHUcv1OXMYe X-Received: by 2002:ac8:7dcb:0:b0:42b:f599:a97a with SMTP id c11-20020ac87dcb000000b0042bf599a97amr6489165qte.15.1706889971061; Fri, 02 Feb 2024 08:06:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706889971; cv=pass; d=google.com; s=arc-20160816; b=NpzDK4SqIogpp2Pb+4s0CpNwTknUYS+/7aJp/l2ZlNlSoxFTV2TpSe0QDzQfSdEGuX 532ObfjwdDWDig1ARds/+6nJFbb4Aywm1ZzVYH+Yoitl7+lwOsixr+IWNQN9zoqr8qUh shYvXTDm7HjG1C+evcuNOLSKX/QL8HBQz7frLFhm8diNW1vEaH+l7/KFm4LqfvtIbezi nG4sjxxp1Y1aMqyzproLfZUIt04P+2MzPd+f8B30+KapZ2LeeJXi4Y3fE5X4e+2jPhF6 lq2vriNxtivwo4UV+qIKitcL/VjAhSywPWw2HbFAwtbpy30wLhfOvGhB3w3jJj2ATep9 rExg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=/KzLhjJwnfwarHFc9lrsX+yOG2Hnfrm40otz7wHubz8=; fh=XqugY3HhXIq3NKjjOeX0pnItdhr3n2sNIZNE1Ffcb/Y=; b=u01dUXPcHduQ/OwWatr3Q2f+I7NONHWTEPUaNrISTccglCuuqo7AxSERiIMcG9HJJn 0mZsMgOi1kodXvrYZcKpqvHskF1egWwKneGtRFPxRmvxzziklR7KL16EWtPyb8h1VW+8 DpWA6shrxWpCygXOnhBd6hZimaZnPeKmAxsp1mN6BssxMmfXwTeBMcU4DNJxqvEZZxS8 yTaAl0vwOSiJrpMTcsLimsfHPWX39yEoMUuhgxs08+3JfgAkX0a/m3l3Wa5dhRXFK+Lk JXNkRsR+K3LwKrhce3Te48EAs4CmUilHmLCrY702BBVCc7KjSRQqzMyz0q+Eff5evrPj d/5A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KHPlvMni; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-50084-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50084-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCVR9qrbrJLK/5aPlsBrfeS3/EW4NuVVMmi+e72XW/QQ2IL74kSj5RmxsmCk6hB7HlRVAomezBlBkZOokmC04NGMeGPuJg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h1-20020ac87d41000000b0042a87f5c338si2286706qtb.63.2024.02.02.08.06.10 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 08:06:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50084-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KHPlvMni; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-50084-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50084-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 435971C26039 for <ouuuleilei@gmail.com>; Fri, 2 Feb 2024 16:05:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 12704152E18; Fri, 2 Feb 2024 15:59:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KHPlvMni" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4AD66151CD3; Fri, 2 Feb 2024 15:58:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706889537; cv=none; b=B+yYk13ajj21Y8aSFnnVtPInpO5FzQngu0YE9xc66qT0cTSBJt+nUTWxGEd5WIm9xJdizrNUXj0trXc54LRFPcNFhVn5jGM8cOta3NkN5/D9vAo2Z9Lu9um7rfuHg782E8xMd8WrTJ02f+NtGbH+g2HuMRlU+n0VJrMHTLWP5Vs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706889537; c=relaxed/simple; bh=FTcLV2NufTBnpOgxgoEZStajI6PRmkWD1yAMbETfinQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=O2PNPCsHo3IaeaBL9f60AlIDXc+o/0YtJFVGbiE3Lb+UcUYGgQCVX/mz10guUfzqE4XdneuDAUTZmghlRzTpnGEsTF4FPEStFLFaYgAn04CAXeoCwPGCC23F4NTFswN3XvgLl/SnuURzF9tEO0ZC8xVCxfDobBEys4UsFp8t760= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KHPlvMni; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B232C43390; Fri, 2 Feb 2024 15:58:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706889537; bh=FTcLV2NufTBnpOgxgoEZStajI6PRmkWD1yAMbETfinQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KHPlvMni4MDvKigZg2a8wQU1pSZK2Voh6N8Em4TtlyRxmzpFMuU4EaO2CaSoODtsO IDOo9X/Sdp2qfdXjJkyBaD9o3E5AzRuFcjXmmPXwxzeTi3L7d5jZE/ermuVdypYdfb 3oABKE31z5LET4VBmmqS/AINEF29sKD45qg0jh1n6at/aqMeGmpKQL+nuDP0plZ8OO 0C3JhMx//nm9vqD9v/gd1tvkFaWtmhTiogp5vpfnqZhCBhtQ0c/QRZqevxCuGU9iH/ ROLHvzYGKjTvem876+4Ly6jEJqMQnoo7acgzjItSPSKifOAd0Zett2SzkQIITOzArH aTPo0cn6B2qfA== From: Masahiro Yamada <masahiroy@kernel.org> To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada <masahiroy@kernel.org> Subject: [PATCH 24/27] kconfig: move strhash() to a header Date: Sat, 3 Feb 2024 00:58:22 +0900 Message-Id: <20240202155825.314567-25-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240202155825.314567-1-masahiroy@kernel.org> References: <20240202155825.314567-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789803858270200392 X-GMAIL-MSGID: 1789803858270200392 |
Series |
kconfig: refactor lexer and parser code
|
|
Commit Message
Masahiro Yamada
Feb. 2, 2024, 3:58 p.m. UTC
Move strhash() to a header, so it can be used from other files.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/kconfig/symbol.c | 10 +---------
scripts/kconfig/util.h | 15 +++++++++++++++
2 files changed, 16 insertions(+), 9 deletions(-)
create mode 100644 scripts/kconfig/util.h
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index dae630a74e50..518977c525de 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -10,6 +10,7 @@ #include <regex.h> #include "lkc.h" +#include "util.h" struct symbol symbol_yes = { .name = "y", @@ -803,15 +804,6 @@ bool sym_is_changeable(struct symbol *sym) return sym->visible > sym->rev_dep.tri; } -static unsigned strhash(const char *s) -{ - /* fnv32 hash */ - unsigned hash = 2166136261U; - for (; *s; s++) - hash = (hash ^ *s) * 0x01000193; - return hash; -} - struct symbol *sym_lookup(const char *name, int flags) { struct symbol *symbol; diff --git a/scripts/kconfig/util.h b/scripts/kconfig/util.h new file mode 100644 index 000000000000..d4e35bee6450 --- /dev/null +++ b/scripts/kconfig/util.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef UTIL_H +#define UTIL_H + +static unsigned int strhash(const char *s) +{ + /* fnv32 hash */ + unsigned int hash = 2166136261U; + + for (; *s; s++) + hash = (hash ^ *s) * 0x01000193; + return hash; +} + +#endif /* UTIL_H */