]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
libkmod: reuse streq/strstartswith() whenever possible
authorEmil Velikov <emil.l.velikov@gmail.com>
Fri, 23 May 2025 13:15:36 +0000 (14:15 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Thu, 29 May 2025 22:10:16 +0000 (17:10 -0500)
Use our handy macro(s) for clarity and consistency sake.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/354
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
tools/depmod.c
tools/modprobe.c

index 5f020f8309cb815978f94eb5c52209d897476e03..6d03fbab0ed5ee9771239fd6ebcce839d92688e2 100644 (file)
@@ -2749,7 +2749,7 @@ static int depmod_load_system_map(struct depmod *depmod, const char *filename)
                        p++;
 
                /* Covers gpl-only and normal symbols. */
-               if (strncmp(p, ksymstr, ksymstr_len) != 0)
+               if (!strstartswith(p, ksymstr))
                        continue;
 
                end = strchr(p, '\n');
index bf6c74f100e294ed56cdcabe729db413826ec1d0..a58b8ef176ee17b8c813c4f2c7ebb83a2cfad3dc 100644 (file)
@@ -596,7 +596,7 @@ static int insmod(struct kmod_ctx *ctx, const char *alias, const char *extra_opt
        struct kmod_module *mod = NULL;
        int err, flags = 0;
 
-       if (strncmp(alias, "/", 1) == 0 || strncmp(alias, "./", 2) == 0) {
+       if (strstartswith(alias, "/") || strstartswith(alias, "./")) {
                err = kmod_module_new_from_path(ctx, alias, &mod);
                if (err < 0) {
                        LOG("Failed to get module from path %s: %s\n", alias,