]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
modpost: move strstarts() to modpost.h
authorMasahiro Yamada <masahiroy@kernel.org>
Tue, 19 Nov 2024 23:56:50 +0000 (08:56 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Wed, 27 Nov 2024 23:46:02 +0000 (08:46 +0900)
This macro is useful in file2alias.c as well.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/mod/file2alias.c
scripts/mod/modpost.c
scripts/mod/modpost.h

index 7f1bbb46dc65010676684afd035412e7071ecb3e..541e6a3f95bc287778af686edd49dfe65cf1842b 100644 (file)
@@ -1515,7 +1515,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
                return;
 
        /* All our symbols are of form __mod_<name>__<identifier>_device_table. */
-       if (strncmp(symname, "__mod_", strlen("__mod_")))
+       if (!strstarts(symname, "__mod_"))
                return;
        name = symname + strlen("__mod_");
        namelen = strlen(name);
index 1948d69ce2b90245ab44ed86a204b10e5482bb4a..3bbd5efcf3f377aca61cb3272558cb067494aa8d 100644 (file)
@@ -341,8 +341,6 @@ static const char *sec_name(const struct elf_info *info, unsigned int secindex)
        return sech_name(info, &info->sechdrs[secindex]);
 }
 
-#define strstarts(str, prefix) (strncmp(str, prefix, strlen(prefix)) == 0)
-
 static struct symbol *sym_add_exported(const char *name, struct module *mod,
                                       bool gpl_only, const char *namespace)
 {
index 52efe0026b34ed0ab7a970421e75f84923d255cf..49848fcbe2a1250adfcda52a9869986d500809aa 100644 (file)
@@ -67,6 +67,8 @@
 
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 
+#define strstarts(str, prefix) (strncmp(str, prefix, strlen(prefix)) == 0)
+
 struct buffer {
        char *p;
        int pos;