]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
treewide: add some static const notations
authorEmil Velikov <emil.velikov@collabora.com>
Mon, 6 Feb 2023 14:04:46 +0000 (14:04 +0000)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Thu, 9 Feb 2023 15:15:56 +0000 (07:15 -0800)
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
libkmod/libkmod-module.c
libkmod/libkmod.c
testsuite/test-new-module.c
testsuite/test-util.c
testsuite/testsuite.c
tools/depmod.c

index 12d8ed18fff9e520c7a92bb4cf9a016145daa0de..c7232e035ed68d03382c133f88d474130f2039a5 100644 (file)
@@ -551,7 +551,7 @@ KMOD_EXPORT int kmod_module_new_from_lookup(struct kmod_ctx *ctx,
                                                const char *given_alias,
                                                struct kmod_list **list)
 {
-       const lookup_func lookup[] = {
+       static const lookup_func lookup[] = {
                kmod_lookup_alias_from_config,
                kmod_lookup_alias_from_moddep_file,
                kmod_lookup_alias_from_symbols_file,
@@ -619,7 +619,7 @@ KMOD_EXPORT int kmod_module_new_from_name_lookup(struct kmod_ctx *ctx,
                                                 const char *modname,
                                                 struct kmod_module **mod)
 {
-       const lookup_func lookup[] = {
+       static const lookup_func lookup[] = {
                kmod_lookup_alias_from_moddep_file,
                kmod_lookup_alias_from_builtin_file,
                kmod_lookup_alias_from_kernel_builtin_file,
index 7c2b889d713eeceafc6b70bcafc45713cf73ebfd..2670f9a4611a2addb7fa01bd442ecae03dd66932 100644 (file)
@@ -50,7 +50,7 @@
  * and is passed to all library operations.
  */
 
-static struct _index_files {
+static const struct {
        const char *fn;
        const char *prefix;
 } index_files[] = {
@@ -61,7 +61,7 @@ static struct _index_files {
        [KMOD_INDEX_MODULES_BUILTIN] = { .fn = "modules.builtin", .prefix = ""},
 };
 
-static const char *default_config_paths[] = {
+static const char *const default_config_paths[] = {
        SYSCONFDIR "/modprobe.d",
        "/run/modprobe.d",
        "/usr/local/lib/modprobe.d",
index 360065cbef72a0971f2b40ab8aae8f9679e7a809..9872b783f3dc62e2b82535d5c40b30e609f7af23 100644 (file)
@@ -29,7 +29,7 @@
 
 static int from_name(const struct test *t)
 {
-       static const char *modnames[] = {
+       static const char *const modnames[] = {
                "ext4",
                "balbalbalbbalbalbalbalbalbalbal",
                "snd-hda-intel",
@@ -37,7 +37,7 @@ static int from_name(const struct test *t)
                "iTCO_wdt",
                NULL,
        };
-       const char **p;
+       const char *const *p;
        struct kmod_ctx *ctx;
        struct kmod_module *mod;
        const char *null_config = NULL;
@@ -72,11 +72,11 @@ DEFINE_TEST(from_name,
 
 static int from_alias(const struct test *t)
 {
-       static const char *modnames[] = {
+       static const char *const modnames[] = {
                "ext4.*",
                NULL,
        };
-       const char **p;
+       const char *const *p;
        struct kmod_ctx *ctx;
        int err;
 
index 5766584e3e7fcd6a34d60a790868de6ed02b7ca4..e3243e8bc6a2c6935310d2ba5e475149edda36dd 100644 (file)
@@ -31,7 +31,7 @@
 
 static int alias_1(const struct test *t)
 {
-       static const char *input[] = {
+       static const char *const input[] = {
                "test1234",
                "test[abcfoobar]2211",
                "bar[aaa][bbbb]sss",
@@ -42,7 +42,7 @@ static int alias_1(const struct test *t)
 
        char buf[PATH_MAX];
        size_t len;
-       const char **alias;
+       const char *const *alias;
 
        for (alias = input; *alias != NULL; alias++) {
                int ret;
index 6a2d29672ab3e29c63c2506107138ed0be5efb16..318343ac8cdff33ae76dbfcbbd7bb1990b608d11 100644 (file)
@@ -53,7 +53,7 @@ static const struct option options[] = {
 #define OVERRIDE_LIBDIR ABS_TOP_BUILDDIR "/testsuite/.libs/"
 #define TEST_TIMEOUT_USEC 2 * USEC_PER_SEC
 
-struct _env_config {
+static const struct {
        const char *key;
        const char *ldpreload;
 } env_config[_TC_LAST] = {
index 553659755194e5d8da1da8618267f24168e3a52f..a2c39b3f3b1bcb4adae0d6c878c6eaf67ee7dbbc 100644 (file)
@@ -50,7 +50,7 @@ static int verbose = DEFAULT_VERBOSE;
 
 static const char CFG_BUILTIN_KEY[] = "built-in";
 static const char CFG_EXTERNAL_KEY[] = "external";
-static const char *default_cfg_paths[] = {
+static const char *const default_cfg_paths[] = {
        SYSCONFDIR "/depmod.d",
        "/run/depmod.d",
        "/usr/local/lib/depmod.d",