kconfig: move strhash() to util.c as a global function
authorMasahiro Yamada <masahiroy@kernel.org>
Fri, 2 Feb 2024 15:58:22 +0000 (00:58 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Tue, 20 Feb 2024 11:36:15 +0000 (20:36 +0900)
Remove the 'static' qualifier from strhash() so that it can be accessed
from other files. Move it to util.c, which is a more appropriate location.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/kconfig/lkc.h
scripts/kconfig/symbol.c
scripts/kconfig/util.c

index 71afcbd562739ceb41bb7f8ec377e3b801da3455..e69d7c59d930272e177618e440c42bee1e8bbce6 100644 (file)
@@ -52,6 +52,7 @@ static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out)
 }
 
 /* util.c */
+unsigned int strhash(const char *s);
 const char *file_lookup(const char *name);
 void *xmalloc(size_t size);
 void *xcalloc(size_t nmemb, size_t size);
index dae630a74e50eb433c1b4ff22024bb7531364336..3dbe3a19622bae938ab308e820858c29c60348fc 100644 (file)
@@ -803,15 +803,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;
index 610d64c01479b85a6059f0633ae5af0cf3844744..d6172f2f64c99bba7d92a554ab7a9a0bd84aa8a0 100644 (file)
@@ -9,6 +9,16 @@
 #include <string.h>
 #include "lkc.h"
 
+unsigned int strhash(const char *s)
+{
+       /* fnv32 hash */
+       unsigned int hash = 2166136261U;
+
+       for (; *s; s++)
+               hash = (hash ^ *s) * 0x01000193;
+       return hash;
+}
+
 struct file {
        struct file *next;
        char name[];