@@ -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;
new file mode 100644
@@ -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 */
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