]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: constify a few static string tables
authorLennart Poettering <lennart@poettering.net>
Fri, 22 Mar 2019 18:19:32 +0000 (19:19 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 25 Mar 2019 13:04:34 +0000 (14:04 +0100)
src/basic/cgroup-util.c
src/core/manager.c
src/core/unit.c
src/network/netdev/bond.c
src/shared/install.c
src/test/test-path-util.c
src/tmpfiles/tmpfiles.c
src/udev/cdrom_id/cdrom_id.c
src/udev/udev-builtin.c
src/udev/udev-rules.c
src/udev/udevadm.c

index dcc0ffdf4408e517752d61d8b5c29f18dcff65f6..fc28109db8d735a0a7fa1adb8e96e292d62a264d 100644 (file)
@@ -2871,7 +2871,7 @@ bool fd_is_cgroup_fs(int fd) {
         return is_cgroup_fs(&s);
 }
 
-static const char *cgroup_controller_table[_CGROUP_CONTROLLER_MAX] = {
+static const char *const cgroup_controller_table[_CGROUP_CONTROLLER_MAX] = {
         [CGROUP_CONTROLLER_CPU] = "cpu",
         [CGROUP_CONTROLLER_CPUACCT] = "cpuacct",
         [CGROUP_CONTROLLER_IO] = "io",
index 33785d905f7357fab56b14f259327a4ad988b88b..7f4f71b9e95d0132a371db77f50b2b6f464c13b9 100644 (file)
@@ -3787,7 +3787,7 @@ static bool generator_path_any(const char* const* paths) {
         return found;
 }
 
-static const char* system_env_generator_binary_paths[] = {
+static const char *const system_env_generator_binary_paths[] = {
         "/run/systemd/system-environment-generators",
         "/etc/systemd/system-environment-generators",
         "/usr/local/lib/systemd/system-environment-generators",
@@ -3795,7 +3795,7 @@ static const char* system_env_generator_binary_paths[] = {
         NULL
 };
 
-static const char* user_env_generator_binary_paths[] = {
+static const char *const user_env_generator_binary_paths[] = {
         "/run/systemd/user-environment-generators",
         "/etc/systemd/user-environment-generators",
         "/usr/local/lib/systemd/user-environment-generators",
@@ -3805,7 +3805,7 @@ static const char* user_env_generator_binary_paths[] = {
 
 static int manager_run_environment_generators(Manager *m) {
         char **tmp = NULL; /* this is only used in the forked process, no cleanup here */
-        const char **paths;
+        const char *const *paths;
         void* args[] = {
                 [STDOUT_GENERATE] = &tmp,
                 [STDOUT_COLLECT] = &tmp,
index d559cfca12153df1753c31dd7e3f899b1c52daaf..2d7cb1457cd9e6c69c5e2704e7dc2c56c454ff3e 100644 (file)
@@ -3195,7 +3195,7 @@ static int serialize_cgroup_mask(FILE *f, const char *key, CGroupMask mask) {
         return serialize_item(f, key, s);
 }
 
-static const char *ip_accounting_metric_field[_CGROUP_IP_ACCOUNTING_METRIC_MAX] = {
+static const char *const ip_accounting_metric_field[_CGROUP_IP_ACCOUNTING_METRIC_MAX] = {
         [CGROUP_IP_INGRESS_BYTES] = "ip-accounting-ingress-bytes",
         [CGROUP_IP_INGRESS_PACKETS] = "ip-accounting-ingress-packets",
         [CGROUP_IP_EGRESS_BYTES] = "ip-accounting-egress-bytes",
index 57f82a8f10f27859bd76e64c4f30e8937994b499..7d912ae5a7daa27d80addf6a87ad82772ef7b5c9 100644 (file)
@@ -116,7 +116,7 @@ static const char *const bond_arp_all_targets_table[_NETDEV_BOND_ARP_ALL_TARGETS
 DEFINE_STRING_TABLE_LOOKUP(bond_arp_all_targets, BondArpAllTargets);
 DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_arp_all_targets, bond_arp_all_targets, BondArpAllTargets, "Failed to parse bond Arp all targets");
 
-static const char *bond_primary_reselect_table[_NETDEV_BOND_PRIMARY_RESELECT_MAX] = {
+static const char *const bond_primary_reselect_table[_NETDEV_BOND_PRIMARY_RESELECT_MAX] = {
         [NETDEV_BOND_PRIMARY_RESELECT_ALWAYS] = "always",
         [NETDEV_BOND_PRIMARY_RESELECT_BETTER]= "better",
         [NETDEV_BOND_PRIMARY_RESELECT_FAILURE]= "failure",
index 9a9d4bfa210220a58b88d4cad6c15623d50025ab..75b6aace0a730d2b65e18385a4369c9b5ceba6e0 100644 (file)
@@ -117,7 +117,7 @@ bool unit_type_may_template(UnitType type) {
                       UNIT_PATH);
 }
 
-static const char *unit_file_type_table[_UNIT_FILE_TYPE_MAX] = {
+static const char *const unit_file_type_table[_UNIT_FILE_TYPE_MAX] = {
         [UNIT_FILE_TYPE_REGULAR] = "regular",
         [UNIT_FILE_TYPE_SYMLINK] = "symlink",
         [UNIT_FILE_TYPE_MASKED] = "masked",
index c64ca7b016d36e1b73b0a751f5e385cf0f7402cc..182991695a4d72dc91856137233da43e8c489fc5 100644 (file)
@@ -179,7 +179,14 @@ static void test_find_binary(const char *self) {
 }
 
 static void test_prefixes(void) {
-        static const char* values[] = { "/a/b/c/d", "/a/b/c", "/a/b", "/a", "", NULL};
+        static const char* const values[] = {
+                "/a/b/c/d",
+                "/a/b/c",
+                "/a/b",
+                "/a",
+                "",
+                NULL
+        };
         unsigned i;
         char s[PATH_MAX];
         bool b;
index ad736002418fade1cb68de6cd92b3dfbb187d1ef..96b619f8ccd7a469fe6f2f59eab46dcc4be23492 100644 (file)
@@ -1504,7 +1504,7 @@ typedef enum {
         _CREATION_MODE_INVALID = -1
 } CreationMode;
 
-static const char *creation_mode_verb_table[_CREATION_MODE_MAX] = {
+static const char *const creation_mode_verb_table[_CREATION_MODE_MAX] = {
         [CREATION_NORMAL] = "Created",
         [CREATION_EXISTING] = "Found existing",
         [CREATION_FORCE] = "Created replacement",
index 214fbaa042b6cb364a73caca500fdd6a34d5a802..3f882f557b38f8aea741856062a363c93d3fbfc4 100644 (file)
@@ -585,7 +585,7 @@ out:
 static int cd_media_info(int fd) {
         struct scsi_cmd sc;
         unsigned char header[32];
-        static const char *media_status[] = {
+        static const char *const media_status[] = {
                 "blank",
                 "appendable",
                 "complete",
index 48ce295a46513fcc250e3ca29ec12775d965b6c7..7bbfd143f6125f7c4aa757a696a6fc877e4876c8 100644 (file)
@@ -12,7 +12,7 @@
 
 static bool initialized;
 
-static const struct udev_builtin *builtins[_UDEV_BUILTIN_MAX] = {
+static const struct udev_builtin *const builtins[_UDEV_BUILTIN_MAX] = {
 #if HAVE_BLKID
         [UDEV_BUILTIN_BLKID] = &udev_builtin_blkid,
 #endif
index 835ce17165a334ff1447a2fd25f225d75d873b70..c5d6feee7e1cdea199979ba21994f2b4847932c3 100644 (file)
@@ -219,7 +219,7 @@ struct rule_tmp {
 
 #if ENABLE_DEBUG_UDEV
 static const char *operation_str(enum operation_type type) {
-        static const char *operation_strs[] = {
+        static const char *const operation_strs[] = {
                 [OP_UNSET] =            "UNSET",
                 [OP_MATCH] =            "match",
                 [OP_NOMATCH] =          "nomatch",
@@ -235,7 +235,7 @@ static const char *operation_str(enum operation_type type) {
 }
 
 static const char *string_glob_str(enum string_glob_type type) {
-        static const char *string_glob_strs[] = {
+        static const char *const string_glob_strs[] = {
                 [GL_UNSET] =            "UNSET",
                 [GL_PLAIN] =            "plain",
                 [GL_GLOB] =             "glob",
@@ -248,7 +248,7 @@ static const char *string_glob_str(enum string_glob_type type) {
 }
 
 static const char *token_str(enum token_type type) {
-        static const char *token_strs[] = {
+        static const char *const token_strs[] = {
                 [TK_UNSET] =                    "UNSET",
                 [TK_RULE] =                     "RULE",
 
index 28194314de497484ef1b049e1c0e265de6bdcd8a..e6dbb111a9a05b349286ca2d2d1ef91f7e2c0a13 100644 (file)
@@ -16,7 +16,7 @@
 #include "util.h"
 
 static int help(void) {
-        static const char * short_descriptions[][2] = {
+        static const char *const short_descriptions[][2] = {
                 { "info",         "Query sysfs or the udev database" },
                 { "trigger",      "Request events from the kernel"   },
                 { "settle",       "Wait for pending udev events"     },