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>
This commit is contained in:
Emil Velikov 2023-02-06 14:04:46 +00:00 committed by Lucas De Marchi
parent 1712a1548e
commit efc2e4b467
6 changed files with 12 additions and 12 deletions

View File

@ -551,7 +551,7 @@ KMOD_EXPORT int kmod_module_new_from_lookup(struct kmod_ctx *ctx,
const char *given_alias, const char *given_alias,
struct kmod_list **list) struct kmod_list **list)
{ {
const lookup_func lookup[] = { static const lookup_func lookup[] = {
kmod_lookup_alias_from_config, kmod_lookup_alias_from_config,
kmod_lookup_alias_from_moddep_file, kmod_lookup_alias_from_moddep_file,
kmod_lookup_alias_from_symbols_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, const char *modname,
struct kmod_module **mod) struct kmod_module **mod)
{ {
const lookup_func lookup[] = { static const lookup_func lookup[] = {
kmod_lookup_alias_from_moddep_file, kmod_lookup_alias_from_moddep_file,
kmod_lookup_alias_from_builtin_file, kmod_lookup_alias_from_builtin_file,
kmod_lookup_alias_from_kernel_builtin_file, kmod_lookup_alias_from_kernel_builtin_file,

View File

@ -50,7 +50,7 @@
* and is passed to all library operations. * and is passed to all library operations.
*/ */
static struct _index_files { static const struct {
const char *fn; const char *fn;
const char *prefix; const char *prefix;
} index_files[] = { } index_files[] = {
@ -61,7 +61,7 @@ static struct _index_files {
[KMOD_INDEX_MODULES_BUILTIN] = { .fn = "modules.builtin", .prefix = ""}, [KMOD_INDEX_MODULES_BUILTIN] = { .fn = "modules.builtin", .prefix = ""},
}; };
static const char *default_config_paths[] = { static const char *const default_config_paths[] = {
SYSCONFDIR "/modprobe.d", SYSCONFDIR "/modprobe.d",
"/run/modprobe.d", "/run/modprobe.d",
"/usr/local/lib/modprobe.d", "/usr/local/lib/modprobe.d",

View File

@ -29,7 +29,7 @@
static int from_name(const struct test *t) static int from_name(const struct test *t)
{ {
static const char *modnames[] = { static const char *const modnames[] = {
"ext4", "ext4",
"balbalbalbbalbalbalbalbalbalbal", "balbalbalbbalbalbalbalbalbalbal",
"snd-hda-intel", "snd-hda-intel",
@ -37,7 +37,7 @@ static int from_name(const struct test *t)
"iTCO_wdt", "iTCO_wdt",
NULL, NULL,
}; };
const char **p; const char *const *p;
struct kmod_ctx *ctx; struct kmod_ctx *ctx;
struct kmod_module *mod; struct kmod_module *mod;
const char *null_config = NULL; const char *null_config = NULL;
@ -72,11 +72,11 @@ DEFINE_TEST(from_name,
static int from_alias(const struct test *t) static int from_alias(const struct test *t)
{ {
static const char *modnames[] = { static const char *const modnames[] = {
"ext4.*", "ext4.*",
NULL, NULL,
}; };
const char **p; const char *const *p;
struct kmod_ctx *ctx; struct kmod_ctx *ctx;
int err; int err;

View File

@ -31,7 +31,7 @@
static int alias_1(const struct test *t) static int alias_1(const struct test *t)
{ {
static const char *input[] = { static const char *const input[] = {
"test1234", "test1234",
"test[abcfoobar]2211", "test[abcfoobar]2211",
"bar[aaa][bbbb]sss", "bar[aaa][bbbb]sss",
@ -42,7 +42,7 @@ static int alias_1(const struct test *t)
char buf[PATH_MAX]; char buf[PATH_MAX];
size_t len; size_t len;
const char **alias; const char *const *alias;
for (alias = input; *alias != NULL; alias++) { for (alias = input; *alias != NULL; alias++) {
int ret; int ret;

View File

@ -53,7 +53,7 @@ static const struct option options[] = {
#define OVERRIDE_LIBDIR ABS_TOP_BUILDDIR "/testsuite/.libs/" #define OVERRIDE_LIBDIR ABS_TOP_BUILDDIR "/testsuite/.libs/"
#define TEST_TIMEOUT_USEC 2 * USEC_PER_SEC #define TEST_TIMEOUT_USEC 2 * USEC_PER_SEC
struct _env_config { static const struct {
const char *key; const char *key;
const char *ldpreload; const char *ldpreload;
} env_config[_TC_LAST] = { } env_config[_TC_LAST] = {

View File

@ -50,7 +50,7 @@ static int verbose = DEFAULT_VERBOSE;
static const char CFG_BUILTIN_KEY[] = "built-in"; static const char CFG_BUILTIN_KEY[] = "built-in";
static const char CFG_EXTERNAL_KEY[] = "external"; static const char CFG_EXTERNAL_KEY[] = "external";
static const char *default_cfg_paths[] = { static const char *const default_cfg_paths[] = {
SYSCONFDIR "/depmod.d", SYSCONFDIR "/depmod.d",
"/run/depmod.d", "/run/depmod.d",
"/usr/local/lib/depmod.d", "/usr/local/lib/depmod.d",