From: Emil Velikov Date: Fri, 23 May 2025 13:15:36 +0000 (+0100) Subject: libkmod: reuse streq/strstartswith() whenever possible X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e32eff22fa87e5642e1b205bd249607ad3b178a6;p=thirdparty%2Fkmod.git libkmod: reuse streq/strstartswith() whenever possible Use our handy macro(s) for clarity and consistency sake. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/354 Signed-off-by: Lucas De Marchi --- diff --git a/tools/depmod.c b/tools/depmod.c index 5f020f83..6d03fbab 100644 --- a/tools/depmod.c +++ b/tools/depmod.c @@ -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'); diff --git a/tools/modprobe.c b/tools/modprobe.c index bf6c74f1..a58b8ef1 100644 --- a/tools/modprobe.c +++ b/tools/modprobe.c @@ -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,