summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmil Velikov <emil.velikov@collabora.com>2023-02-06 14:04:46 +0000
committerLucas De Marchi <lucas.de.marchi@gmail.com>2023-02-09 07:15:56 -0800
commitefc2e4b4673524220a525f2b6283bf41df99b7af (patch)
tree0727d42212a8feecdaceacf05c24ad8c86c7c364
parent1712a1548eeaad61143f303b09afcb4215943203 (diff)
downloadkmod-efc2e4b4673524220a525f2b6283bf41df99b7af.tar.gz
kmod-efc2e4b4673524220a525f2b6283bf41df99b7af.tar.bz2
kmod-efc2e4b4673524220a525f2b6283bf41df99b7af.zip
treewide: add some static const notations
Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
-rw-r--r--libkmod/libkmod-module.c4
-rw-r--r--libkmod/libkmod.c4
-rw-r--r--testsuite/test-new-module.c8
-rw-r--r--testsuite/test-util.c4
-rw-r--r--testsuite/testsuite.c2
-rw-r--r--tools/depmod.c2
6 files changed, 12 insertions, 12 deletions
diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index 12d8ed1..c7232e0 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -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,
diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index 7c2b889..2670f9a 100644
--- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c
@@ -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",
diff --git a/testsuite/test-new-module.c b/testsuite/test-new-module.c
index 360065c..9872b78 100644
--- a/testsuite/test-new-module.c
+++ b/testsuite/test-new-module.c
@@ -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;
diff --git a/testsuite/test-util.c b/testsuite/test-util.c
index 5766584..e3243e8 100644
--- a/testsuite/test-util.c
+++ b/testsuite/test-util.c
@@ -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;
diff --git a/testsuite/testsuite.c b/testsuite/testsuite.c
index 6a2d296..318343a 100644
--- a/testsuite/testsuite.c
+++ b/testsuite/testsuite.c
@@ -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] = {
diff --git a/tools/depmod.c b/tools/depmod.c
index 5536597..a2c39b3 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -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",